00001 #include "BDSExecOptions.hh"
00002 #include "BDSGlobalConstants.hh"
00003
00004 #include "BDSTeleporterStepper.hh"
00005 #include "BDSDebug.hh"
00006 #include "G4Event.hh"
00007 #include "G4EventManager.hh"
00008
00009 BDSTeleporterStepper::BDSTeleporterStepper(G4Mag_EqRhs *EqRhs)
00010 : G4MagIntegratorStepper(EqRhs,6)
00011
00012 {
00013 #ifdef BDSDEBUG
00014 G4cout << "BDSTeleporterStepper Constructor " << G4endl;
00015 #endif
00016 verboseStep = BDSExecOptions::Instance()->GetVerboseStep();
00017 verboseEventNumber = BDSExecOptions::Instance()->GetVerboseEventNumber();
00018 nvar = 6;
00019
00020
00021 teleporterdelta = BDSGlobalConstants::Instance()->GetTeleporterDelta();
00022 }
00023
00024
00025 void BDSTeleporterStepper::AdvanceHelix( const G4double yIn[],
00026 G4ThreeVector ,
00027 G4double h,
00028 G4double yOut[])
00029 {
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifdef BDSDEBUG
00039 G4int turnstaken = BDSGlobalConstants::Instance()->GetTurnsTaken();
00040 G4cout << " Teleporter Stepper" << G4endl;
00041 G4cout << "turnstaken " << turnstaken << G4endl;
00042 #endif
00043
00044 if (1 == 1)
00045 {
00046
00047
00048
00049
00050
00051
00052
00053 yOut[0] = yIn[0] - teleporterdelta.x();
00054 yOut[1] = yIn[1] - teleporterdelta.y();
00055 yOut[2] = yIn[2] + h;
00056 yOut[3] = yIn[3];
00057 yOut[4] = yIn[4];
00058 yOut[5] = yIn[5];
00059 }
00060 else
00061 {
00062
00063 yOut[0] = yIn[0];
00064 yOut[1] = yIn[1];
00065 yOut[2] = yIn[2] + h;
00066 yOut[3] = yIn[3];
00067 yOut[4] = yIn[4];
00068 yOut[5] = yIn[5];
00069 }
00070
00071
00072 if(verboseStep || verboseEventNumber == G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID())
00073 {
00074 G4ThreeVector inA = G4ThreeVector(yIn[0],yIn[1],yIn[2]);
00075 G4ThreeVector inB = G4ThreeVector(yIn[3],yIn[4],yIn[5]);
00076 G4ThreeVector outA = G4ThreeVector(yOut[0],yOut[1],yOut[2]);
00077 G4ThreeVector outB = G4ThreeVector(yOut[3],yOut[4],yOut[5]);
00078 int G4precision = G4cout.precision();
00079 G4cout.precision(10);
00080 G4cout << __METHOD_NAME__ << G4endl;
00081 G4cout << "h (step length) " << h /CLHEP::m << G4endl;
00082 G4cout << "Input x,y,z " << inA /CLHEP::m << G4endl;
00083 G4cout << "Input px,py,pz " << inB /CLHEP::m << G4endl;
00084 G4cout << "Output x,y,z " << outA/CLHEP::m << G4endl;
00085 G4cout << "Output px,py,pz " << outB/CLHEP::m << G4endl;
00086 G4cout.precision(G4precision);
00087 }
00088 }
00089
00090 void BDSTeleporterStepper::Stepper( const G4double yInput[],
00091 const G4double[],
00092 const G4double hstep,
00093 G4double yOut[],
00094 G4double yErr[])
00095 {
00096
00097 G4int i;
00098 for(i=0;i<nvar;i++) yErr[i]=0;
00099
00100 AdvanceHelix(yInput,(G4ThreeVector)0,hstep,yOut);
00101 }
00102
00103 BDSTeleporterStepper::~BDSTeleporterStepper()
00104 {}