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
 

Private Member Functions

void initPointer ()
 
int isItFromPrimary (const G4Track &, int) const
 
bool isItOutOfTimeWindow (const G4Region *, const G4Track *) const
 
int isItPrimaryDecayProductOrConversion (const G4Track *, 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
 
TrackInformationExtractor extractor
 
bool gRRactive
 
double gRusRoCastor
 
double gRusRoEcal
 
double gRusRoEnerLim
 
double gRusRoHcal
 
double gRusRoMuonIron
 
double gRusRoPreShower
 
double gRusRoWorld
 
bool killDeltaRay
 
bool killExtra
 
bool killGamma
 
bool killHeavy
 
bool killInCalo
 
bool killInCaloEfH
 
double kmaxGamma
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
double limitEnergyForVacuum
 
std::vector< const G4Region * > lowdensRegions
 
std::vector< std::string > maxTimeNames
 
std::vector< const G4Region * > maxTimeRegions
 
double maxTrackTime
 
std::vector< double > maxTrackTimes
 
std::vector< const G4Region * > muonRegions
 
NewTrackActionnewTA
 
bool nRRactive
 
double nRusRoCastor
 
double nRusRoEcal
 
double nRusRoEnerLim
 
double nRusRoHcal
 
double nRusRoMuonIron
 
double nRusRoPreShower
 
double nRusRoWorld
 
unsigned int numberTimes
 
const G4Region * regionCastor
 
const G4Region * regionEcal
 
const G4Region * regionHcal
 
const G4Region * regionMuonIron
 
const G4Region * regionPreShower
 
const G4Region * regionWorld
 
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 19 of file StackingAction.h.

Constructor & Destructor Documentation

◆ StackingAction()

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

Definition at line 18 of file StackingAction.cc.

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

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, maxTimeNames, maxTrackTime, maxTrackTimes, MeV, muonRegions, newTA, nRRactive, nRusRoCastor, nRusRoEcal, nRusRoEnerLim, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, numberTimes, AlCaHLTBitMon_ParallelJobs::p, printRegions(), regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, saveFirstSecondary, savePDandCinAll, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, trackerRegions, trackNeutrino, and worldSolid.

◆ ~StackingAction()

StackingAction::~StackingAction ( )
override

Definition at line 165 of file StackingAction.cc.

165 { delete newTA; }

References newTA.

Member Function Documentation

◆ ClassifyNewTrack()

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

Definition at line 167 of file StackingAction.cc.

167  {
168  // G4 interface part
169  G4ClassificationOfNewTrack classification = fUrgent;
170  int pdg = aTrack->GetDefinition()->GetPDGEncoding();
171  int abspdg = std::abs(pdg);
172 
173  // primary
174  if (aTrack->GetCreatorProcess() == nullptr || aTrack->GetParentID() == 0) {
175  if (!trackNeutrino && (abspdg == 12 || abspdg == 14 || abspdg == 16 || abspdg == 18)) {
176  classification = fKill;
177  } else if (worldSolid->Inside(aTrack->GetPosition()) == kOutside) {
178  classification = fKill;
179  } else {
180  newTA->primary(aTrack);
181  }
182  } else {
183  // secondary
184  const G4Region* reg = aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
185  // definetly killed tracks
186  if (aTrack->GetTrackStatus() == fStopAndKill) {
187  classification = fKill;
188  } else if (!trackNeutrino && (abspdg == 12 || abspdg == 14 || abspdg == 16 || abspdg == 18)) {
189  classification = fKill;
190  } else if (isItOutOfTimeWindow(reg, aTrack)) {
191  classification = fKill;
192  }
193 
194  // potentially good for tracking
195  else {
196  double ke = aTrack->GetKineticEnergy();
197 
198  // kill tracks in specific regions
199  if (classification != fKill && isThisRegion(reg, deadRegions)) {
200  classification = fKill;
201  }
203  classification = fKill;
204 
205  } else {
206  // very low-energy gamma
207  if (pdg == 22 && killGamma && ke < kmaxGamma) {
208  classification = fKill;
209  }
210 
211  // specific track killing - not for production
212  if (killExtra && classification != fKill) {
213  if (killHeavy && classification != fKill) {
214  if (((pdg / 1000000000 == 1) && (((pdg / 10000) % 100) > 0) && (((pdg / 10) % 100) > 0) &&
215  (ke < kmaxIon)) ||
216  ((pdg == 2212) && (ke < kmaxProton)) || ((pdg == 2112) && (ke < kmaxNeutron))) {
217  classification = fKill;
218  }
219  }
220 
221  if (killDeltaRay && classification != fKill &&
222  aTrack->GetCreatorProcess()->GetProcessSubType() == fIonisation) {
223  classification = fKill;
224  }
225  if (killInCalo && classification != fKill && isThisRegion(reg, caloRegions)) {
226  classification = fKill;
227  }
228  if (killInCaloEfH && classification != fKill) {
229  int pdgMother = std::abs(trackAction->geant4Track()->GetDefinition()->GetPDGEncoding());
230  if ((pdg == 22 || abspdg == 11) && pdgMother != 11 && pdgMother != 22 && isThisRegion(reg, caloRegions)) {
231  classification = fKill;
232  }
233  }
234  }
235 
236  // Russian roulette && MC truth
237  if (classification != fKill) {
238  const G4Track* mother = trackAction->geant4Track();
239  int flag = 0;
240  if (savePDandCinAll) {
241  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
242  } else {
246  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
247  }
248  }
249  if (saveFirstSecondary && 0 == flag) {
250  flag = isItFromPrimary(*mother, flag);
251  }
252 
253  // Russian roulette
254  if (2112 == pdg || 22 == pdg) {
255  double currentWeight = aTrack->GetWeight();
256 
257  if (1.0 >= currentWeight) {
258  double prob = 1.0;
259  double elim = 0.0;
260 
261  // neutron
262  if (nRRactive && pdg == 2112) {
263  elim = nRusRoEnerLim;
264  if (reg == regionEcal) {
265  prob = nRusRoEcal;
266  } else if (reg == regionHcal) {
267  prob = nRusRoHcal;
268  } else if (reg == regionMuonIron) {
270  } else if (reg == regionPreShower) {
272  } else if (reg == regionCastor) {
273  prob = nRusRoCastor;
274  } else if (reg == regionWorld) {
275  prob = nRusRoWorld;
276  }
277 
278  // gamma
279  } else if (gRRactive && pdg == 22) {
280  elim = gRusRoEnerLim;
281  if (reg == regionEcal || reg == regionPreShower) {
282  if (rrApplicable(aTrack, *mother)) {
283  if (reg == regionEcal) {
284  prob = gRusRoEcal;
285  } else {
287  }
288  }
289  } else {
290  if (reg == regionHcal) {
291  prob = gRusRoHcal;
292  } else if (reg == regionMuonIron) {
294  } else if (reg == regionCastor) {
295  prob = gRusRoCastor;
296  } else if (reg == regionWorld) {
297  prob = gRusRoWorld;
298  }
299  }
300  }
301  if (prob < 1.0 && aTrack->GetKineticEnergy() < elim) {
302  if (G4UniformRand() < prob) {
303  const_cast<G4Track*>(aTrack)->SetWeight(currentWeight / prob);
304  } else {
305  classification = fKill;
306  }
307  }
308  }
309  }
310  if (classification != fKill) {
311  newTA->secondary(aTrack, *mother, flag);
312  }
313  LogDebug("SimG4CoreApplication")
314  << "StackingAction:Classify Track " << aTrack->GetTrackID() << " Parent " << aTrack->GetParentID()
315  << " Type " << aTrack->GetDefinition()->GetParticleName() << " K.E. " << aTrack->GetKineticEnergy() / MeV
316  << " MeV from process/subprocess " << aTrack->GetCreatorProcess()->GetProcessType() << "|"
317  << aTrack->GetCreatorProcess()->GetProcessSubType() << " as " << classification << " Flag " << flag;
318  }
319  }
320  }
321  }
322  if (nullptr != steppingVerbose) {
323  steppingVerbose->StackFilled(aTrack, (classification == fKill));
324  }
325  return classification;
326 }

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

