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 22 of file CMSFieldManager.h.

Constructor & Destructor Documentation

CMSFieldManager::CMSFieldManager ( )
explicit

Definition at line 13 of file CMSFieldManager.cc.

14  : G4FieldManager(), m_currChordFinder(nullptr), m_chordFinder(nullptr),
15  m_chordFinderMonopole(nullptr), m_propagator(nullptr), m_dChord(0.001),
16  m_dOneStep(0.001), m_dIntersection(0.0001), m_stepMax(1000000.),
19 {}
G4ChordFinder * m_chordFinder
double m_dIntersectionSimple
double m_energyThreshold
G4PropagatorInField * m_propagator
G4ChordFinder * m_currChordFinder
G4ChordFinder * m_chordFinderMonopole
CMSFieldManager::~CMSFieldManager ( )
override

Definition at line 21 of file CMSFieldManager.cc.

References m_chordFinder, m_chordFinderMonopole, and m_currChordFinder.

22 {
25 }
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 114 of file CMSFieldManager.cc.

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

Referenced by MonopoleTransportation::AlongStepGetPhysicalInteractionLength().

115 {
116  // run time parameters per track
117  if((track->GetKineticEnergy() <= m_energyThreshold && track->GetParentID() > 0)
118  || isInsideVacuum(track)) {
120 
121  } else if(m_cfVacuum) {
122  // restore defaults
124  }
125 }
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 27 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().

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

Definition at line 142 of file CMSFieldManager.cc.

References m_regions.

Referenced by ConfigureForTrack().

143 {
144  if(!m_regions.empty()) {
145  const G4Region* reg = track->GetVolume()->GetLogicalVolume()->GetRegion();
146  for (auto & areg : m_regions) {
147  if(reg == areg) { return true; }
148  }
149  }
150  return false;
151 }
std::vector< const G4Region * > m_regions
CMSFieldManager& CMSFieldManager::operator= ( const CMSFieldManager )
privatedelete
void CMSFieldManager::setChordFinderForVacuum ( )
private

Definition at line 164 of file CMSFieldManager.cc.

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

Referenced by ConfigureForTrack().

165 {
166  m_currChordFinder->SetDeltaChord(m_dChordSimple);
167  SetDeltaOneStep(m_dOneStepSimple);
168  SetDeltaIntersection(m_dIntersectionSimple);
169  m_propagator->SetLargestAcceptableStep(m_stepMaxSimple);
170  m_cfVacuum = true;
171 }
double m_dIntersectionSimple
G4PropagatorInField * m_propagator
G4ChordFinder * m_currChordFinder
void CMSFieldManager::setDefaultChordFinder ( )
private

Definition at line 153 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().

154 {
156  m_currChordFinder->SetDeltaChord(m_dChord);
157  SetChordFinder(m_currChordFinder);
158  SetDeltaOneStep(m_dOneStep);
159  SetDeltaIntersection(m_dIntersection);
160  m_propagator->SetLargestAcceptableStep(m_stepMax);
161  m_cfVacuum = false;
162 }
G4ChordFinder * m_chordFinder
G4PropagatorInField * m_propagator
G4ChordFinder * m_currChordFinder
void CMSFieldManager::SetMonopoleTracking ( G4bool  flag)

Definition at line 127 of file CMSFieldManager.cc.

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

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

128 {
129  if(flag) {
133  SetChordFinder(m_currChordFinder);
134  }
135  } else {
137  }
138  SetFieldChangesEnergy(flag);
139  m_currChordFinder->ResetStepEstimate();
140 }
void setDefaultChordFinder()
G4ChordFinder * m_currChordFinder
G4ChordFinder * m_chordFinderMonopole

Member Data Documentation

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

Definition at line 52 of file CMSFieldManager.h.

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

G4ChordFinder* CMSFieldManager::m_chordFinderMonopole
private

Definition at line 53 of file CMSFieldManager.h.

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

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

Definition at line 59 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

double CMSFieldManager::m_dChordSimple
private

Definition at line 64 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

double CMSFieldManager::m_dIntersection
private

Definition at line 61 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

double CMSFieldManager::m_dIntersectionSimple
private

Definition at line 66 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

double CMSFieldManager::m_dOneStep
private

Definition at line 60 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

double CMSFieldManager::m_dOneStepSimple
private

Definition at line 65 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

double CMSFieldManager::m_energyThreshold
private

Definition at line 63 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 57 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and isInsideVacuum().

double CMSFieldManager::m_stepMax
private

Definition at line 62 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setDefaultChordFinder().

double CMSFieldManager::m_stepMaxSimple
private

Definition at line 67 of file CMSFieldManager.h.

Referenced by InitialiseForVolume(), and setChordFinderForVacuum().

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

Definition at line 49 of file CMSFieldManager.h.

Referenced by InitialiseForVolume().