00001
00002
00003
00004
00005
00006 #include "BDSExecOptions.hh"
00007 #include "BDSGlobalConstants.hh"
00008
00009 #include "BDSDriftStepper.hh"
00010 #include "G4Event.hh"
00011 #include "G4EventManager.hh"
00012 #include "G4ThreeVector.hh"
00013
00014 BDSDriftStepper::BDSDriftStepper(G4Mag_EqRhs *EqRhs)
00015 : G4MagIntegratorStepper(EqRhs,6)
00016
00017 {
00018 verboseStep = BDSExecOptions::Instance()->GetVerboseStep();
00019 verboseEventNumber = BDSExecOptions::Instance()->GetVerboseEventNumber();
00020 }
00021
00022 void BDSDriftStepper::AdvanceHelix( const G4double yIn[],
00023 G4ThreeVector ,
00024 G4double h,
00025 G4double yDrift[])
00026 {
00027 G4ThreeVector positionMove, endTangent;
00028
00029 const G4double *pIn = yIn+3;
00030 G4ThreeVector v0= G4ThreeVector( pIn[0], pIn[1], pIn[2]);
00031
00032
00033 G4double InitMag=v0.mag();
00034
00035 positionMove = (h/InitMag) * v0;
00036
00037
00038 yDrift[0] = yIn[0] + positionMove.x();
00039 yDrift[1] = yIn[1] + positionMove.y();
00040 yDrift[2] = yIn[2] + positionMove.z();
00041
00042 yDrift[3] = v0.x();
00043 yDrift[4] = v0.y();
00044 yDrift[5] = v0.z();
00045
00046
00047
00048
00049
00050 if(verboseStep && verboseEventNumber == G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID())
00051 {
00052 int G4precision = G4cout.precision();
00053 G4cout.precision(10);
00054 G4cout<<" h="<<h/CLHEP::m<<G4endl;
00055 G4cout<<"xIn="<<yIn[0]/CLHEP::m<<" yIn="<<yIn[1]/CLHEP::m<<
00056 " zIn="<<yIn[2]/CLHEP::m<<" v0="<<v0<<G4endl;
00057 G4cout<<"xOut="<<yDrift[0]/CLHEP::m<<" yOut="<<yDrift[1]/CLHEP::m<<
00058 "zOut="<<yDrift[2]/CLHEP::m<<G4endl;
00059
00060 G4cout.precision(G4precision);
00061 }
00062 }
00063
00064 void BDSDriftStepper::Stepper( const G4double yInput[],
00065 const G4double[],
00066 const G4double hstep,
00067 G4double yOut[],
00068 G4double yErr[] )
00069 {
00070 const G4int nvar = 6 ;
00071
00072 G4int i;
00073 for(i=0;i<nvar;i++) yErr[i]=0;
00074
00075
00076
00077 AdvanceHelix(yInput,(G4ThreeVector)0,hstep,yOut);
00078
00079
00080
00081
00082 }
00083
00084 G4double BDSDriftStepper::DistChord() const
00085 {
00086 return 0;
00087 }
00088
00089 BDSDriftStepper::~BDSDriftStepper()
00090 {}