/home/cern/BDSIM_new/src/BDSSkewSextMagField.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" // must be first in include list
00007 
00008 #include "BDSSkewSextMagField.hh"
00009 
00010 #include "G4Navigator.hh"
00011 #include "G4TransportationManager.hh"
00012 
00013 BDSSkewSextMagField::BDSSkewSextMagField(G4double aBDblePrime):
00014   itsBDblePrime(aBDblePrime){}
00015 
00016 BDSSkewSextMagField::~BDSSkewSextMagField(){}
00017 
00018 void BDSSkewSextMagField::GetFieldValue( const G4double Point[4],
00019                        G4double *Bfield ) const
00020 {
00021   G4Navigator* SkewSextNavigator=
00022     G4TransportationManager::GetTransportationManager()->
00023     GetNavigatorForTracking();
00024 
00025  // gab_dec03>>
00026   G4ThreeVector LocalR, GlobalR;
00027   GlobalR.setX(Point[0]);
00028   GlobalR.setY(Point[1]);
00029   GlobalR.setZ(Point[2]);
00030   // LocalR = SkewSextNavigator->GetCurrentLocalCoordinate();
00031   G4AffineTransform GlobalAffine=SkewSextNavigator->
00032     GetGlobalToLocalTransform();
00033   LocalR=GlobalAffine.TransformPoint(GlobalR); 
00034   // gab_dec03<<
00035 
00036 
00037   Bfield[0]=(LocalR.x()*LocalR.x()-LocalR.y()*LocalR.y())*itsBDblePrime/2;
00038   Bfield[1]=-2*LocalR.x()*LocalR.y()*itsBDblePrime/2;
00039   Bfield[2]=0;
00040 
00041   // factor of 2 is actually 2-factorial.
00042 }
00043 
00044 
00045 

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