CMS 3D CMS Logo

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

#include <StackingAction.h>

Inheritance diagram for StackingAction:

Public Member Functions

G4ClassificationOfNewTrack ClassifyNewTrack (const G4Track *aTrack) final
 
void NewStage () override
 
void PrepareNewEvent () override
 
 StackingAction (const TrackingAction *, const edm::ParameterSet &ps, const CMSSteppingVerbose *)
 
 ~StackingAction () override=default
 

Private Member Functions

void initPointer ()
 
int isItFromPrimary (const G4Track &, int) const
 
bool isItOutOfTimeWindow (const G4Region *, const double &) const
 
int isItPrimaryDecayProductOrConversion (const int subtype, const G4Track &) const
 
bool isThisRegion (const G4Region *, std::vector< const G4Region *> &) const
 
void printRegions (const std::vector< const G4Region *> &reg, const std::string &word) const
 
bool rrApplicable (const G4Track *, const G4Track &) const
 

Private Attributes

std::vector< const G4Region * > caloRegions
 
std::vector< std::string > deadRegionNames
 
std::vector< const G4Region * > deadRegions
 
bool gRRactive {false}
 
double gRusRoCastor
 
double gRusRoEcal
 
double gRusRoEnerLim
 
double gRusRoHcal
 
double gRusRoMuonIron
 
double gRusRoPreShower
 
double gRusRoWorld
 
bool killDeltaRay
 
bool killExtra
 
bool killGamma
 
bool killHeavy
 
bool killInCalo {false}
 
bool killInCaloEfH {false}
 
double kmaxGamma
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
double limitEnergyForVacuum
 
std::vector< const G4Region * > lowdensRegions
 
const G4VProcess * m_Compton {nullptr}
 
std::vector< std::string > maxTimeNames
 
std::vector< const G4Region * > maxTimeRegions
 
double maxTrackTime
 
double maxTrackTimeForward
 
std::vector< double > maxTrackTimes
 
double maxZCentralCMS
 
std::vector< const G4Region * > muonRegions
 
bool nRRactive {false}
 
double nRusRoCastor
 
double nRusRoEcal
 
double nRusRoEnerLim
 
double nRusRoHcal
 
double nRusRoMuonIron
 
double nRusRoPreShower
 
double nRusRoWorld
 
unsigned int numberTimes
 
const G4Region * regionCastor {nullptr}
 
const G4Region * regionEcal {nullptr}
 
const G4Region * regionHcal {nullptr}
 
const G4Region * regionMuonIron {nullptr}
 
const G4Region * regionPreShower {nullptr}
 
const G4Region * regionWorld {nullptr}
 
bool saveFirstSecondary
 
bool savePDandCinAll
 
bool savePDandCinCalo
 
bool savePDandCinMuon
 
bool savePDandCinTracker
 
const CMSSteppingVerbosesteppingVerbose
 
const TrackingActiontrackAction
 
std::vector< const G4Region * > trackerRegions
 
bool trackNeutrino
 
G4VSolid * worldSolid
 

Detailed Description

Definition at line 18 of file StackingAction.h.

Constructor & Destructor Documentation

◆ StackingAction()

StackingAction::StackingAction ( const TrackingAction trka,
const edm::ParameterSet ps,
const CMSSteppingVerbose sv 
)
explicit

Definition at line 20 of file StackingAction.cc.

References caloRegions, deadRegionNames, deadRegions, gRRactive, gRusRoCastor, gRusRoEcal, gRusRoEnerLim, gRusRoHcal, gRusRoMuonIron, gRusRoPreShower, gRusRoWorld, mps_fire::i, initPointer(), killDeltaRay, killExtra, killGamma, killHeavy, killInCalo, killInCaloEfH, kmaxGamma, kmaxIon, kmaxNeutron, kmaxProton, limitEnergyForVacuum, lowdensRegions, visualization-live-secondInstance_cfg::m, maxTimeNames, maxTrackTime, maxTrackTimeForward, maxTrackTimes, maxZCentralCMS, muonRegions, nRRactive, nRusRoCastor, nRusRoEcal, nRusRoEnerLim, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, numberTimes, AlCaHLTBitMon_ParallelJobs::p, printRegions(), saveFirstSecondary, savePDandCinAll, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, trackerRegions, trackNeutrino, and worldSolid.

