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() [1/2]

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) {}

◆ ~CMSFieldManager()

CMSFieldManager::~CMSFieldManager ( )
override

Definition at line 30 of file CMSFieldManager.cc.

30  {
32  delete m_chordFinder;
33  }
35  delete m_chordFinderMonopole;
36  }
37 }

References m_chordFinder, m_chordFinderMonopole, and m_currChordFinder.

◆ CMSFieldManager() [2/2]

CMSFieldManager::CMSFieldManager ( const CMSFieldManager )
privatedelete

Member Function Documentation

◆ ConfigureForTrack()

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

Definition at line 125 of file CMSFieldManager.cc.

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 }

References isInsideVacuum(), m_cfVacuum, m_energyThreshold, setChordFinderForVacuum(), setDefaultChordFinder(), and HLT_2018_cff::track.

Referenced by MonopoleTransportation::AlongStepGetPhysicalInteractionLength().

◆ InitialiseForVolume()

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.

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 }

References dumpMFGeometry_cfg::delta, 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, AlCaHLTBitMon_ParallelJobs::p, packedPFCandidateRefMixer_cfi::pf, SetMonopoleTracking(), contentValuesCheck::ss, and theField.

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

◆ isInsideVacuum()

bool CMSFieldManager::isInsideVacuum ( const G4Track *  track)
private

Definition at line 154 of file CMSFieldManager.cc.

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 }

References m_regions, and HLT_2018_cff::track.

Referenced by ConfigureForTrack().

◆ operator=()

CMSFieldManager& CMSFieldManager::operator= ( const CMSFieldManager )
privatedelete

◆ setChordFinderForVacuum()

void CMSFieldManager::setChordFinderForVacuum ( )
private

Definition at line 176 of file CMSFieldManager.cc.

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 }

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

Referenced by ConfigureForTrack().

◆ setDefaultChordFinder()

void CMSFieldManager::setDefaultChordFinder ( )
private

Definition at line 166 of file CMSFieldManager.cc.

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 }

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

Referenced by ConfigureForTrack(), and SetMonopoleTracking().

◆ SetMonopoleTracking()

void CMSFieldManager::SetMonopoleTracking ( G4bool  flag)

Definition at line 138 of file CMSFieldManager.cc.

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 }

References RemoveAddSevLevel::flag, m_cfVacuum, m_chordFinderMonopole, m_currChordFinder, and setDefaultChordFinder().

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

Member Data Documentation

◆ m_cfVacuum

bool CMSFieldManager::m_cfVacuum
private

◆ m_chordFinder

G4ChordFinder* CMSFieldManager::m_chordFinder
private

Definition at line 55 of file CMSFieldManager.h.

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

◆ m_chordFinderMonopole

G4ChordFinder* CMSFieldManager::m_chordFinderMonopole
private

Definition at line 56 of file CMSFieldManager.h.

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

◆ m_currChordFinder

G4ChordFinder* CMSFieldManager::m_currChordFinder
private

◆ m_dChord

double CMSFieldManager::m_dChord
private

Definition at line 62 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

◆ m_dChordSimple

double CMSFieldManager::m_dChordSimple
private

Definition at line 67 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

◆ m_dIntersection

double CMSFieldManager::m_dIntersection
private

Definition at line 64 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

◆ m_dIntersectionSimple

double CMSFieldManager::m_dIntersectionSimple
private

Definition at line 69 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

◆ m_dOneStep

double CMSFieldManager::m_dOneStep
private

Definition at line 63 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

◆ m_dOneStepSimple

double CMSFieldManager::m_dOneStepSimple
private

Definition at line 68 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

◆ m_energyThreshold

double CMSFieldManager::m_energyThreshold
private

Definition at line 66 of file CMSFieldManager.h.

Referenced by ConfigureForTrack(), and InitialiseForVolume().

◆ m_propagator

G4PropagatorInField* CMSFieldManager::m_propagator
private

◆ m_regions

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

Definition at line 60 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and isInsideVacuum().

◆ m_stepMax

double CMSFieldManager::m_stepMax
private

Definition at line 65 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

◆ m_stepMaxSimple

double CMSFieldManager::m_stepMaxSimple
private

Definition at line 70 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

◆ theField

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

Definition at line 52 of file CMSFieldManager.h.

Referenced by InitialiseForVolume().

CMSFieldManager::m_dOneStepSimple
double m_dOneStepSimple
Definition: CMSFieldManager.h:68
CMSFieldManager::m_dOneStep
double m_dOneStep
Definition: CMSFieldManager.h:63
CMSFieldManager::SetMonopoleTracking
void SetMonopoleTracking(G4bool)
Definition: CMSFieldManager.cc:138
CMSFieldManager::m_chordFinder
G4ChordFinder * m_chordFinder
Definition: CMSFieldManager.h:55
CMSFieldManager::m_dIntersectionSimple
double m_dIntersectionSimple
Definition: CMSFieldManager.h:69
CMSFieldManager::m_stepMax
double m_stepMax
Definition: CMSFieldManager.h:65
CMSFieldManager::m_stepMaxSimple
double m_stepMaxSimple
Definition: CMSFieldManager.h:70
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CMSFieldManager::theField
std::unique_ptr< sim::Field > theField
Definition: CMSFieldManager.h:52
CMSFieldManager::isInsideVacuum
bool isInsideVacuum(const G4Track *)
Definition: CMSFieldManager.cc:154
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
CMSFieldManager::m_currChordFinder
G4ChordFinder * m_currChordFinder
Definition: CMSFieldManager.h:54
CMSFieldManager::m_chordFinderMonopole
G4ChordFinder * m_chordFinderMonopole
Definition: CMSFieldManager.h:56
CMSFieldManager::m_dChord
double m_dChord
Definition: CMSFieldManager.h:62
CMSFieldManager::m_propagator
G4PropagatorInField * m_propagator
Definition: CMSFieldManager.h:58
GeV
const double GeV
Definition: MathUtil.h:16
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
createfilelist.int
int
Definition: createfilelist.py:10
edm::LogVerbatim
Definition: MessageLogger.h:297
CMSFieldManager::setChordFinderForVacuum
void setChordFinderForVacuum()
Definition: CMSFieldManager.cc:176
CMSFieldManager::setDefaultChordFinder
void setDefaultChordFinder()
Definition: CMSFieldManager.cc:166
type
type
Definition: HCALResponse.h:21
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
CMSFieldManager::m_dChordSimple
double m_dChordSimple
Definition: CMSFieldManager.h:67
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
CMSFieldManager::m_regions
std::vector< const G4Region * > m_regions
Definition: CMSFieldManager.h:60
CMSFieldManager::m_energyThreshold
double m_energyThreshold
Definition: CMSFieldManager.h:66
CMSFieldManager::m_dIntersection
double m_dIntersection
Definition: CMSFieldManager.h:64
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
CMSFieldManager::m_cfVacuum
bool m_cfVacuum
Definition: CMSFieldManager.h:72