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

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, 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 169 of file StackingAction.cc.

169 { delete newTA; }

References newTA.

Member Function Documentation

◆ ClassifyNewTrack()

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

Definition at line 171 of file StackingAction.cc.

171  {
172  // G4 interface part
173  G4ClassificationOfNewTrack classification = fUrgent;
174  const int pdg = aTrack->GetDefinition()->GetPDGEncoding();
175  const int abspdg = std::abs(pdg);
176 
177  // primary
178  if (aTrack->GetCreatorProcess() == 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 {
184  newTA->primary(aTrack);
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  newTA->secondary(aTrack, *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 
214  // kill tracks in specific regions
215  if (isThisRegion(reg, deadRegions)) {
216  classification = fKill;
217  }
218  if (classification != fKill && ke <= limitEnergyForVacuum && isThisRegion(reg, lowdensRegions)) {
219  classification = fKill;
220 
221  } else if (classification != fKill) {
222  // very low-energy gamma
223  if (pdg == 22 && killGamma && ke < kmaxGamma) {
224  classification = fKill;
225  }
226 
227  // specific track killing - not for production
228  if (killExtra && classification != fKill) {
229  if (killHeavy && classification != fKill) {
230  if (((pdg / 1000000000 == 1) && (((pdg / 10000) % 100) > 0) && (((pdg / 10) % 100) > 0) &&
231  (ke < kmaxIon)) ||
232  ((pdg == 2212) && (ke < kmaxProton)) || ((pdg == 2112) && (ke < kmaxNeutron))) {
233  classification = fKill;
234  }
235  }
236 
237  if (killDeltaRay && classification != fKill &&
238  aTrack->GetCreatorProcess()->GetProcessSubType() == fIonisation) {
239  classification = fKill;
240  }
241  if (killInCalo && classification != fKill && isThisRegion(reg, caloRegions)) {
242  classification = fKill;
243  }
244  if (killInCaloEfH && classification != fKill) {
245  int pdgMother = std::abs(trackAction->geant4Track()->GetDefinition()->GetPDGEncoding());
246  if ((pdg == 22 || abspdg == 11) && pdgMother != 11 && pdgMother != 22 && isThisRegion(reg, caloRegions)) {
247  classification = fKill;
248  }
249  }
250  }
251 
252  // Russian roulette && MC truth
253  if (classification != fKill) {
254  const G4Track* mother = trackAction->geant4Track();
255  int flag = 0;
256  if (savePDandCinAll) {
257  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
258  } else {
262  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
263  }
264  }
265  if (saveFirstSecondary && 0 == flag) {
266  flag = isItFromPrimary(*mother, flag);
267  }
268 
269  // Russian roulette
270  if (2112 == pdg || 22 == pdg) {
271  double currentWeight = aTrack->GetWeight();
272 
273  if (1.0 >= currentWeight) {
274  double prob = 1.0;
275  double elim = 0.0;
276 
277  // neutron
278  if (nRRactive && pdg == 2112) {
279  elim = nRusRoEnerLim;
280  if (reg == regionEcal) {
281  prob = nRusRoEcal;
282  } else if (reg == regionHcal) {
283  prob = nRusRoHcal;
284  } else if (reg == regionMuonIron) {
286  } else if (reg == regionPreShower) {
288  } else if (reg == regionCastor) {
289  prob = nRusRoCastor;
290  } else if (reg == regionWorld) {
291  prob = nRusRoWorld;
292  }
293 
294  // gamma
295  } else if (gRRactive && pdg == 22) {
296  elim = gRusRoEnerLim;
297  if (reg == regionEcal || reg == regionPreShower) {
298  if (rrApplicable(aTrack, *mother)) {
299  if (reg == regionEcal) {
300  prob = gRusRoEcal;
301  } else {
303  }
304  }
305  } else {
306  if (reg == regionHcal) {
307  prob = gRusRoHcal;
308  } else if (reg == regionMuonIron) {
310  } else if (reg == regionCastor) {
311  prob = gRusRoCastor;
312  } else if (reg == regionWorld) {
313  prob = gRusRoWorld;
314  }
315  }
316  }
317  if (prob < 1.0 && aTrack->GetKineticEnergy() < elim) {
318  if (G4UniformRand() < prob) {
319  const_cast<G4Track*>(aTrack)->SetWeight(currentWeight / prob);
320  } else {
321  classification = fKill;
322  }
323  }
324  }
325  }
326  if (classification != fKill) {
327  newTA->secondary(aTrack, *mother, flag);
328  }
329  LogDebug("SimG4CoreApplication")
330  << "StackingAction:Classify Track " << aTrack->GetTrackID() << " Parent " << aTrack->GetParentID()
331  << " Type " << aTrack->GetDefinition()->GetParticleName() << " K.E. " << aTrack->GetKineticEnergy() / MeV
332  << " MeV from process/subprocess " << aTrack->GetCreatorProcess()->GetProcessType() << "|"
333  << aTrack->GetCreatorProcess()->GetProcessSubType() << " as " << classification << " Flag " << flag;
334  }
335  }
336  }
337  }
338  if (nullptr != steppingVerbose) {
339  steppingVerbose->StackFilled(aTrack, (classification == fKill));
340  }
341  return classification;
342 }

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, maxTrackTimeForward, maxZCentralCMS, 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, protons_cff::time, trackAction, trackerRegions, trackNeutrino, and worldSolid.

