/scratch0/jsnuveri/BDSIM/BDSIMgit/bdsim/src/BDSDecMagField.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 "BDSDecMagField.hh"
00009 
00010 #include "G4Navigator.hh"
00011 #include "G4TransportationManager.hh"
00012 
00013 BDSDecMagField::BDSDecMagField(G4double aBQuadPrime):itsBQuadPrime(aBQuadPrime){}
00014  
00015 BDSDecMagField::~BDSDecMagField(){}
00016 
00017 void BDSDecMagField::GetFieldValue( const G4double Point[4],
00018                        G4double *Bfield ) const
00019 {
00020 
00021      
00022   G4Navigator* DecNavigator=
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 
00033   G4AffineTransform GlobalAffine=DecNavigator->GetGlobalToLocalTransform();
00034   LocalR=GlobalAffine.TransformPoint(GlobalR); 
00035   // gab_dec03<<
00036 
00037   Bfield[0]= 4*LocalR.x()*LocalR.y()*(LocalR.x()*LocalR.x()
00038                                       -LocalR.y()*LocalR.y())*itsBQuadPrime/24;
00039   Bfield[1]=(pow(LocalR.x(),4)-6*LocalR.x()*LocalR.x()*LocalR.y()*LocalR.y()+
00040              pow(LocalR.y(),4))*itsBQuadPrime/24;
00041   Bfield[2]=0;
00042 
00043   // factor of 24 is actually 4-factorial.
00044 }
00045 
00046 
00047 

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7