21  : trackAction(trka), steppingVerbose(sv) {
22  trackNeutrino = p.getParameter<bool>("TrackNeutrino");
23  killHeavy = p.getParameter<bool>("KillHeavy");
24  killGamma = p.getParameter<bool>("KillGamma");
25  kmaxGamma = p.getParameter<double>("GammaThreshold") * CLHEP::MeV;
26  kmaxIon = p.getParameter<double>("IonThreshold") * CLHEP::MeV;
27  kmaxProton = p.getParameter<double>("ProtonThreshold") * CLHEP::MeV;
28  kmaxNeutron = p.getParameter<double>("NeutronThreshold") * CLHEP::MeV;
29  killDeltaRay = p.getParameter<bool>("KillDeltaRay");
30  limitEnergyForVacuum = p.getParameter<double>("CriticalEnergyForVacuum") * CLHEP::MeV;
31  maxTrackTime = p.getParameter<double>("MaxTrackTime") * ns;
32  maxTrackTimeForward = p.getParameter<double>("MaxTrackTimeForward") * ns;
33  maxZCentralCMS = p.getParameter<double>("MaxZCentralCMS") * CLHEP::m;
34  maxTrackTimes = p.getParameter<std::vector<double> >("MaxTrackTimes");
35  maxTimeNames = p.getParameter<std::vector<std::string> >("MaxTimeNames");
36  deadRegionNames = p.getParameter<std::vector<std::string> >("DeadRegions");
37  savePDandCinAll = p.getUntrackedParameter<bool>("SaveAllPrimaryDecayProductsAndConversions", true);
38  savePDandCinTracker = p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInTracker", false);
39  savePDandCinCalo = p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInCalo", false);
40  savePDandCinMuon = p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInMuon", false);
41  saveFirstSecondary = p.getUntrackedParameter<bool>("SaveFirstLevelSecondary", false);
42 
43  gRusRoEnerLim = p.getParameter<double>("RusRoGammaEnergyLimit") * CLHEP::MeV;
44  nRusRoEnerLim = p.getParameter<double>("RusRoNeutronEnergyLimit") * CLHEP::MeV;
45 
46  gRusRoEcal = p.getParameter<double>("RusRoEcalGamma");
47  gRusRoHcal = p.getParameter<double>("RusRoHcalGamma");
48  gRusRoMuonIron = p.getParameter<double>("RusRoMuonIronGamma");
49  gRusRoPreShower = p.getParameter<double>("RusRoPreShowerGamma");
50  gRusRoCastor = p.getParameter<double>("RusRoCastorGamma");
51  gRusRoWorld = p.getParameter<double>("RusRoWorldGamma");
52 
53  nRusRoEcal = p.getParameter<double>("RusRoEcalNeutron");
54  nRusRoHcal = p.getParameter<double>("RusRoHcalNeutron");
55  nRusRoMuonIron = p.getParameter<double>("RusRoMuonIronNeutron");
56  nRusRoPreShower = p.getParameter<double>("RusRoPreShowerNeutron");
57  nRusRoCastor = p.getParameter<double>("RusRoCastorNeutron");
58  nRusRoWorld = p.getParameter<double>("RusRoWorldNeutron");
59 
60  if (gRusRoEnerLim > 0.0 && (gRusRoEcal < 1.0 || gRusRoHcal < 1.0 || gRusRoMuonIron < 1.0 || gRusRoPreShower < 1.0 ||
61  gRusRoCastor < 1.0 || gRusRoWorld < 1.0)) {
62  gRRactive = true;
63  }
64  if (nRusRoEnerLim > 0.0 && (nRusRoEcal < 1.0 || nRusRoHcal < 1.0 || nRusRoMuonIron < 1.0 || nRusRoPreShower < 1.0 ||
65  nRusRoCastor < 1.0 || nRusRoWorld < 1.0)) {
66  nRRactive = true;
67  }
68 
69  if (p.exists("TestKillingOptions")) {
70  killInCalo = (p.getParameter<edm::ParameterSet>("TestKillingOptions")).getParameter<bool>("KillInCalo");
71  killInCaloEfH = (p.getParameter<edm::ParameterSet>("TestKillingOptions")).getParameter<bool>("KillInCaloEfH");
72  edm::LogWarning("SimG4CoreApplication")
73  << " *** Activating special test killing options in StackingAction \n"
74  << " *** Kill secondaries in Calorimetetrs volume = " << killInCalo << "\n"
75  << " *** Kill electromagnetic secondaries from hadrons in Calorimeters volume= " << killInCaloEfH;
76  }
77 
78  initPointer();
79 
80  edm::LogVerbatim("SimG4CoreApplication")
81  << "StackingAction initiated with"
82  << " flag for saving decay products in "
83  << " Tracker: " << savePDandCinTracker << " in Calo: " << savePDandCinCalo << " in Muon: " << savePDandCinMuon
84  << " everywhere: " << savePDandCinAll << "\n saveFirstSecondary"
85  << ": " << saveFirstSecondary << " Tracking neutrino flag: " << trackNeutrino
86  << " Kill Delta Ray flag: " << killDeltaRay << " Kill hadrons/ions flag: " << killHeavy
87  << " MaxZCentralCMS = " << maxZCentralCMS / CLHEP::m << " m"
88  << " MaxTrackTimeForward = " << maxTrackTimeForward / CLHEP::ns << " ns";
89 
90  if (killHeavy) {
91  edm::LogVerbatim("SimG4CoreApplication") << "StackingAction kill protons below " << kmaxProton / CLHEP::MeV
92  << " MeV, neutrons below " << kmaxNeutron / CLHEP::MeV << " MeV and ions"
93  << " below " << kmaxIon / CLHEP::MeV << " MeV";
94  }
96 
97  edm::LogVerbatim("SimG4CoreApplication") << "StackingAction kill tracks with "
98  << "time larger than " << maxTrackTime / CLHEP::ns << " ns ";
99  numberTimes = maxTimeNames.size();
100  if (0 < numberTimes) {
101  for (unsigned int i = 0; i < numberTimes; ++i) {
102  edm::LogVerbatim("SimG4CoreApplication")
103  << " MaxTrackTime for " << maxTimeNames[i] << " is " << maxTrackTimes[i] << " ns ";
104  maxTrackTimes[i] *= CLHEP::ns;
105  }
106  }
107  if (limitEnergyForVacuum > 0.0) {
108  edm::LogVerbatim("SimG4CoreApplication")
109  << "StackingAction LowDensity regions - kill if E < " << limitEnergyForVacuum / CLHEP::MeV << " MeV";
110  printRegions(lowdensRegions, "LowDensity");
111  }
112  if (deadRegions.size() > 0.0) {
113  edm::LogVerbatim("SimG4CoreApplication") << "StackingAction Dead regions - kill all secondaries ";
114  printRegions(deadRegions, "Dead");
115  }
116  if (gRRactive) {
117  edm::LogVerbatim("SimG4CoreApplication")
118  << "StackingAction: "
119  << "Russian Roulette for gamma Elimit(MeV)= " << gRusRoEnerLim / CLHEP::MeV << "\n"
120  << " ECAL Prob= " << gRusRoEcal << "\n"
121  << " HCAL Prob= " << gRusRoHcal << "\n"
122  << " MuonIron Prob= " << gRusRoMuonIron << "\n"
123  << " PreShower Prob= " << gRusRoPreShower << "\n"
124  << " CASTOR Prob= " << gRusRoCastor << "\n"
125  << " World Prob= " << gRusRoWorld;
126  }
127  if (nRRactive) {
128  edm::LogVerbatim("SimG4CoreApplication")
129  << "StackingAction: "
130  << "Russian Roulette for neutron Elimit(MeV)= " << nRusRoEnerLim / CLHEP::MeV << "\n"
131  << " ECAL Prob= " << nRusRoEcal << "\n"
132  << " HCAL Prob= " << nRusRoHcal << "\n"
133  << " MuonIron Prob= " << nRusRoMuonIron << "\n"
134  << " PreShower Prob= " << nRusRoPreShower << "\n"
135  << " CASTOR Prob= " << nRusRoCastor << "\n"
136  << " World Prob= " << nRusRoWorld;
137  }
138 
139  if (savePDandCinTracker) {
140  edm::LogVerbatim("SimG4CoreApplication") << "StackingAction Tracker regions: ";
141  printRegions(trackerRegions, "Tracker");
142  }
143  if (savePDandCinCalo) {
144  edm::LogVerbatim("SimG4CoreApplication") << "StackingAction Calo regions: ";
145  printRegions(caloRegions, "Calo");
146  }
147  if (savePDandCinMuon) {
148  edm::LogVerbatim("SimG4CoreApplication") << "StackingAction Muon regions: ";
149  printRegions(muonRegions, "Muon");
150  }
151  worldSolid = G4TransportationManager::GetTransportationManager()
152  ->GetNavigatorForTracking()
153  ->GetWorldVolume()
154  ->GetLogicalVolume()
155  ->GetSolid();
156 }
double nRusRoPreShower
Log< level::Info, true > LogVerbatim
std::vector< const G4Region * > lowdensRegions
double maxZCentralCMS
std::vector< double > maxTrackTimes
double gRusRoPreShower
double nRusRoEnerLim
std::vector< const G4Region * > deadRegions
const CMSSteppingVerbose * steppingVerbose
std::vector< const G4Region * > muonRegions
std::vector< std::string > maxTimeNames
unsigned int numberTimes
void printRegions(const std::vector< const G4Region *> &reg, const std::string &word) const
double nRusRoMuonIron
G4VSolid * worldSolid
bool savePDandCinTracker
std::vector< std::string > deadRegionNames
double gRusRoEnerLim
double maxTrackTimeForward
const TrackingAction * trackAction
Log< level::Warning, false > LogWarning
double gRusRoMuonIron
std::vector< const G4Region * > trackerRegions
std::vector< const G4Region * > caloRegions
double limitEnergyForVacuum

