CMS 3D CMS Logo

FieldBuilder.cc
Go to the documentation of this file.
3 
6 
12 
13 #include "CLHEP/Units/GlobalSystemOfUnits.h"
14 #include "G4ChordFinder.hh"
15 #include "G4ClassicalRK4.hh"
16 #include "G4FieldManager.hh"
17 #include "G4LogicalVolumeStore.hh"
18 #include "G4Mag_UsualEqRhs.hh"
19 #include "G4PropagatorInField.hh"
20 
21 using namespace sim;
22 
23 FieldBuilder::FieldBuilder(const MagneticField *f, const edm::ParameterSet &p) : theTopVolume(nullptr), thePSet(p) {
24  theDelta = p.getParameter<double>("delta") * CLHEP::mm;
25  theField = new Field(f, theDelta);
26  theFieldEquation = new G4Mag_UsualEqRhs(theField);
27 }
28 
30 
31 void FieldBuilder::build(CMSFieldManager *fM, G4PropagatorInField *fP) {
32  edm::ParameterSet thePSetForGMFM = thePSet.getParameter<edm::ParameterSet>("ConfGlobalMFM");
33  std::string volName = thePSetForGMFM.getParameter<std::string>("Volume");
34  edm::ParameterSet volPSet = thePSetForGMFM.getParameter<edm::ParameterSet>(volName);
35 
36  configureForVolume(volName, volPSet, fM, fP);
37 
38  edm::LogVerbatim("SimG4CoreMagneticField") << " FieldBuilder::build: Global magnetic field is used";
39 }
40 
42  edm::ParameterSet &volPSet,
43  CMSFieldManager *fM,
44  G4PropagatorInField *fP) {
45  G4LogicalVolumeStore *theStore = G4LogicalVolumeStore::GetInstance();
46  for (auto vol : *theStore) {
47  if ((std::string)vol->GetName() == volName) {
48  theTopVolume = vol;
49  break;
50  }
51  }
52 
53  std::string fieldType = volPSet.getParameter<std::string>("Type");
54  std::string stepper = volPSet.getParameter<std::string>("Stepper");
55 
56  edm::ParameterSet stpPSet = volPSet.getParameter<edm::ParameterSet>("StepperParam");
57  double minStep = stpPSet.getParameter<double>("MinStep") * CLHEP::mm;
58 
59  FieldStepper *dStepper = new FieldStepper(theFieldEquation, theDelta, stepper);
60  G4ChordFinder *cf = new G4ChordFinder(theField, minStep, dStepper);
61 
62  MonopoleEquation *monopoleEquation = new MonopoleEquation(theField);
63  G4MagIntegratorStepper *mStepper = new G4ClassicalRK4(monopoleEquation, 8);
64  G4ChordFinder *cfmon = new G4ChordFinder(theField, minStep, mStepper);
65 
66  fM->InitialiseForVolume(stpPSet, theField, cf, cfmon, volName, fieldType, stepper, theDelta, fP);
67 }
FieldBuilder.h
sim::FieldBuilder::~FieldBuilder
~FieldBuilder()
Definition: FieldBuilder.cc:29
sim::FieldBuilder::theField
Field * theField
Definition: FieldBuilder.h:29
MessageLogger.h
ESHandle.h
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
sim::FieldBuilder::build
void build(CMSFieldManager *fM, G4PropagatorInField *fP)
Definition: FieldBuilder.cc:31
CMSFieldManager.h
CMSFieldManager::InitialiseForVolume
void InitialiseForVolume(const edm::ParameterSet &, sim::Field *, G4ChordFinder *cfDefault, G4ChordFinder *cfMonopole, const std::string &vol, const std::string &fieldType, const std::string &stepperName, double delta, G4PropagatorInField *)
Definition: CMSFieldManager.cc:39
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CMSFieldManager
Definition: CMSFieldManager.h:24
FieldStepper.h
sim::FieldBuilder::theTopVolume
G4LogicalVolume * theTopVolume
Definition: FieldBuilder.h:31
FieldStepper
Definition: FieldStepper.h:8
sim::FieldBuilder::theFieldEquation
G4Mag_UsualEqRhs * theFieldEquation
Definition: FieldBuilder.h:30
sim::Field
Definition: Field.h:9
sim::FieldBuilder::thePSet
edm::ParameterSet thePSet
Definition: FieldBuilder.h:32
IdealMagneticFieldRecord.h
sim::FieldBuilder::configureForVolume
void configureForVolume(const std::string &volName, edm::ParameterSet &volPSet, CMSFieldManager *fM, G4PropagatorInField *fP)
Definition: FieldBuilder.cc:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
sim
Definition: GeometryProducer.h:20
Field.h
edm::LogVerbatim
Definition: MessageLogger.h:297
MagneticField.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
sim::FieldBuilder::theDelta
double theDelta
Definition: FieldBuilder.h:33
MonopoleEquation.h
MonopoleEquation
Definition: MonopoleEquation.h:28
sim::FieldBuilder::FieldBuilder
FieldBuilder(const MagneticField *, const edm::ParameterSet &)
Definition: FieldBuilder.cc:23
MagneticField
Definition: MagneticField.h:19