CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/SimG4Core/MagneticField/src/FieldStepper.cc

Go to the documentation of this file.
00001 #include "SimG4Core/MagneticField/interface/FieldStepper.h"
00002 
00003 #include "G4Mag_UsualEqRhs.hh"
00004 #include "G4ClassicalRK4.hh"
00005 #include "G4SimpleRunge.hh"
00006 #include "G4SimpleHeum.hh"
00007 #include "G4CashKarpRKF45.hh"
00008 #include "G4RKG3_Stepper.hh"
00009 #include "G4ExplicitEuler.hh"
00010 #include "G4ImplicitEuler.hh"
00011 #include "G4HelixExplicitEuler.hh"
00012 #include "G4HelixImplicitEuler.hh"
00013 #include "G4HelixSimpleRunge.hh"
00014 #include "G4HelixHeum.hh"
00015 
00016 using namespace sim;
00017 
00018 FieldStepper::FieldStepper(G4Mag_UsualEqRhs * eq) :
00019     G4MagIntegratorStepper(eq, 6), theEquation(eq) {}
00020 
00021 FieldStepper::~FieldStepper() {}
00022 
00023 void FieldStepper::Stepper(const double y[],const double dydx[],double h,
00024                               double yout[],double yerr[])
00025 { theStepper->Stepper(y,dydx,h,yout,yerr); }
00026 
00027 double FieldStepper::DistChord() const { return theStepper->DistChord(); }
00028 
00029 int FieldStepper::IntegratorOrder() const
00030 { return theStepper->IntegratorOrder(); }
00031 
00032 G4MagIntegratorStepper * FieldStepper::select(const std::string & s)
00033 {
00034     if      (s == "G4ClassicalRK4")       theStepper = new G4ClassicalRK4(theEquation);
00035     else if (s == "G4SimpleRunge")        theStepper = new G4SimpleRunge(theEquation);
00036     else if (s == "G4SimpleHeum")         theStepper = new G4SimpleHeum(theEquation);
00037     else if (s == "G4CashKarpRKF45")      theStepper = new G4CashKarpRKF45(theEquation);
00038     else if (s == "G4RKG3_Stepper")       theStepper = new G4RKG3_Stepper(theEquation);
00039     else if (s == "G4ExplicitEuler")      theStepper = new G4ExplicitEuler(theEquation);
00040     else if (s == "G4ImplicitEuler")      theStepper = new G4ImplicitEuler(theEquation);
00041     else if (s == "G4HelixExplicitEuler") theStepper = new G4HelixExplicitEuler(theEquation);
00042     else if (s == "G4HelixImplicitEuler") theStepper = new G4HelixImplicitEuler(theEquation);
00043     else if (s == "G4HelixSimpleRunge")   theStepper = new G4HelixSimpleRunge(theEquation);
00044     else if (s == "G4HelixHeum")          theStepper = new G4HelixHeum(theEquation);
00045     else
00046     {
00047         std::cout << " FieldStepper invalid choice, defaulting to G4ClassicalRK4 " << std::endl;
00048         theStepper = new G4ClassicalRK4(theEquation);
00049     }
00050     return theStepper;
00051 }