◆ initPointer()

void StackingAction::initPointer ( )
private

Definition at line 348 of file StackingAction.cc.

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

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 443 of file StackingAction.cc.

443  {
444  int flag = flagIn;
445  if (flag != 1) {
446  const TrackInformation& motherInfo(extractor(mother));
447  if (motherInfo.isPrimary()) {
448  flag = 3;
449  }
450  }
451  return flag;
452 }

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

Referenced by ClassifyNewTrack().

◆ isItOutOfTimeWindow()

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

Definition at line 454 of file StackingAction.cc.

454  {
455  double tofM = maxTrackTime;
456  for (unsigned int i = 0; i < numberTimes; ++i) {
457  if (reg == maxTimeRegions[i]) {
458  tofM = maxTrackTimes[i];
459  break;
460  }
461  }
462  return (t > tofM);
463 }

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

Referenced by ClassifyNewTrack().

◆ isItPrimaryDecayProductOrConversion()

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

Definition at line 421 of file StackingAction.cc.

421  {
422  int flag = 0;
423  const TrackInformation& motherInfo(extractor(mother));
424  // Check whether mother is a primary
425  if (motherInfo.isPrimary()) {
426  if (aTrack->GetCreatorProcess()->GetProcessType() == fDecay) {
427  flag = 1;
428  } else if (aTrack->GetCreatorProcess()->GetProcessSubType() == fGammaConversion) {
429  flag = 2;
430  }
431  }
432  return flag;
433 }

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 410 of file StackingAction.cc.

410  {
411  bool flag = false;
412  for (auto& region : regions) {
413  if (reg == region) {
414  flag = true;
415  break;
416  }
417  }
418  return flag;
419 }

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

Referenced by ClassifyNewTrack().

◆ NewStage()

void StackingAction::NewStage ( )
override

Definition at line 344 of file StackingAction.cc.

344 {}

◆ PrepareNewEvent()

void StackingAction::PrepareNewEvent ( )
override

Definition at line 346 of file StackingAction.cc.

346 {}

◆ printRegions()

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

Definition at line 465 of file StackingAction.cc.

465  {
466  for (unsigned int i = 0; i < reg.size(); ++i) {
467  edm::LogVerbatim("SimG4CoreApplication")
468  << " StackingAction: " << word << "Region " << i << ". " << reg[i]->GetName();
469  }
470 }

References mps_fire::i.

Referenced by StackingAction().

◆ rrApplicable()

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

Definition at line 435 of file StackingAction.cc.

435  {
436  const TrackInformation& motherInfo(extractor(mother));
437 
438  // Check whether mother is gamma, e+, e-
439  const int genID = motherInfo.genParticlePID();
440  return (22 != genID && 11 != std::abs(genID));
441 }

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

Referenced by ClassifyNewTrack().

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

◆ extractor

TrackInformationExtractor StackingAction::extractor
private

◆ gRRactive

bool StackingAction::gRRactive
private

Definition at line 103 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ gRusRoCastor

double StackingAction::gRusRoCastor
private

Definition at line 98 of file StackingAction.h.

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

◆ gRusRoEcal

double StackingAction::gRusRoEcal
private

Definition at line 90 of file StackingAction.h.

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

◆ gRusRoEnerLim

double StackingAction::gRusRoEnerLim
private

Definition at line 86 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ gRusRoHcal

double StackingAction::gRusRoHcal
private

Definition at line 92 of file StackingAction.h.

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

◆ gRusRoMuonIron

double StackingAction::gRusRoMuonIron
private

Definition at line 94 of file StackingAction.h.

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

◆ gRusRoPreShower