◆ initPointer()

void StackingAction::initPointer ( )
private

Definition at line 332 of file StackingAction.cc.

332  {
333  // prepare region vector
334  unsigned int num = maxTimeNames.size();
335  maxTimeRegions.resize(num, nullptr);
336 
337  // Russian roulette
338  std::vector<G4Region*>* rs = G4RegionStore::GetInstance();
339 
340  for (auto& reg : *rs) {
341  G4String rname = reg->GetName();
342  if ((gRusRoEcal < 1.0 || nRusRoEcal < 1.0) && rname == "EcalRegion") {
343  regionEcal = reg;
344  }
345  if ((gRusRoHcal < 1.0 || nRusRoHcal < 1.0) && rname == "HcalRegion") {
346  regionHcal = reg;
347  }
348  if ((gRusRoMuonIron < 1.0 || nRusRoMuonIron < 1.0) && rname == "MuonIron") {
349  regionMuonIron = reg;
350  }
351  if ((gRusRoPreShower < 1.0 || nRusRoPreShower < 1.0) && rname == "PreshowerRegion") {
352  regionPreShower = reg;
353  }
354  if ((gRusRoCastor < 1.0 || nRusRoCastor < 1.0) && rname == "CastorRegion") {
355  regionCastor = reg;
356  }
357  if ((gRusRoWorld < 1.0 || nRusRoWorld < 1.0) && rname == "DefaultRegionForTheWorld") {
358  regionWorld = reg;
359  }
360 
361  // time limits
362  for (unsigned int i = 0; i < num; ++i) {
363  if (rname == (G4String)(maxTimeNames[i])) {
364  maxTimeRegions[i] = reg;
365  break;
366  }
367  }
368  //
369  if (savePDandCinTracker &&
370  (rname == "BeamPipe" || rname == "BeamPipeVacuum" || rname == "TrackerPixelSensRegion" ||
371  rname == "TrackerPixelDeadRegion" || rname == "TrackerDeadRegion" || rname == "TrackerSensRegion")) {
372  trackerRegions.push_back(reg);
373  }
374  if (savePDandCinCalo && (rname == "HcalRegion" || rname == "EcalRegion" || rname == "PreshowerSensRegion" ||
375  rname == "PreshowerRegion")) {
376  caloRegions.push_back(reg);
377  }
378  if (savePDandCinMuon && (rname == "MuonChamber" || rname == "MuonSensitive_RPC" || rname == "MuonIron" ||
379  rname == "Muon" || rname == "MuonSensitive_DT-CSC")) {
380  muonRegions.push_back(reg);
381  }
382  if (rname == "BeamPipeOutside" || rname == "BeamPipeVacuum") {
383  lowdensRegions.push_back(reg);
384  }
385  for (auto& dead : deadRegionNames) {
386  if (rname == (G4String)(dead)) {
387  deadRegions.push_back(reg);
388  }
389  }
390  }
391 }

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().