◆ ~StackingAction()

StackingAction::~StackingAction ( )
overridedefault

Member Function Documentation

◆ ClassifyNewTrack()

G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack ( const G4Track *  aTrack)
final

Definition at line 158 of file StackingAction.cc.

References funct::abs(), caloRegions, deadRegions, RemoveAddSevLevel::flag, TrackingAction::geant4Track(), gRRactive, gRusRoCastor, gRusRoEcal, gRusRoEnerLim, gRusRoHcal, gRusRoMuonIron, gRusRoPreShower, gRusRoWorld, isItFromPrimary(), isItOutOfTimeWindow(), isItPrimaryDecayProductOrConversion(), isThisRegion(), killDeltaRay, killExtra, killGamma, killHeavy, killInCalo, killInCaloEfH, kmaxGamma, kmaxIon, kmaxNeutron, kmaxProton, limitEnergyForVacuum, LogDebug, lowdensRegions, maxTrackTimeForward, maxZCentralCMS, muonRegions, nRRactive, nRusRoCastor, nRusRoEcal, nRusRoEnerLim, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, MCTruthUtil::primary(), TtFullHadEvtBuilder_cfi::prob, regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, rrApplicable(), saveFirstSecondary, savePDandCinAll, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, MCTruthUtil::secondary(), CMSSteppingVerbose::stackFilled(), steppingVerbose, hcalRecHitTable_cff::time, HLT_2023v12_cff::track, trackAction, trackerRegions, trackNeutrino, and worldSolid.

