CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CMSFieldManager Class Reference

#include <CMSFieldManager.h>

Inheritance diagram for CMSFieldManager:

Public Member Functions

 CMSFieldManager ()
 
void ConfigureForTrack (const G4Track *) override
 
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 *)
 
void SetMonopoleTracking (G4bool)
 
 ~CMSFieldManager () override
 

Private Member Functions

 CMSFieldManager (const CMSFieldManager &)=delete
 
bool isInsideVacuum (const G4Track *)
 
CMSFieldManageroperator= (const CMSFieldManager &)=delete
 
void setChordFinderForVacuum ()
 
void setDefaultChordFinder ()
 

Private Attributes

bool m_cfVacuum
 
G4ChordFinder * m_chordFinder
 
G4ChordFinder * m_chordFinderMonopole
 
G4ChordFinder * m_currChordFinder
 
double m_dChord
 
double m_dChordSimple
 
double m_dIntersection
 
double m_dIntersectionSimple
 
double m_dOneStep
 
double m_dOneStepSimple
 
double m_energyThreshold
 
G4PropagatorInField * m_propagator
 
std::vector< const G4Region * > m_regions
 
double m_stepMax
 
double m_stepMaxSimple
 
std::unique_ptr< sim::FieldtheField
 

Detailed Description

Definition at line 24 of file CMSFieldManager.h.

Constructor & Destructor Documentation

CMSFieldManager::CMSFieldManager ( )
explicit

Definition at line 13 of file CMSFieldManager.cc.

14  : G4FieldManager(),
15  m_currChordFinder(nullptr),
16  m_chordFinder(nullptr),
17  m_chordFinderMonopole(nullptr),
18  m_propagator(nullptr),
19  m_dChord(0.001),
20  m_dOneStep(0.001),
21  m_dIntersection(0.0001),
22  m_stepMax(1000000.),
23  m_energyThreshold(0.0),
24  m_dChordSimple(0.1),
25  m_dOneStepSimple(0.1),
27  m_stepMaxSimple(1000.),
28  m_cfVacuum(false) {}
G4ChordFinder * m_chordFinder
double m_dIntersectionSimple
double m_energyThreshold
G4PropagatorInField * m_propagator
G4ChordFinder * m_currChordFinder
G4ChordFinder * m_chordFinderMonopole
CMSFieldManager::~CMSFieldManager ( )
override

Definition at line 30 of file CMSFieldManager.cc.

References m_chordFinder, m_chordFinderMonopole, and m_currChordFinder.

30  {
32  delete m_chordFinder;
33  }
35  delete m_chordFinderMonopole;
36  }
37 }
G4ChordFinder * m_chordFinder
G4ChordFinder * m_currChordFinder
G4ChordFinder * m_chordFinderMonopole
CMSFieldManager::CMSFieldManager ( const CMSFieldManager )
privatedelete

Member Function Documentation

void CMSFieldManager::ConfigureForTrack ( const G4Track *  track)
override

Definition at line 125 of file CMSFieldManager.cc.

References isInsideVacuum(), m_cfVacuum, m_energyThreshold, setChordFinderForVacuum(), and setDefaultChordFinder().

Referenced by MonopoleTransportation::AlongStepGetPhysicalInteractionLength().

125  {
126  // run time parameters per track
127  if ((track->GetKineticEnergy() <= m_energyThreshold && track->GetParentID() > 0) || isInsideVacuum(track)) {
128  if (!m_cfVacuum) {
130  }
131 
132  } else if (m_cfVacuum) {
133  // restore defaults
135  }
136 }
void setDefaultChordFinder()
double m_energyThreshold
bool isInsideVacuum(const G4Track *)
void setChordFinderForVacuum()
void CMSFieldManager::InitialiseForVolume ( const edm::ParameterSet p,
sim::Field field,
G4ChordFinder *  cfDefault,
G4ChordFinder *  cfMonopole,
const std::string &  vol,
const std::string &  fieldType,
const std::string &  stepperName,
double  delta,
G4PropagatorInField *  pf 
)

Definition at line 39 of file CMSFieldManager.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), GeV, createfilelist::int, m_chordFinder, m_chordFinderMonopole, m_dChord, m_dChordSimple, m_dIntersection, m_dIntersectionSimple, m_dOneStep, m_dOneStepSimple, m_energyThreshold, m_propagator, m_regions, m_stepMax, m_stepMaxSimple, packedPFCandidateRefMixer_cfi::pf, SetMonopoleTracking(), and theField.

Referenced by sim::FieldBuilder::configureForVolume().