double StackingAction::gRusRoPreShower
private

Definition at line 96 of file StackingAction.h.

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

◆ gRusRoWorld

double StackingAction::gRusRoWorld
private

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

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

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

◆ newTA

NewTrackAction* StackingAction::newTA
private

Definition at line 74 of file StackingAction.h.

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

◆ nRRactive

bool StackingAction::nRRactive
private

Definition at line 104 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ nRusRoCastor

double StackingAction::nRusRoCastor
private

Definition at line 99 of file StackingAction.h.

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

◆ nRusRoEcal

double StackingAction::nRusRoEcal
private

Definition at line 91 of file StackingAction.h.

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

◆ nRusRoEnerLim

double StackingAction::nRusRoEnerLim
private

Definition at line 87 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

◆ nRusRoHcal

double StackingAction::nRusRoHcal
private

Definition at line 93 of file StackingAction.h.

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

◆ nRusRoMuonIron

double StackingAction::nRusRoMuonIron
private

Definition at line 95 of file StackingAction.h.

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

◆ nRusRoPreShower

double StackingAction::nRusRoPreShower
private

Definition at line 97 of file StackingAction.h.

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

◆ nRusRoWorld

double StackingAction::nRusRoWorld
private

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

Definition at line 82 of file StackingAction.h.

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

◆ regionEcal

const G4Region* StackingAction::regionEcal
private

Definition at line 78 of file StackingAction.h.

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

◆ regionHcal

const G4Region* StackingAction::regionHcal
private

Definition at line 79 of file StackingAction.h.

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

◆ regionMuonIron

const G4Region* StackingAction::regionMuonIron
private

Definition at line 80 of file StackingAction.h.

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

◆ regionPreShower

const G4Region* StackingAction::regionPreShower
private

Definition at line 81 of file StackingAction.h.

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

◆ regionWorld

const G4Region* StackingAction::regionWorld
private

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