Referenced by CMSSimEventManager::StackTracks().

158  {
159  // G4 interface part
160  G4ClassificationOfNewTrack classification = fUrgent;
161  const int pdg = aTrack->GetDefinition()->GetPDGEncoding();
162  const int abspdg = std::abs(pdg);
163  auto track = const_cast<G4Track*>(aTrack);
164  const G4VProcess* creatorProc = aTrack->GetCreatorProcess();
165 
166  if (creatorProc == nullptr && aTrack->GetParentID() != 0) {
167  edm::LogWarning("StackingAction::ClassifyNewTrack")
168  << " TrackID=" << aTrack->GetTrackID() << " ParentID=" << aTrack->GetParentID() << " "
169  << aTrack->GetDefinition()->GetParticleName() << " Ekin(MeV)=" << aTrack->GetKineticEnergy();
170  }
171  if (aTrack->GetKineticEnergy() < 0.0) {
172  edm::LogWarning("StackingAction::ClassifyNewTrack")
173  << " TrackID=" << aTrack->GetTrackID() << " ParentID=" << aTrack->GetParentID() << " "
174  << aTrack->GetDefinition()->GetParticleName() << " Ekin(MeV)=" << aTrack->GetKineticEnergy() << " creator "
175  << creatorProc->GetProcessName();
176  }
177  // primary
178  if (creatorProc == nullptr || aTrack->GetParentID() == 0) {
179  if (!trackNeutrino && (abspdg == 12 || abspdg == 14 || abspdg == 16 || abspdg == 18)) {
180  classification = fKill;
181  } else if (worldSolid->Inside(aTrack->GetPosition()) == kOutside) {
182  classification = fKill;
183  } else {
185  }
186  } else {
187  // secondary
188  const G4Region* reg = aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
189  const double time = aTrack->GetGlobalTime();
190 
191  // definetly killed tracks
192  if (aTrack->GetTrackStatus() == fStopAndKill) {
193  classification = fKill;
194  } else if (!trackNeutrino && (abspdg == 12 || abspdg == 14 || abspdg == 16 || abspdg == 18)) {
195  classification = fKill;
196 
197  } else if (std::abs(aTrack->GetPosition().z()) >= maxZCentralCMS) {
198  // very forward secondary
199  if (time > maxTrackTimeForward) {
200  classification = fKill;
201  } else {
202  const G4Track* mother = trackAction->geant4Track();
203  MCTruthUtil::secondary(track, *mother, 0);
204  }
205 
206  } else if (isItOutOfTimeWindow(reg, time)) {
207  // time window check
208  classification = fKill;
209 
210  } else {
211  // potentially good for tracking
212  const double ke = aTrack->GetKineticEnergy();
213  G4int subType = (nullptr != creatorProc) ? creatorProc->GetProcessSubType() : 0;
214 
215  LogDebug("SimG4CoreApplication") << "##StackingAction:Classify Track " << aTrack->GetTrackID() << " Parent "
216  << aTrack->GetParentID() << " " << aTrack->GetDefinition()->GetParticleName()
217  << " Ekin(MeV)=" << ke / CLHEP::MeV << " subType=" << subType << " ";
218 
219  // kill tracks in specific regions
220  if (isThisRegion(reg, deadRegions)) {
221  classification = fKill;
222  }
223  if (classification != fKill && ke <= limitEnergyForVacuum && isThisRegion(reg, lowdensRegions)) {
224  classification = fKill;
225 
226  } else if (classification != fKill) {
227  // very low-energy gamma
228  if (pdg == 22 && killGamma && ke < kmaxGamma) {
229  classification = fKill;
230  }
231 
232  // specific track killing - not for production
233  if (killExtra && classification != fKill) {
234  if (killHeavy && classification != fKill) {
235  if (((pdg / 1000000000 == 1) && (((pdg / 10000) % 100) > 0) && (((pdg / 10) % 100) > 0) &&
236  (ke < kmaxIon)) ||
237  ((pdg == 2212) && (ke < kmaxProton)) || ((pdg == 2112) && (ke < kmaxNeutron))) {
238  classification = fKill;
239  }
240  }
241 
242  if (killDeltaRay && classification != fKill && subType == fIonisation) {
243  classification = fKill;
244  }
245  if (killInCalo && classification != fKill && isThisRegion(reg, caloRegions)) {
246  classification = fKill;
247  }
248  if (killInCaloEfH && classification != fKill) {
249  int pdgMother = std::abs(trackAction->geant4Track()->GetDefinition()->GetPDGEncoding());
250  if ((pdg == 22 || abspdg == 11) && pdgMother != 11 && pdgMother != 22 && isThisRegion(reg, caloRegions)) {
251  classification = fKill;
252  }
253  }
254  }
255 
256  // Russian roulette && MC truth
257  if (classification != fKill) {
258  const G4Track* mother = trackAction->geant4Track();
259  int flag = 0;
260  if (savePDandCinAll) {
261  flag = isItPrimaryDecayProductOrConversion(subType, *mother);
262  } else {
266  flag = isItPrimaryDecayProductOrConversion(subType, *mother);
267  }
268  }
269  if (saveFirstSecondary && 0 == flag) {
270  flag = isItFromPrimary(*mother, flag);
271  }
272 
273  // Russian roulette
274  if (2112 == pdg || 22 == pdg) {
275  double currentWeight = aTrack->GetWeight();
276 
277  if (1.0 >= currentWeight) {
278  double prob = 1.0;
279  double elim = 0.0;
280 
281  // neutron
282  if (nRRactive && pdg == 2112) {
283  elim = nRusRoEnerLim;
284  if (reg == regionEcal) {
285  prob = nRusRoEcal;
286  } else if (reg == regionHcal) {
287  prob = nRusRoHcal;
288  } else if (reg == regionMuonIron) {
290  } else if (reg == regionPreShower) {
292  } else if (reg == regionCastor) {
293  prob = nRusRoCastor;
294  } else if (reg == regionWorld) {
295  prob = nRusRoWorld;
296  }
297 
298  // gamma
299  } else if (gRRactive && pdg == 22) {
300  elim = gRusRoEnerLim;
301  if (reg == regionEcal || reg == regionPreShower) {
302  if (rrApplicable(aTrack, *mother)) {
303  if (reg == regionEcal) {
304  prob = gRusRoEcal;
305  } else {
307  }
308  }
309  } else {
310  if (reg == regionHcal) {
311  prob = gRusRoHcal;
312  } else if (reg == regionMuonIron) {
314  } else if (reg == regionCastor) {
315  prob = gRusRoCastor;
316  } else if (reg == regionWorld) {
317  prob = gRusRoWorld;
318  }
319  }
320  }
321  if (prob < 1.0 && aTrack->GetKineticEnergy() < elim) {
322  if (G4UniformRand() < prob) {
323  track->SetWeight(currentWeight / prob);
324  } else {
325  classification = fKill;
326  }
327  }
328  }
329  }
330  if (classification != fKill) {
331  MCTruthUtil::secondary(track, *mother, flag);
332  }
333  LogDebug("SimG4CoreApplication")
334  << "StackingAction:Classify Track " << aTrack->GetTrackID() << " Parent " << aTrack->GetParentID()
335  << " Type " << aTrack->GetDefinition()->GetParticleName() << " Ekin=" << ke / CLHEP::MeV
336  << " MeV from process subType=" << subType << " as " << classification << " Flag: " << flag;
337  }
338  }
339  }
340  }
341  if (nullptr != steppingVerbose) {
342  steppingVerbose->stackFilled(aTrack, (classification == fKill));
343  }
344  return classification;
345 }
double nRusRoPreShower
std::vector< const G4Region * > lowdensRegions
double maxZCentralCMS
bool rrApplicable(const G4Track *, const G4Track &) const
static void secondary(G4Track *aSecondary, const G4Track &mother, int)
Definition: MCTruthUtil.cc:18
double gRusRoPreShower
double nRusRoEnerLim
const G4Region * regionCastor
const G4Region * regionMuonIron
const G4Track * geant4Track() const
int isItFromPrimary(const G4Track &, int) const
std::vector< const G4Region * > deadRegions
const CMSSteppingVerbose * steppingVerbose
std::vector< const G4Region * > muonRegions
const G4Region * regionEcal
double nRusRoMuonIron
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
G4VSolid * worldSolid
bool isItOutOfTimeWindow(const G4Region *, const double &) const
void stackFilled(const G4Track *, bool isKilled) const
bool isThisRegion(const G4Region *, std::vector< const G4Region *> &) const
bool savePDandCinTracker
static void primary(G4Track *aPrimary)
Definition: MCTruthUtil.cc:8
double gRusRoEnerLim
const G4Region * regionHcal
double maxTrackTimeForward
const G4Region * regionPreShower
const TrackingAction * trackAction
Log< level::Warning, false > LogWarning
double gRusRoMuonIron
std::vector< const G4Region * > trackerRegions
int isItPrimaryDecayProductOrConversion(const int subtype, const G4Track &) const
#define LogDebug(id)
std::vector< const G4Region * > caloRegions
double limitEnergyForVacuum
const G4Region * regionWorld