◆ isItFromPrimary()

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

Definition at line 426 of file StackingAction.cc.

426  {
427  int flag = flagIn;
428  if (flag != 1) {
429  const TrackInformation& motherInfo(extractor(mother));
430  if (motherInfo.isPrimary()) {
431  flag = 3;
432  }
433  }
434  return flag;
435 }

References extractor, RemoveAddSevLevel::flag, and TrackInformation::isPrimary().

Referenced by ClassifyNewTrack().

◆ isItOutOfTimeWindow()

bool StackingAction::isItOutOfTimeWindow ( const G4Region *  reg,
const G4Track *  aTrack 
) const
private

Definition at line 437 of file StackingAction.cc.

437  {
438  double tofM = maxTrackTime;
439  for (unsigned int i = 0; i < numberTimes; ++i) {
440  if (reg == maxTimeRegions[i]) {
441  tofM = maxTrackTimes[i];
442  break;
443  }
444  }
445  return (aTrack->GetGlobalTime() > tofM) ? true : false;
446 }

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

Referenced by ClassifyNewTrack().

◆ isItPrimaryDecayProductOrConversion()

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

Definition at line 404 of file StackingAction.cc.

404  {
405  int flag = 0;
406  const TrackInformation& motherInfo(extractor(mother));
407  // Check whether mother is a primary
408  if (motherInfo.isPrimary()) {
409  if (aTrack->GetCreatorProcess()->GetProcessType() == fDecay) {
410  flag = 1;
411  } else if (aTrack->GetCreatorProcess()->GetProcessSubType() == fGammaConversion) {
412  flag = 2;
413  }
414  }
415  return flag;
416 }

