/home/cern/BDSIM_new/src/BDSMuSpoilerMagField.cc

00001 /* BDSIM code.    Version 1.0
00002    Author: Grahame A. Blair, Royal Holloway, Univ. of London.
00003    Last modified 12.12.2004
00004    Copyright (c) 2004 by G.A.Blair.  ALL RIGHTS RESERVED. 
00005 */
00006 #include "BDSGlobalConstants.hh" // must be first in include list
00007 
00008 #include "globals.hh"
00009 #include "BDSMuSpoilerMagField.hh"
00010 
00011 #include "G4Navigator.hh"
00012 #include "G4TransportationManager.hh"
00013 
00014 BDSMuSpoilerMagField::BDSMuSpoilerMagField(G4double aField)
00015   :itsBField(aField)
00016 {}
00017 
00018 BDSMuSpoilerMagField::~BDSMuSpoilerMagField(){}
00019 
00020 void BDSMuSpoilerMagField::GetFieldValue(const G4double Point[4],
00021                                               G4double *Bfield ) const
00022 {
00023   G4Navigator* MuSpoilerNavigator=
00024     G4TransportationManager::GetTransportationManager()->
00025     GetNavigatorForTracking();
00026 
00027   G4ThreeVector GlobalPosition= G4ThreeVector( Point[0], Point[1], Point[2]);  
00028   G4AffineTransform GlobalAffine=MuSpoilerNavigator->
00029     GetGlobalToLocalTransform();  
00030   G4ThreeVector LocalR=GlobalAffine.TransformPoint(GlobalPosition); 
00031 
00032   G4double BFactor=itsBField/LocalR.mag();
00033 
00034   //G4double phi = LocalR.phi();
00035 
00036   Bfield[0]= LocalR.y()*BFactor;
00037   Bfield[1]= -LocalR.x()*BFactor;
00038   Bfield[2]=0;
00039 }
00040 
00041 
00042 

Generated on Wed Mar 5 17:25:22 2008 for BDSIM by  doxygen 1.5.3