◆ initPointer()

void StackingAction::initPointer ( )
private

Definition at line 351 of file StackingAction.cc.

References caloRegions, deadRegionNames, deadRegions, gRusRoCastor, gRusRoEcal, gRusRoHcal, gRusRoMuonIron, gRusRoPreShower, gRusRoWorld, mps_fire::i, lowdensRegions, maxTimeNames, maxTimeRegions, muonRegions, nRusRoCastor, nRusRoEcal, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, EgammaValidation_cff::num, regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, rname, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, and trackerRegions.

Referenced by StackingAction().

351  {
352  // prepare region vector
353  const unsigned int num = maxTimeNames.size();
354  maxTimeRegions.resize(num, nullptr);
355 
356  // Russian roulette
357  const std::vector<G4Region*>* rs = G4RegionStore::GetInstance();
358 
359  for (auto& reg : *rs) {
360  const G4String& rname = reg->GetName();
361  if ((gRusRoEcal < 1.0 || nRusRoEcal < 1.0) && rname == "EcalRegion") {
362  regionEcal = reg;
363  }
364  if ((gRusRoHcal < 1.0 || nRusRoHcal < 1.0) && rname == "HcalRegion") {
365  regionHcal = reg;
366  }
367  if ((gRusRoMuonIron < 1.0 || nRusRoMuonIron < 1.0) && rname == "MuonIron") {
368  regionMuonIron = reg;
369  }
370  if ((gRusRoPreShower < 1.0 || nRusRoPreShower < 1.0) && rname == "PreshowerRegion") {
371  regionPreShower = reg;
372  }
373  if ((gRusRoCastor < 1.0 || nRusRoCastor < 1.0) && rname == "CastorRegion") {
374  regionCastor = reg;
375  }
376  if ((gRusRoWorld < 1.0 || nRusRoWorld < 1.0) && rname == "DefaultRegionForTheWorld") {
377  regionWorld = reg;
378  }
379 
380  // time limits
381  for (unsigned int i = 0; i < num; ++i) {
382  if (rname == (G4String)(maxTimeNames[i])) {
383  maxTimeRegions[i] = reg;
384  break;
385  }
386  }
387  //
388  if (savePDandCinTracker &&
389  (rname == "BeamPipe" || rname == "BeamPipeVacuum" || rname == "TrackerPixelSensRegion" ||
390  rname == "TrackerPixelDeadRegion" || rname == "TrackerDeadRegion" || rname == "TrackerSensRegion" ||
391  rname == "FastTimerRegionBTL" || rname == "FastTimerRegionETL" || rname == "FastTimerRegionSensBTL" ||
392  rname == "FastTimerRegionSensETL")) {
393  trackerRegions.push_back(reg);
394  }
395  if (savePDandCinCalo && (rname == "HcalRegion" || rname == "EcalRegion" || rname == "PreshowerSensRegion" ||
396  rname == "PreshowerRegion" || rname == "APDRegion" || rname == "HGCalRegion")) {
397  caloRegions.push_back(reg);
398  }
399  if (savePDandCinMuon && (rname == "MuonChamber" || rname == "MuonSensitive_RPC" || rname == "MuonIron" ||
400  rname == "Muon" || rname == "MuonSensitive_DT-CSC")) {
401  muonRegions.push_back(reg);
402  }
403  if (rname == "BeamPipeOutside" || rname == "BeamPipeVacuum") {
404  lowdensRegions.push_back(reg);
405  }
406  for (auto& dead : deadRegionNames) {
407  if (rname == (G4String)(dead)) {
408  deadRegions.push_back(reg);
409  }
410  }
411  }
412 }
double nRusRoPreShower
std::vector< const G4Region * > lowdensRegions
double gRusRoPreShower
const G4Region * regionCastor
const G4Region * regionMuonIron
std::vector< const G4Region * > deadRegions
std::vector< const G4Region * > muonRegions
std::vector< std::string > maxTimeNames
const G4Region * regionEcal
double nRusRoMuonIron
bool savePDandCinTracker
std::vector< std::string > deadRegionNames
const G4Region * regionHcal
std::vector< const G4Region * > maxTimeRegions
const G4String rname[NREG]
const G4Region * regionPreShower
double gRusRoMuonIron
std::vector< const G4Region * > trackerRegions
std::vector< const G4Region * > caloRegions
const G4Region * regionWorld