References extractor, hydjet2DefaultParameters_cff::fDecay, RemoveAddSevLevel::flag, and TrackInformation::isPrimary().

Referenced by ClassifyNewTrack().

◆ isThisRegion()

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

Definition at line 393 of file StackingAction.cc.

393  {
394  bool flag = false;
395  for (auto& region : regions) {
396  if (reg == region) {
397  flag = true;
398  break;
399  }
400  }
401  return flag;
402 }

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

Referenced by ClassifyNewTrack().

◆ NewStage()

void StackingAction::NewStage ( )
override

Definition at line 328 of file StackingAction.cc.

328 {}

◆ PrepareNewEvent()

void StackingAction::PrepareNewEvent ( )
override

Definition at line 330 of file StackingAction.cc.

330 {}

◆ printRegions()

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

Definition at line 448 of file StackingAction.cc.

448  {
449  for (unsigned int i = 0; i < reg.size(); ++i) {
450  edm::LogVerbatim("SimG4CoreApplication")
451  << " StackingAction: " << word << "Region " << i << ". " << reg[i]->GetName();
452  }
453 }

References mps_fire::i.

Referenced by StackingAction().

◆ rrApplicable()

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

Definition at line 418 of file StackingAction.cc.

418  {
419  const TrackInformation& motherInfo(extractor(mother));
420 
421  // Check whether mother is gamma, e+, e-
422  int genID = motherInfo.genParticlePID();
423  return (22 == genID || 11 == genID || -11 == genID) ? false : true;
424 }

References extractor, funct::false, and TrackInformation::genParticlePID().

Referenced by ClassifyNewTrack().

Member Data Documentation

◆ caloRegions

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

Definition at line 65 of file StackingAction.h.

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

◆ deadRegionNames

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

Definition at line 60 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

◆ deadRegions

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

Definition at line 67 of file StackingAction.h.

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

◆ extractor

TrackInformationExtractor StackingAction::extractor
private

◆ gRRactive

bool StackingAction::gRRactive
private

Definition at line 101 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ gRusRoCastor

double StackingAction::gRusRoCastor
private

Definition at line 96 of file StackingAction.h.

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

◆ gRusRoEcal

double StackingAction::gRusRoEcal
private

Definition at line 88 of file StackingAction.h.

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

◆ gRusRoEnerLim

double StackingAction::gRusRoEnerLim
private

Definition at line 84 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ gRusRoHcal

double StackingAction::gRusRoHcal
private

Definition at line 90 of file StackingAction.h.

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

◆ gRusRoMuonIron

double StackingAction::gRusRoMuonIron
private

Definition at line 92 of file StackingAction.h.

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

◆ gRusRoPreShower

double StackingAction::gRusRoPreShower
private

Definition at line 94 of file StackingAction.h.

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

