10 #include "SimG4Core/MagneticField/interface/G4MonopoleEquation.hh"
20 #include "G4Mag_UsualEqRhs.hh"
21 #include "G4ClassicalRK4.hh"
22 #include "G4PropagatorInField.hh"
23 #include "G4FieldManager.hh"
24 #include "G4TransportationManager.hh"
25 #include "G4ChordFinder.hh"
26 #include "G4UniformMagField.hh"
30 #include "G4LogicalVolumeStore.hh"
36 : theField(new
Field(f, p.getParameter<double>(
"delta"))),
37 theFieldEquation(new G4Mag_UsualEqRhs(theField.
get())),
39 fieldValue(0.), minStep(0.), dChord(0.), dOneStep(0.),
40 dIntersection(0.), dIntersectionAndOneStep(0.),
41 maxLoopCount(0), minEpsilonStep(0.), maxEpsilonStep(0.),
65 <<
" FieldBuilder: Local magnetic field is used";
74 if ( thePSetForLMFM == defpset ) {
75 std::cout <<
" Patology ! Local Mag.Field Manager requested but config not given !\n";
79 std::vector<std::string> ListOfVolumes =
80 thePSetForLMFM.
getParameter< std::vector<std::string> >(
"ListOfVolumes");
83 for (
unsigned int i = 0;
i < ListOfVolumes.size(); ++
i ) {
85 G4FieldManager* fAltM =
new G4FieldManager() ;
94 <<
" FieldBuilder: Global magnetic field is used";
101 G4PropagatorInField * fP,
104 G4LogicalVolumeStore* theStore = G4LogicalVolumeStore::GetInstance();
105 for (
unsigned int i=0;
i<(*theStore).size(); ++
i ) {
107 if ( curVolName == volName ) {
116 minStep = stpPSet.getParameter<
double>(
"MinStep") ;
117 dChord = stpPSet.getParameter<
double>(
"DeltaChord") ;
118 dOneStep = stpPSet.getParameter<
double>(
"DeltaOneStep") ;
119 dIntersection = stpPSet.getParameter<
double>(
"DeltaIntersection") ;
121 stpPSet.getUntrackedParameter<
double>(
"DeltaIntersectionAndOneStep",-1.);
123 stpPSet.getUntrackedParameter<
double>(
"MaximumLoopCounts",1000);
125 stpPSet.getUntrackedParameter<
double>(
"MinimumEpsilonStep",0.00001);
127 stpPSet.getUntrackedParameter<
double>(
"MaximumEpsilonStep",0.01);
133 <<
" FieldBuilder: Selected stepper: <" << stepper
134 <<
"> const field delta(mm)= " <<
delta;
142 fM->SetDetectorField(
theField.get());
146 G4ChordFinder * CF =
new G4ChordFinder(
theField.get(),
minStep,theStepper);
147 CF->SetDeltaChord(
dChord);
148 fM->SetChordFinder(CF);
155 G4MonopoleEquation* fMonopoleEquation =
156 new G4MonopoleEquation(
theField.get());
157 G4MagIntegratorStepper* theStepper =
158 new G4ClassicalRK4(fMonopoleEquation,8);
159 G4ChordFinder *chordFinderMonopole =
161 chordFinderMonopole->SetDeltaChord(
dChord);
171 fP->SetVerboseLevel(0);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool isMonopoleSet() const
void configureForVolume(const std::string &volName, edm::ParameterSet &volPSet, G4FieldManager *fM=nullptr, G4PropagatorInField *fP=nullptr, ChordFinderSetter *setter=nullptr)
void configureFieldManager(G4FieldManager *fM, ChordFinderSetter *setter)
void build(G4FieldManager *fM=nullptr, G4PropagatorInField *fP=nullptr, ChordFinderSetter *setter=nullptr)
G4LogicalVolume * theTopVolume
void SetVerbosity(bool flag)
double dIntersectionAndOneStep
FieldBuilder(const MagneticField *, const edm::ParameterSet &)
G4MagIntegratorStepper * select(const std::string &s)
std::auto_ptr< Field > theField
void setMonopole(G4ChordFinder *cfm)
G4LogicalVolume * fieldTopVolume()
G4Mag_UsualEqRhs * theFieldEquation
edm::ParameterSet thePSet
void configurePropagatorInField(G4PropagatorInField *fP)
T get(const Candidate &c)