00001 #ifndef BDSSOLENOIDSTEPPER_HH 00002 #define BDSSOLENOIDSTEPPER_HH 00003 #include "globals.hh" 00004 #include "G4MagIntegratorStepper.hh" 00005 #include "G4Mag_EqRhs.hh" 00006 #include "G4ThreeVector.hh" 00007 #include "G4Navigator.hh" 00008 00009 class BDSSolenoidStepper : public G4MagIntegratorStepper 00010 { 00011 00012 public: // with description 00013 00014 BDSSolenoidStepper(G4Mag_EqRhs *EqRhs); 00015 00016 ~BDSSolenoidStepper(); 00017 00018 void Stepper( const G4double y[], 00019 const G4double dydx[], 00020 const G4double h, 00021 G4double yout[], 00022 G4double yerr[] ); 00023 // The stepper for the Runge Kutta integration. 00024 // The stepsize is fixed, equal to h. 00025 // Integrates ODE starting values y[0 to 6] 00026 // Outputs yout[] and its estimated error yerr[]. 00027 00028 G4double DistChord() const; 00029 // Estimate maximum distance of curved solution and chord ... 00030 00031 void SetBField(G4double aBField); 00032 G4double GetBField(); 00033 00034 void StepperName(); 00035 00036 public: // without description 00037 00038 G4int IntegratorOrder()const { return 2; } 00039 00040 protected: 00041 // --- Methods used to implement all the derived classes ----- 00042 00043 void AdvanceHelix( const G4double yIn[], 00044 const G4double dydx[], 00045 G4ThreeVector Bfld, 00046 G4double h, 00047 G4double yOut[], // output 00048 G4double yErr[]); 00049 // A first order Step along a solenoid inside the field. 00050 00051 private: 00052 G4Navigator* SolenoidNavigator; 00053 G4MagIntegratorStepper* backupStepper; // use for high amplitude particles 00054 G4Mag_EqRhs* fPtrMagEqOfMot; 00055 G4double itsBField; 00056 G4double itsDist; 00057 const G4int nvar; 00058 //G4double pitch; 00059 00060 }; 00061 00062 inline void BDSSolenoidStepper::SetBField(G4double aBField) 00063 {itsBField=aBField; 00064 } 00065 00066 inline G4double BDSSolenoidStepper::GetBField() 00067 {return itsBField;} 00068 00069 inline void BDSSolenoidStepper::StepperName() 00070 {G4cout<<"BDSSolenoidStepper"<<G4endl;} 00071 00072 #endif /* BDSSOLENOIDSTEPPER_HH */