/scratch0/jsnuveri/BDSIM/BDSIMgit/bdsim/src/BDSOctMagField.cc

00001 /* BDSIM code.    Version 1.0
00002    Author: Grahame A. Blair, Royal Holloway, Univ. of London.
00003    Last modified 25.12.2003
00004    Copyright (c) 2003 by G.A.Blair.  ALL RIGHTS RESERVED. 
00005 */
00006 #include "BDSGlobalConstants.hh" 
00007 
00008 #include "BDSOctMagField.hh"
00009 
00010 #include "G4Navigator.hh"
00011 #include "G4TransportationManager.hh"
00012 
00013 BDSOctMagField::BDSOctMagField(G4double aBTrpPrime):itsBTrpPrime(aBTrpPrime){}
00014 
00015 BDSOctMagField::~BDSOctMagField(){}
00016 
00017 void BDSOctMagField::GetFieldValue( const G4double Point[4],
00018                        G4double *Bfield ) const
00019 {
00020 
00021   // gab_dec03>>
00022   G4Navigator* OctNavigator=
00023     G4TransportationManager::GetTransportationManager()->
00024     GetNavigatorForTracking();
00025 
00026   G4ThreeVector LocalR, GlobalR;
00027 
00028   GlobalR.setX(Point[0]);
00029   GlobalR.setY(Point[1]);
00030   GlobalR.setZ(Point[2]);
00031   // LocalR = OctNavigator->GetCurrentLocalCoordinate();
00032   G4AffineTransform GlobalAffine=OctNavigator->GetGlobalToLocalTransform();
00033   LocalR=GlobalAffine.TransformPoint(GlobalR); 
00034   // gab_dec03<<
00035 
00036 
00037   Bfield[0]=(3*LocalR.x()*LocalR.x()*LocalR.y()-
00038              pow(LocalR.y(),3))*itsBTrpPrime/6.;
00039   Bfield[1]=(pow(LocalR.x(),3)-LocalR.x()*LocalR.y()*LocalR.y())
00040     *itsBTrpPrime/6.;
00041   Bfield[2]=0;
00042 
00043   // factor of 6 is actually 3-factorial.
00044 }
00045 
00046 
00047 

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7