◆ gRusRoWorld

double StackingAction::gRusRoWorld
private

Definition at line 98 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
private

Definition at line 49 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ killInCaloEfH

bool StackingAction::killInCaloEfH
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 66 of file StackingAction.h.

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

◆ maxTimeNames

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

Definition at line 59 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

◆ maxTimeRegions

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

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

◆ maxTrackTimes

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

Definition at line 58 of file StackingAction.h.

Referenced by isItOutOfTimeWindow(), and StackingAction().

◆ muonRegions

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

Definition at line 64 of file StackingAction.h.

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

◆ newTA

NewTrackAction* StackingAction::newTA
private

Definition at line 72 of file StackingAction.h.

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

◆ nRRactive

bool StackingAction::nRRactive
private

Definition at line 102 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ nRusRoCastor

double StackingAction::nRusRoCastor
private

Definition at line 97 of file StackingAction.h.

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

◆ nRusRoEcal

double StackingAction::nRusRoEcal
private

Definition at line 89 of file StackingAction.h.

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

◆ nRusRoEnerLim

double StackingAction::nRusRoEnerLim
private

Definition at line 85 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ nRusRoHcal

double StackingAction::nRusRoHcal
private

Definition at line 91 of file StackingAction.h.

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

◆ nRusRoMuonIron

double StackingAction::nRusRoMuonIron
private

Definition at line 93 of file StackingAction.h.

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

◆ nRusRoPreShower

double StackingAction::nRusRoPreShower
private

Definition at line 95 of file StackingAction.h.

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

◆ nRusRoWorld

double StackingAction::nRusRoWorld
private

Definition at line 99 of file StackingAction.h.

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

◆ numberTimes

unsigned int StackingAction::numberTimes
private

Definition at line 57 of file StackingAction.h.

Referenced by isItOutOfTimeWindow(), and StackingAction().

◆ regionCastor

const G4Region* StackingAction::regionCastor
private

Definition at line 80 of file StackingAction.h.

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

◆ regionEcal

const G4Region* StackingAction::regionEcal
private

Definition at line 76 of file StackingAction.h.

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

◆ regionHcal

const G4Region* StackingAction::regionHcal
private

Definition at line 77 of file StackingAction.h.

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

◆ regionMuonIron

const G4Region* StackingAction::regionMuonIron
private

Definition at line 78 of file StackingAction.h.

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

◆ regionPreShower

const G4Region* StackingAction::regionPreShower
private

Definition at line 79 of file StackingAction.h.

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

◆ regionWorld

const G4Region* StackingAction::regionWorld
private

Definition at line 81 of file StackingAction.h.

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

◆ saveFirstSecondary

bool StackingAction::saveFirstSecondary
private

Definition at line 47 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ savePDandCinAll

bool StackingAction::savePDandCinAll
private

Definition at line 48 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ savePDandCinCalo

bool StackingAction::savePDandCinCalo
private

Definition at line 46 of file StackingAction.h.

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

◆ savePDandCinMuon

bool StackingAction::savePDandCinMuon
private

Definition at line 47 of file StackingAction.h.

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

◆ savePDandCinTracker

bool StackingAction::savePDandCinTracker
private

Definition at line 46 of file StackingAction.h.

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

◆ steppingVerbose

const CMSSteppingVerbose* StackingAction::steppingVerbose
private

Definition at line 71 of file StackingAction.h.

Referenced by ClassifyNewTrack().

◆ trackAction

const TrackingAction* StackingAction::trackAction
private

Definition at line 70 of file StackingAction.h.

Referenced by ClassifyNewTrack().

◆ trackerRegions

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

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

Referenced by ClassifyNewTrack(), and StackingAction().

