CMS 3D CMS Logo

FieldStepper.cc
Go to the documentation of this file.
3 
4 #include "G4Mag_UsualEqRhs.hh"
5 #include "G4ClassicalRK4.hh"
6 #include "G4SimpleRunge.hh"
7 #include "G4SimpleHeum.hh"
8 #include "G4CashKarpRKF45.hh"
9 #include "G4RKG3_Stepper.hh"
10 #include "G4ExplicitEuler.hh"
11 #include "G4ImplicitEuler.hh"
12 #include "G4HelixExplicitEuler.hh"
13 #include "G4HelixImplicitEuler.hh"
14 #include "G4HelixSimpleRunge.hh"
15 #include "G4HelixHeum.hh"
16 #include "G4NystromRK4.hh"
17 
18 using namespace sim;
19 
20 FieldStepper::FieldStepper(G4Mag_UsualEqRhs * eq, double del) :
21  G4MagIntegratorStepper(eq, 6), theEquation(eq), delta(del) {}
22 
24 
25 void FieldStepper::Stepper(const double y[],const double dydx[],double h,
26  double yout[],double yerr[])
27 { theStepper->Stepper(y,dydx,h,yout,yerr); }
28 
29 double FieldStepper::DistChord() const { return theStepper->DistChord(); }
30 
32 { return theStepper->IntegratorOrder(); }
33 
34 G4MagIntegratorStepper * FieldStepper::select(const std::string & ss)
35 {
36  if (ss == "G4ClassicalRK4") theStepper = new G4ClassicalRK4(theEquation);
37  else if (ss == "G4NystromRK4") theStepper = new G4NystromRK4(theEquation, delta);
38  else if (ss == "G4SimpleRunge") theStepper = new G4SimpleRunge(theEquation);
39  else if (ss == "G4SimpleHeum") theStepper = new G4SimpleHeum(theEquation);
40  else if (ss == "G4CashKarpRKF45") theStepper = new G4CashKarpRKF45(theEquation);
41  else if (ss == "G4RKG3_Stepper") theStepper = new G4RKG3_Stepper(theEquation);
42  else if (ss == "G4ExplicitEuler") theStepper = new G4ExplicitEuler(theEquation);
43  else if (ss == "G4ImplicitEuler") theStepper = new G4ImplicitEuler(theEquation);
44  else if (ss == "G4HelixExplicitEuler") theStepper = new G4HelixExplicitEuler(theEquation);
45  else if (ss == "G4HelixImplicitEuler") theStepper = new G4HelixImplicitEuler(theEquation);
46  else if (ss == "G4HelixSimpleRunge") theStepper = new G4HelixSimpleRunge(theEquation);
47  else if (ss == "G4HelixHeum") theStepper = new G4HelixHeum(theEquation);
48  else
49  {
50  edm::LogWarning("SimG4CoreMagneticField")
51  << " FieldStepper invalid choice, defaulting to G4ClassicalRK4 ";
52  theStepper = new G4ClassicalRK4(theEquation);
53  }
54  return theStepper;
55 }
dbl * delta
Definition: mlp_gen.cc:36
void Stepper(const double y[], const double dydx[], double h, double yout[], double yerr[]) override
Definition: FieldStepper.cc:25
double DistChord() const override
Definition: FieldStepper.cc:29
~FieldStepper() override
Definition: FieldStepper.cc:23
G4MagIntegratorStepper * theStepper
Definition: FieldStepper.h:20
FieldStepper(G4Mag_UsualEqRhs *eq, double del=0.0)
Definition: FieldStepper.cc:20
Definition: RunManager.h:28
int IntegratorOrder() const override
Definition: FieldStepper.cc:31
G4MagIntegratorStepper * select(const std::string &s)
Definition: FieldStepper.cc:34
G4Mag_UsualEqRhs * theEquation
Definition: FieldStepper.h:21