10 #include "SimG4Core/MagneticField/interface/G4MonopoleEquation.hh"
13 #include "G4Mag_UsualEqRhs.hh"
14 #include "G4ClassicalRK4.hh"
15 #include "G4PropagatorInField.hh"
16 #include "G4FieldManager.hh"
17 #include "G4TransportationManager.hh"
18 #include "G4ChordFinder.hh"
19 #include "G4UniformMagField.hh"
23 #include "G4LogicalVolumeStore.hh"
29 : theField(new
Field(f, p.getParameter<double>(
"delta"))),
30 theFieldEquation(new G4Mag_UsualEqRhs(theField.
get())),
32 fieldValue(0.), minStep(0.), dChord(0.), dOneStep(0.),
33 dIntersection(0.), dIntersectionAndOneStep(0.),
34 maxLoopCount(0), minEpsilonStep(0.), maxEpsilonStep(0.),
56 <<
" FieldBuilder: Local magnetic field is used";
65 if ( thePSetForLMFM == defpset ) {
67 <<
" FieldBuilder::build: Patology! Local Mag.Field Manager requested but config not given!";
71 std::vector<std::string> ListOfVolumes =
72 thePSetForLMFM.
getParameter< std::vector<std::string> >(
"ListOfVolumes");
75 for (
unsigned int i = 0;
i < ListOfVolumes.size(); ++
i ) {
77 G4FieldManager* fAltM =
new G4FieldManager() ;
86 <<
" FieldBuilder::build: Global magnetic field is used";
93 G4PropagatorInField * fP,
96 G4LogicalVolumeStore* theStore = G4LogicalVolumeStore::GetInstance();
97 for (
unsigned int i=0;
i<(*theStore).size(); ++
i ) {
99 if ( curVolName == volName ) {
108 minStep = stpPSet.getParameter<
double>(
"MinStep") ;
109 dChord = stpPSet.getParameter<
double>(
"DeltaChord") ;
110 dOneStep = stpPSet.getParameter<
double>(
"DeltaOneStep") ;
111 dIntersection = stpPSet.getParameter<
double>(
"DeltaIntersection") ;
113 stpPSet.getUntrackedParameter<
double>(
"DeltaIntersectionAndOneStep",-1.);
115 stpPSet.getUntrackedParameter<
double>(
"MaximumLoopCounts",1000);
117 stpPSet.getUntrackedParameter<
double>(
"MinimumEpsilonStep",0.00001);
119 stpPSet.getUntrackedParameter<
double>(
"MaximumEpsilonStep",0.01);
125 <<
" FieldBuilder: Selected stepper: <" << stepper
126 <<
"> const field delta(mm)= " <<
delta;
134 fM->SetDetectorField(
theField.get());
138 G4ChordFinder * CF =
new G4ChordFinder(
theField.get(),
minStep,theStepper);
139 CF->SetDeltaChord(
dChord);
140 fM->SetChordFinder(CF);
147 G4MonopoleEquation* fMonopoleEquation =
148 new G4MonopoleEquation(
theField.get());
149 G4MagIntegratorStepper* theStepper =
150 new G4ClassicalRK4(fMonopoleEquation,8);
151 G4ChordFinder *chordFinderMonopole =
153 chordFinderMonopole->SetDeltaChord(
dChord);
163 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
return(e1-e2)*(e1-e2)+dp *dp
void setMonopole(G4ChordFinder *cfm)
G4LogicalVolume * fieldTopVolume()
G4Mag_UsualEqRhs * theFieldEquation
edm::ParameterSet thePSet
void configurePropagatorInField(G4PropagatorInField *fP)
T get(const Candidate &c)