◆ isItFromPrimary()

int StackingAction::isItFromPrimary ( const G4Track &  mother,
int  flagIn 
) const
private

Definition at line 447 of file StackingAction.cc.

References RemoveAddSevLevel::flag.

Referenced by ClassifyNewTrack().

447  {
448  int flag = flagIn;
449  if (flag != 1) {
450  auto ptr = static_cast<const TrackInformation*>(mother.GetUserInformation());
451  if (ptr->isPrimary()) {
452  flag = 3;
453  }
454  }
455  return flag;
456 }

◆ isItOutOfTimeWindow()

bool StackingAction::isItOutOfTimeWindow ( const G4Region *  reg,
const double &  t 
) const
private

Definition at line 458 of file StackingAction.cc.

References mps_fire::i, maxTimeRegions, maxTrackTime, maxTrackTimes, numberTimes, and submitPVValidationJobs::t.

Referenced by ClassifyNewTrack().

458  {
459  double tofM = maxTrackTime;
460  for (unsigned int i = 0; i < numberTimes; ++i) {
461  if (reg == maxTimeRegions[i]) {
462  tofM = maxTrackTimes[i];
463  break;
464  }
465  }
466  return (t > tofM);
467 }
std::vector< double > maxTrackTimes
unsigned int numberTimes
std::vector< const G4Region * > maxTimeRegions