StackingAction::killGamma
bool killGamma
Definition: StackingAction.h:52
StackingAction::isItPrimaryDecayProductOrConversion
int isItPrimaryDecayProductOrConversion(const G4Track *, const G4Track &) const
Definition: StackingAction.cc:421
StackingAction::nRusRoMuonIron
double nRusRoMuonIron
Definition: StackingAction.h:95
mps_fire.i
i
Definition: mps_fire.py:428
StackingAction::worldSolid
G4VSolid * worldSolid
Definition: StackingAction.h:71
StackingAction::deadRegions
std::vector< const G4Region * > deadRegions
Definition: StackingAction.h:69
StackingAction::deadRegionNames
std::vector< std::string > deadRegionNames
Definition: StackingAction.h:62
StackingAction::savePDandCinMuon
bool savePDandCinMuon
Definition: StackingAction.h:47
StackingAction::maxZCentralCMS
double maxZCentralCMS
Definition: StackingAction.h:58
StackingAction::nRusRoEcal
double nRusRoEcal
Definition: StackingAction.h:91
StackingAction::killHeavy
bool killHeavy
Definition: StackingAction.h:50
StackingAction::gRRactive
bool gRRactive
Definition: StackingAction.h:103
StackingAction::nRusRoPreShower
double nRusRoPreShower
Definition: StackingAction.h:97
StackingAction::savePDandCinCalo
bool savePDandCinCalo
Definition: StackingAction.h:46
StackingAction::gRusRoWorld
double gRusRoWorld
Definition: StackingAction.h:100
StackingAction::nRusRoCastor
double nRusRoCastor
Definition: StackingAction.h:99
protons_cff.time
time
Definition: protons_cff.py:35
MeV
const double MeV
StackingAction::newTA
NewTrackAction * newTA
Definition: StackingAction.h:74
TrackingAction::geant4Track
const G4Track * geant4Track() const
Definition: TrackingAction.h:25
StackingAction::savePDandCinAll
bool savePDandCinAll
Definition: StackingAction.h:48
StackingAction::isItOutOfTimeWindow
bool isItOutOfTimeWindow(const G4Region *, const double &) const
Definition: StackingAction.cc:454
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
StackingAction::maxTrackTimeForward
double maxTrackTimeForward
Definition: StackingAction.h:57
StackingAction::muonRegions
std::vector< const G4Region * > muonRegions
Definition: StackingAction.h:66
StackingAction::gRusRoEcal
double gRusRoEcal
Definition: StackingAction.h:90
StackingAction::gRusRoCastor
double gRusRoCastor
Definition: StackingAction.h:98
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
StackingAction::regionPreShower
const G4Region * regionPreShower
Definition: StackingAction.h:81
StackingAction::isThisRegion
bool isThisRegion(const G4Region *, std::vector< const G4Region * > &) const
Definition: StackingAction.cc:410
StackingAction::isItFromPrimary
int isItFromPrimary(const G4Track &, int) const
Definition: StackingAction.cc:443
StackingAction::gRusRoHcal
double gRusRoHcal
Definition: StackingAction.h:92
StackingAction::killDeltaRay
bool killDeltaRay
Definition: StackingAction.h:50
StackingAction::regionMuonIron
const G4Region * regionMuonIron
Definition: StackingAction.h:80
StackingAction::regionWorld
const G4Region * regionWorld
Definition: StackingAction.h:83
StackingAction::lowdensRegions
std::vector< const G4Region * > lowdensRegions
Definition: StackingAction.h:68
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:79
NewTrackAction::secondary
void secondary(const G4Track *aSecondary, const G4Track &mother, int) const
Definition: NewTrackAction.cc:18
StackingAction::numberTimes
unsigned int numberTimes
Definition: StackingAction.h:59
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:352
StackingAction::killInCaloEfH
bool killInCaloEfH
Definition: StackingAction.h:49
StackingAction::regionHcal
const G4Region * regionHcal
Definition: StackingAction.h:79
StackingAction::extractor
TrackInformationExtractor extractor
Definition: StackingAction.h:75
StackingAction::killInCalo
bool killInCalo
Definition: StackingAction.h:49
StackingAction::rrApplicable
bool rrApplicable(const G4Track *, const G4Track &) const
Definition: StackingAction.cc:435
StackingAction::trackerRegions
std::vector< const G4Region * > trackerRegions
Definition: StackingAction.h:65
StackingAction::caloRegions
std::vector< const G4Region * > caloRegions
Definition: StackingAction.h:67
StackingAction::limitEnergyForVacuum
double limitEnergyForVacuum
Definition: StackingAction.h:53
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
StackingAction::nRusRoWorld
double nRusRoWorld
Definition: StackingAction.h:101
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
StackingAction::nRusRoEnerLim
double nRusRoEnerLim
Definition: StackingAction.h:87
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:44
StackingAction::gRusRoPreShower
double gRusRoPreShower
Definition: StackingAction.h:96
TrackInformation
Definition: TrackInformation.h:12
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
StackingAction::maxTimeNames
std::vector< std::string > maxTimeNames
Definition: StackingAction.h:61
StackingAction::savePDandCinTracker
bool savePDandCinTracker
Definition: StackingAction.h:46
StackingAction::initPointer
void initPointer()
Definition: StackingAction.cc:348
StackingAction::regionCastor
const G4Region * regionCastor
Definition: StackingAction.h:82
StackingAction::kmaxIon
double kmaxIon
Definition: StackingAction.h:54
StackingAction::gRusRoMuonIron
double gRusRoMuonIron
Definition: StackingAction.h:94
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:33
StackingAction::maxTrackTime
double maxTrackTime
Definition: StackingAction.h:56
StackingAction::maxTimeRegions
std::vector< const G4Region * > maxTimeRegions
Definition: StackingAction.h:64
StackingAction::kmaxGamma
double kmaxGamma
Definition: StackingAction.h:55
StackingAction::killExtra
bool killExtra
Definition: StackingAction.h:51
NewTrackAction
Definition: NewTrackAction.h:14
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
StackingAction::kmaxProton
double kmaxProton
Definition: StackingAction.h:54
StackingAction::maxTrackTimes
std::vector< double > maxTrackTimes
Definition: StackingAction.h:60
StackingAction::nRusRoHcal
double nRusRoHcal
Definition: StackingAction.h:93
hydjet2DefaultParameters_cff.fDecay
fDecay
Decays ###.
Definition: hydjet2DefaultParameters_cff.py:62
pdg
Definition: pdg_functions.h:28
StackingAction::gRusRoEnerLim
double gRusRoEnerLim
Definition: StackingAction.h:86
StackingAction::trackAction
const TrackingAction * trackAction
Definition: StackingAction.h:72
AlignmentPI::regions
regions
Definition: AlignmentPayloadInspectorHelper.h:78
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
StackingAction::regionEcal
const G4Region * regionEcal
Definition: StackingAction.h:78
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:465
StackingAction::steppingVerbose
const CMSSteppingVerbose * steppingVerbose
Definition: StackingAction.h:73
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
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:104
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117