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

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

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7