◆ isItPrimaryDecayProductOrConversion()

int StackingAction::isItPrimaryDecayProductOrConversion ( const int  subtype,
const G4Track &  mother 
) const
private

Definition at line 425 of file StackingAction.cc.

References hydjet2DefaultParameters_cff::fDecay, and RemoveAddSevLevel::flag.

Referenced by ClassifyNewTrack().

425  {
426  int flag = 0;
427  auto motherInfo = static_cast<const TrackInformation*>(mother.GetUserInformation());
428  // Check whether mother is a primary
429  if (motherInfo->isPrimary()) {
430  if (stype == fDecay) {
431  flag = 1;
432  } else if (stype == fGammaConversion) {
433  flag = 2;
434  }
435  }
436  return flag;
437 }

◆ isThisRegion()

bool StackingAction::isThisRegion ( const G4Region *  reg,
std::vector< const G4Region *> &  regions 
) const
private

Definition at line 414 of file StackingAction.cc.

References RemoveAddSevLevel::flag, and nano_mu_digi_cff::region.

Referenced by ClassifyNewTrack().

414  {
415  bool flag = false;
416  for (auto& region : regions) {
417  if (reg == region) {
418  flag = true;
419  break;
420  }
421  }
422  return flag;
423 }

◆ NewStage()

void StackingAction::NewStage ( )
override

Definition at line 347 of file StackingAction.cc.

347 {}

◆ PrepareNewEvent()

void StackingAction::PrepareNewEvent ( )
override

Definition at line 349 of file StackingAction.cc.

349 {}

◆ printRegions()

void StackingAction::printRegions ( const std::vector< const G4Region *> &  reg,
const std::string &  word 
) const
private

Definition at line 469 of file StackingAction.cc.

References mps_fire::i.

Referenced by StackingAction().

469  {
470  for (unsigned int i = 0; i < reg.size(); ++i) {
471  edm::LogVerbatim("SimG4CoreApplication")
472  << " StackingAction: " << word << "Region " << i << ". " << reg[i]->GetName();
473  }
474 }
Log< level::Info, true > LogVerbatim
uint64_t word

◆ rrApplicable()

bool StackingAction::rrApplicable ( const G4Track *  aTrack,
const G4Track &  mother 
) const
private

Definition at line 439 of file StackingAction.cc.

References funct::abs(), and TrackInformation::genParticlePID().

Referenced by ClassifyNewTrack().