47  {
48  double minstep = p.getParameter<double>("MinStep") * CLHEP::mm;
49  double minEpsStep = p.getUntrackedParameter<double>("MinimumEpsilonStep", 0.00001) * CLHEP::mm;
50  double maxEpsStep = p.getUntrackedParameter<double>("MaximumEpsilonStep", 0.01) * CLHEP::mm;
51  int maxLC = (int)p.getUntrackedParameter<double>("MaximumLoopCounts", 1000.);
52 
53  // double
54  m_dChord = p.getParameter<double>("DeltaChord") * CLHEP::mm;
55  m_dOneStep = p.getParameter<double>("DeltaOneStep") * CLHEP::mm;
56  m_dIntersection = p.getParameter<double>("DeltaIntersection") * CLHEP::mm;
57  m_stepMax = p.getParameter<double>("MaxStep") * CLHEP::cm;
58 
59  m_energyThreshold = p.getParameter<double>("EnergyThSimple") * CLHEP::GeV;
60 
61  // double
62  m_dChordSimple = p.getParameter<double>("DeltaChordSimple") * CLHEP::mm;
63  m_dOneStepSimple = p.getParameter<double>("DeltaOneStepSimple") * CLHEP::mm;
64  m_dIntersectionSimple = p.getParameter<double>("DeltaIntersectionSimple") * CLHEP::mm;
65  m_stepMaxSimple = p.getParameter<double>("MaxStepSimple") * CLHEP::cm;
66 
67  edm::LogVerbatim("SimG4CoreApplication")
68  << " New CMSFieldManager: LogicalVolume: <" << vol << ">\n"
69  << " Stepper: <" << stepper << ">\n"
70  << " Field type <" << type << ">\n"
71  << " Field const delta " << delta << " mm\n"
72  << " MaximumLoopCounts " << maxLC << "\n"
73  << " MinimumEpsilonStep " << minEpsStep << "\n"
74  << " MaximumEpsilonStep " << maxEpsStep << "\n"
75  << " MinStep " << minstep << " mm\n"
76  << " MaxStep " << m_stepMax / CLHEP::cm << " cm\n"
77  << " DeltaChord " << m_dChord << " mm\n"
78  << " DeltaOneStep " << m_dOneStep << " mm\n"
79  << " DeltaIntersection " << m_dIntersection << " mm\n"
80  << " EnergyThreshold " << m_energyThreshold << " MeV\n"
81  << " DeltaChordSimple " << m_dChordSimple << " mm\n"
82  << " DeltaOneStepSimple " << m_dOneStepSimple << " mm\n"
83  << " DeltaIntersectionSimple " << m_dIntersectionSimple << " mm\n"
84  << " MaxStepInVacuum " << m_stepMaxSimple / CLHEP::cm << " cm";
85 
86  // initialisation of chord finders
87  m_chordFinder = cf;
88  m_chordFinderMonopole = cfmon;
89 
90  // m_chordFinder->SetDeltaChord(dChord);
91  m_chordFinderMonopole->SetDeltaChord(m_dChord);
92 
93  // initialisation of field manager
94  theField.reset(field);
95  SetDetectorField(field);
96  SetMinimumEpsilonStep(minEpsStep);
97  SetMaximumEpsilonStep(maxEpsStep);
98 
99  // propagater in field
100  m_propagator = pf;
101  pf->SetMaxLoopCount(maxLC);
102  pf->SetMinimumEpsilonStep(minEpsStep);
103  pf->SetMaximumEpsilonStep(maxEpsStep);
104 
105  // initial initialisation the default chord finder is defined
106  SetMonopoleTracking(false);
107 
108  // define regions
109  std::vector<std::string> rnames = p.getParameter<std::vector<std::string>>("VacRegions");
110  if (!rnames.empty()) {
111  std::stringstream ss;
112  std::vector<G4Region *> *rs = G4RegionStore::GetInstance();
113  for (auto &regnam : rnames) {
114  for (auto &reg : *rs) {
115  if (regnam == reg->GetName()) {
116  m_regions.push_back(reg);
117  ss << " " << regnam;
118  }
119  }
120  }
121  edm::LogVerbatim("SimG4CoreApplication") << "Simple field integration in G4Regions:\n" << ss.str() << "\n";
122  }
123 }
G4ChordFinder * m_chordFinder
dbl * delta
Definition: mlp_gen.cc:36
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
double m_dIntersectionSimple
T getUntrackedParameter(std::string const &, T const &) const
const double GeV
Definition: MathUtil.h:16
double m_energyThreshold
G4PropagatorInField * m_propagator
G4ChordFinder * m_chordFinderMonopole
std::unique_ptr< sim::Field > theField
std::vector< const G4Region * > m_regions
void SetMonopoleTracking(G4bool)
bool CMSFieldManager::isInsideVacuum ( const G4Track *  track)
private