StackingAction::killGamma
bool killGamma
Definition: StackingAction.h:52
StackingAction::isItPrimaryDecayProductOrConversion
int isItPrimaryDecayProductOrConversion(const G4Track *, const G4Track &) const
Definition: StackingAction.cc:404
StackingAction::nRusRoMuonIron
double nRusRoMuonIron
Definition: StackingAction.h:93
mps_fire.i
i
Definition: mps_fire.py:355
StackingAction::worldSolid
G4VSolid * worldSolid
Definition: StackingAction.h:69
StackingAction::deadRegions
std::vector< const G4Region * > deadRegions
Definition: StackingAction.h:67
StackingAction::deadRegionNames
std::vector< std::string > deadRegionNames
Definition: StackingAction.h:60
funct::false
false
Definition: Factorize.h:34
StackingAction::savePDandCinMuon
bool savePDandCinMuon
Definition: StackingAction.h:47
StackingAction::nRusRoEcal
double nRusRoEcal
Definition: StackingAction.h:89
StackingAction::killHeavy
bool killHeavy
Definition: StackingAction.h:50
StackingAction::gRRactive
bool gRRactive
Definition: StackingAction.h:101
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
StackingAction::nRusRoPreShower
double nRusRoPreShower
Definition: StackingAction.h:95
StackingAction::savePDandCinCalo
bool savePDandCinCalo
Definition: StackingAction.h:46
StackingAction::gRusRoWorld
double gRusRoWorld
Definition: StackingAction.h:98
StackingAction::nRusRoCastor
double nRusRoCastor
Definition: StackingAction.h:97
MeV
const double MeV
StackingAction::newTA
NewTrackAction * newTA
Definition: StackingAction.h:72
TrackingAction::geant4Track
const G4Track * geant4Track() const
Definition: TrackingAction.h:25
StackingAction::savePDandCinAll
bool savePDandCinAll
Definition: StackingAction.h:48
StackingAction::muonRegions
std::vector< const G4Region * > muonRegions
Definition: StackingAction.h:64
StackingAction::gRusRoEcal
double gRusRoEcal
Definition: StackingAction.h:88
StackingAction::gRusRoCastor
double gRusRoCastor
Definition: StackingAction.h:96
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
StackingAction::regionPreShower
const G4Region * regionPreShower
Definition: StackingAction.h:79
StackingAction::isThisRegion
bool isThisRegion(const G4Region *, std::vector< const G4Region * > &) const
Definition: StackingAction.cc:393
StackingAction::isItFromPrimary
int isItFromPrimary(const G4Track &, int) const
Definition: StackingAction.cc:426
StackingAction::gRusRoHcal
double gRusRoHcal
Definition: StackingAction.h:90
StackingAction::killDeltaRay
bool killDeltaRay
Definition: StackingAction.h:50
StackingAction::regionMuonIron
const G4Region * regionMuonIron
Definition: StackingAction.h:78
StackingAction::regionWorld
const G4Region * regionWorld
Definition: StackingAction.h:81
StackingAction::lowdensRegions
std::vector< const G4Region * > lowdensRegions
Definition: StackingAction.h:66
NewTrackAction::secondary
void secondary(const G4Track *aSecondary, const G4Track &mother, int) const
Definition: NewTrackAction.cc:18
StackingAction::numberTimes
unsigned int numberTimes
Definition: StackingAction.h:57
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:226
StackingAction::killInCaloEfH
bool killInCaloEfH
Definition: StackingAction.h:49
StackingAction::regionHcal
const G4Region * regionHcal
Definition: StackingAction.h:77
StackingAction::extractor
TrackInformationExtractor extractor
Definition: StackingAction.h:73
StackingAction::killInCalo
bool killInCalo
Definition: StackingAction.h:49
StackingAction::rrApplicable
bool rrApplicable(const G4Track *, const G4Track &) const
Definition: StackingAction.cc:418
StackingAction::trackerRegions
std::vector< const G4Region * > trackerRegions
Definition: StackingAction.h:63
edm::LogWarning
Definition: MessageLogger.h:141
StackingAction::caloRegions
std::vector< const G4Region * > caloRegions
Definition: StackingAction.h:65
StackingAction::limitEnergyForVacuum
double limitEnergyForVacuum
Definition: StackingAction.h:53
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
StackingAction::nRusRoWorld
double nRusRoWorld
Definition: StackingAction.h:99
StackingAction::nRusRoEnerLim
double nRusRoEnerLim
Definition: StackingAction.h:85
CMSSteppingVerbose::StackFilled
void StackFilled(const G4Track *, bool isKilled) const
Definition: CMSSteppingVerbose.cc:136
StackingAction::saveFirstSecondary
bool saveFirstSecondary
Definition: StackingAction.h:47
ke
int ke
Definition: CascadeWrapper.h:13
rname
const G4String rname[NREG]
Definition: ParametrisedEMPhysics.cc:46
StackingAction::gRusRoPreShower
double gRusRoPreShower
Definition: StackingAction.h:94
TrackInformation
Definition: TrackInformation.h:8
StackingAction::maxTimeNames
std::vector< std::string > maxTimeNames
Definition: StackingAction.h:59
edm::LogVerbatim
Definition: MessageLogger.h:297
StackingAction::savePDandCinTracker
bool savePDandCinTracker
Definition: StackingAction.h:46
StackingAction::initPointer
void initPointer()
Definition: StackingAction.cc:332
StackingAction::regionCastor
const G4Region * regionCastor
Definition: StackingAction.h:80
StackingAction::kmaxIon
double kmaxIon
Definition: StackingAction.h:54
StackingAction::gRusRoMuonIron
double gRusRoMuonIron
Definition: StackingAction.h:92
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
StackingAction::maxTrackTime
double maxTrackTime
Definition: StackingAction.h:56
StackingAction::maxTimeRegions
std::vector< const G4Region * > maxTimeRegions
Definition: StackingAction.h:62
StackingAction::kmaxGamma
double kmaxGamma
Definition: StackingAction.h:55
StackingAction::killExtra
bool killExtra
Definition: StackingAction.h:51
NewTrackAction
Definition: NewTrackAction.h:14
StackingAction::kmaxProton
double kmaxProton
Definition: StackingAction.h:54
StackingAction::maxTrackTimes
std::vector< double > maxTrackTimes
Definition: StackingAction.h:58
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
StackingAction::nRusRoHcal
double nRusRoHcal
Definition: StackingAction.h:91
hydjet2DefaultParameters_cff.fDecay
fDecay
Decays ###.
Definition: hydjet2DefaultParameters_cff.py:62
pdg
Definition: pdg_functions.h:28
StackingAction::gRusRoEnerLim
double gRusRoEnerLim
Definition: StackingAction.h:84
StackingAction::trackAction
const TrackingAction * trackAction
Definition: StackingAction.h:70
AlignmentPI::regions
regions
Definition: AlignmentPayloadInspectorHelper.h:76
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
StackingAction::regionEcal
const G4Region * regionEcal
Definition: StackingAction.h:76
StackingAction::kmaxNeutron
double kmaxNeutron
Definition: StackingAction.h:54
StackingAction::printRegions
void printRegions(const std::vector< const G4Region * > &reg, const std::string &word) const
Definition: StackingAction.cc:448
StackingAction::steppingVerbose
const CMSSteppingVerbose * steppingVerbose
Definition: StackingAction.h:71
NewTrackAction::primary
void primary(const G4Track *aSecondary) const
Definition: NewTrackAction.cc:14
TtFullHadEvtBuilder_cfi.prob
prob
Definition: TtFullHadEvtBuilder_cfi.py:33
StackingAction::trackNeutrino
bool trackNeutrino
Definition: StackingAction.h:50
StackingAction::nRRactive
bool nRRactive
Definition: StackingAction.h:102
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
StackingAction::isItOutOfTimeWindow
bool isItOutOfTimeWindow(const G4Region *, const G4Track *) const
Definition: StackingAction.cc:437