439  {
440  auto motherInfo = static_cast<const TrackInformation*>(mother.GetUserInformation());
441 
442  // Check whether mother is gamma, e+, e-
443  const int genID = motherInfo->genParticlePID();
444  return (22 != genID && 11 != std::abs(genID));
445 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int genParticlePID() const

Member Data Documentation

◆ caloRegions

std::vector<const G4Region*> StackingAction::caloRegions
private

Definition at line 67 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ deadRegionNames

std::vector<std::string> StackingAction::deadRegionNames
private

Definition at line 62 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

◆ deadRegions

std::vector<const G4Region*> StackingAction::deadRegions
private

Definition at line 69 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ gRRactive

bool StackingAction::gRRactive {false}
private

Definition at line 102 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ gRusRoCastor

double StackingAction::gRusRoCastor
private

Definition at line 97 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ gRusRoEcal

double StackingAction::gRusRoEcal
private

Definition at line 89 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ gRusRoEnerLim

double StackingAction::gRusRoEnerLim
private

Definition at line 85 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ gRusRoHcal

double StackingAction::gRusRoHcal
private

Definition at line 91 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ gRusRoMuonIron

double StackingAction::gRusRoMuonIron
private

Definition at line 93 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ gRusRoPreShower

double StackingAction::gRusRoPreShower
private

Definition at line 95 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ gRusRoWorld

double StackingAction::gRusRoWorld
private

Definition at line 99 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ killDeltaRay

bool StackingAction::killDeltaRay
private

Definition at line 50 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ killExtra

bool StackingAction::killExtra
private

Definition at line 51 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ killGamma

bool StackingAction::killGamma
private

Definition at line 52 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ killHeavy

bool StackingAction::killHeavy
private

Definition at line 50 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ killInCalo

bool StackingAction::killInCalo {false}
private

Definition at line 48 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ killInCaloEfH

bool StackingAction::killInCaloEfH {false}
private

Definition at line 49 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ kmaxGamma

double StackingAction::kmaxGamma
private

Definition at line 55 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ kmaxIon

double StackingAction::kmaxIon
private

Definition at line 54 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ kmaxNeutron

double StackingAction::kmaxNeutron
private

Definition at line 54 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ kmaxProton

double StackingAction::kmaxProton
private

Definition at line 54 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ limitEnergyForVacuum

double StackingAction::limitEnergyForVacuum
private

Definition at line 53 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ lowdensRegions

std::vector<const G4Region*> StackingAction::lowdensRegions
private

Definition at line 68 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ m_Compton

const G4VProcess* StackingAction::m_Compton {nullptr}
private

Definition at line 74 of file StackingAction.h.

◆ maxTimeNames

std::vector<std::string> StackingAction::maxTimeNames
private

Definition at line 61 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

◆ maxTimeRegions

std::vector<const G4Region*> StackingAction::maxTimeRegions
private

Definition at line 64 of file StackingAction.h.

Referenced by initPointer(), and isItOutOfTimeWindow().

◆ maxTrackTime

double StackingAction::maxTrackTime
private

Definition at line 56 of file StackingAction.h.

Referenced by isItOutOfTimeWindow(), and StackingAction().

◆ maxTrackTimeForward

double StackingAction::maxTrackTimeForward
private

Definition at line 57 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ maxTrackTimes

std::vector<double> StackingAction::maxTrackTimes
private

Definition at line 60 of file StackingAction.h.

Referenced by isItOutOfTimeWindow(), and StackingAction().

◆ maxZCentralCMS

double StackingAction::maxZCentralCMS
private

Definition at line 58 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ muonRegions

std::vector<const G4Region*> StackingAction::muonRegions
private

Definition at line 66 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ nRRactive

bool StackingAction::nRRactive {false}
private

Definition at line 103 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ nRusRoCastor

double StackingAction::nRusRoCastor
private

Definition at line 98 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ nRusRoEcal

double StackingAction::nRusRoEcal
private

Definition at line 90 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ nRusRoEnerLim

double StackingAction::nRusRoEnerLim
private

Definition at line 86 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ nRusRoHcal

double StackingAction::nRusRoHcal
private

Definition at line 92 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ nRusRoMuonIron

double StackingAction::nRusRoMuonIron
private

Definition at line 94 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ nRusRoPreShower

double StackingAction::nRusRoPreShower
private

Definition at line 96 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ nRusRoWorld

double StackingAction::nRusRoWorld
private

Definition at line 100 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ numberTimes

unsigned int StackingAction::numberTimes
private

Definition at line 59 of file StackingAction.h.

Referenced by isItOutOfTimeWindow(), and StackingAction().

◆ regionCastor

const G4Region* StackingAction::regionCastor {nullptr}
private

Definition at line 81 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and initPointer().

◆ regionEcal

const G4Region* StackingAction::regionEcal {nullptr}
private

Definition at line 77 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and initPointer().

◆ regionHcal

const G4Region* StackingAction::regionHcal {nullptr}
private

Definition at line 78 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and initPointer().

◆ regionMuonIron

const G4Region* StackingAction::regionMuonIron {nullptr}
private

Definition at line 79 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and initPointer().

◆ regionPreShower

const G4Region* StackingAction::regionPreShower {nullptr}
private

Definition at line 80 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and initPointer().

◆ regionWorld

const G4Region* StackingAction::regionWorld {nullptr}
private

Definition at line 82 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and initPointer().

◆ saveFirstSecondary

bool StackingAction::saveFirstSecondary
private

Definition at line 46 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ savePDandCinAll

bool StackingAction::savePDandCinAll
private

Definition at line 47 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ savePDandCinCalo

bool StackingAction::savePDandCinCalo
private

Definition at line 45 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ savePDandCinMuon

bool StackingAction::savePDandCinMuon
private

Definition at line 46 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ savePDandCinTracker

bool StackingAction::savePDandCinTracker
private

Definition at line 45 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ steppingVerbose

const CMSSteppingVerbose* StackingAction::steppingVerbose
private

Definition at line 73 of file StackingAction.h.

Referenced by ClassifyNewTrack().

◆ trackAction

const TrackingAction* StackingAction::trackAction
private

Definition at line 72 of file StackingAction.h.

Referenced by ClassifyNewTrack().

◆ trackerRegions

std::vector<const G4Region*> StackingAction::trackerRegions
private

Definition at line 65 of file StackingAction.h.

Referenced by ClassifyNewTrack(), initPointer(), and StackingAction().

◆ trackNeutrino

bool StackingAction::trackNeutrino
private

Definition at line 50 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ worldSolid

G4VSolid* StackingAction::worldSolid
private

Definition at line 71 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().