Definition at line 154 of file CMSFieldManager.cc.

References m_regions.

Referenced by ConfigureForTrack().

154  {
155  if (!m_regions.empty()) {
156  const G4Region *reg = track->GetVolume()->GetLogicalVolume()->GetRegion();
157  for (auto &areg : m_regions) {
158  if (reg == areg) {
159  return true;
160  }
161  }
162  }
163  return false;
164 }
std::vector< const G4Region * > m_regions
CMSFieldManager& CMSFieldManager::operator= ( const CMSFieldManager )
privatedelete
void CMSFieldManager::setChordFinderForVacuum ( )
private

Definition at line 176 of file CMSFieldManager.cc.

References m_cfVacuum, m_currChordFinder, m_dChordSimple, m_dIntersectionSimple, m_dOneStepSimple, m_propagator, and m_stepMaxSimple.

Referenced by ConfigureForTrack().

176  {
177  m_currChordFinder->SetDeltaChord(m_dChordSimple);
178  SetDeltaOneStep(m_dOneStepSimple);
179  SetDeltaIntersection(m_dIntersectionSimple);
180  m_propagator->SetLargestAcceptableStep(m_stepMaxSimple);
181  m_cfVacuum = true;
182 }
double m_dIntersectionSimple
G4PropagatorInField * m_propagator
G4ChordFinder * m_currChordFinder
void CMSFieldManager::setDefaultChordFinder ( )
private

Definition at line 166 of file CMSFieldManager.cc.

References m_cfVacuum, m_chordFinder, m_currChordFinder, m_dChord, m_dIntersection, m_dOneStep, m_propagator, and m_stepMax.

Referenced by ConfigureForTrack(), and SetMonopoleTracking().

166  {
168  m_currChordFinder->SetDeltaChord(m_dChord);
169  SetChordFinder(m_currChordFinder);
170  SetDeltaOneStep(m_dOneStep);
171  SetDeltaIntersection(m_dIntersection);
172  m_propagator->SetLargestAcceptableStep(m_stepMax);
173  m_cfVacuum = false;
174 }
G4ChordFinder * m_chordFinder
G4PropagatorInField * m_propagator
G4ChordFinder * m_currChordFinder
void CMSFieldManager::SetMonopoleTracking ( G4bool  flag)

Definition at line 138 of file CMSFieldManager.cc.

References m_cfVacuum, m_chordFinderMonopole, m_currChordFinder, and setDefaultChordFinder().

Referenced by MonopoleTransportation::AlongStepGetPhysicalInteractionLength(), InitialiseForVolume(), and MonopoleTransportation::PostStepDoIt().

138  {
139  if (flag) {
141  if (m_cfVacuum) {
143  }
145  SetChordFinder(m_currChordFinder);
146  }
147  } else {
149  }
150  SetFieldChangesEnergy(flag);
151  m_currChordFinder->ResetStepEstimate();
152 }
void setDefaultChordFinder()
G4ChordFinder * m_currChordFinder
G4ChordFinder * m_chordFinderMonopole

Member Data Documentation

bool CMSFieldManager::m_cfVacuum
private
G4ChordFinder* CMSFieldManager::m_chordFinder
private

Definition at line 55 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), setDefaultChordFinder(), and ~CMSFieldManager().

G4ChordFinder* CMSFieldManager::m_chordFinderMonopole
private

Definition at line 56 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), SetMonopoleTracking(), and ~CMSFieldManager().

G4ChordFinder* CMSFieldManager::m_currChordFinder
private
double CMSFieldManager::m_dChord
private

Definition at line 62 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

double CMSFieldManager::m_dChordSimple
private

Definition at line 67 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

double CMSFieldManager::m_dIntersection
private

Definition at line 64 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

double CMSFieldManager::m_dIntersectionSimple
private

Definition at line 69 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

double CMSFieldManager::m_dOneStep
private

Definition at line 63 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

double CMSFieldManager::m_dOneStepSimple
private

Definition at line 68 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

double CMSFieldManager::m_energyThreshold
private

Definition at line 66 of file CMSFieldManager.h.

Referenced by ConfigureForTrack(), and InitialiseForVolume().

G4PropagatorInField* CMSFieldManager::m_propagator
private
std::vector<const G4Region *> CMSFieldManager::m_regions
private

Definition at line 60 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and isInsideVacuum().

double CMSFieldManager::m_stepMax
private

Definition at line 65 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

double CMSFieldManager::m_stepMaxSimple
private

Definition at line 70 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

std::unique_ptr<sim::Field> CMSFieldManager::theField
private

Definition at line 52 of file CMSFieldManager.h.

Referenced by InitialiseForVolume().