CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( const TrackingAction trka,
const edm::ParameterSet ps,
const CMSSteppingVerbose sv 
)
explicit

Definition at line 18 of file StackingAction.cc.

References caloRegions, deadRegionNames, deadRegions, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), 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, newTA, nRRactive, nRusRoCastor, nRusRoEcal, nRusRoEnerLim, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, numberTimes, printRegions(), regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, saveFirstSecondary, savePDandCinAll, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, trackerRegions, trackNeutrino, and worldSolid.

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  }
106  killExtra = killDeltaRay || killHeavy || killInCalo || killInCaloEfH;
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 }
double nRusRoPreShower
Log< level::Info, true > LogVerbatim
NewTrackAction * newTA
std::vector< const G4Region * > lowdensRegions
double maxZCentralCMS
std::vector< double > maxTrackTimes
double gRusRoPreShower
double nRusRoEnerLim
const G4Region * regionCastor
const G4Region * regionMuonIron
std::vector< const G4Region * > deadRegions
const CMSSteppingVerbose * steppingVerbose
std::vector< const G4Region * > muonRegions
std::vector< std::string > maxTimeNames
const G4Region * regionEcal
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
const G4Region * regionHcal
double maxTrackTimeForward
const G4Region * regionPreShower
const TrackingAction * trackAction
Log< level::Warning, false > LogWarning
double gRusRoMuonIron
std::vector< const G4Region * > trackerRegions
std::vector< const G4Region * > caloRegions
double limitEnergyForVacuum
const G4Region * regionWorld
StackingAction::~StackingAction ( )
override

Definition at line 169 of file StackingAction.cc.

References newTA.

169 { delete newTA; }
NewTrackAction * newTA

Member Function Documentation

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

Definition at line 171 of file StackingAction.cc.

References funct::abs(), caloRegions, deadRegions, 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, muonRegions, newTA, nRRactive, nRusRoCastor, nRusRoEcal, nRusRoEnerLim, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, NewTrackAction::primary(), regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, rrApplicable(), saveFirstSecondary, savePDandCinAll, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, NewTrackAction::secondary(), CMSSteppingVerbose::StackFilled(), steppingVerbose, trackAction, trackerRegions, trackNeutrino, and worldSolid.

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) {
285  prob = nRusRoMuonIron;
286  } else if (reg == regionPreShower) {
287  prob = nRusRoPreShower;
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 {
302  prob = gRusRoPreShower;
303  }
304  }
305  } else {
306  if (reg == regionHcal) {
307  prob = gRusRoHcal;
308  } else if (reg == regionMuonIron) {
309  prob = gRusRoMuonIron;
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 }
void primary(const G4Track *aSecondary) const
double nRusRoPreShower
NewTrackAction * newTA
std::vector< const G4Region * > lowdensRegions
double maxZCentralCMS
void StackFilled(const G4Track *, bool isKilled) const
double gRusRoPreShower
double nRusRoEnerLim
const G4Region * regionCastor
const G4Region * regionMuonIron
bool rrApplicable(const G4Track *, const G4Track &) const
int isItPrimaryDecayProductOrConversion(const G4Track *, const G4Track &) const
std::vector< const G4Region * > deadRegions
const CMSSteppingVerbose * steppingVerbose
std::vector< const G4Region * > muonRegions
const G4Region * regionEcal
void secondary(const G4Track *aSecondary, const G4Track &mother, int) const
double nRusRoMuonIron
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
G4VSolid * worldSolid
bool isItOutOfTimeWindow(const G4Region *, const double &) const
bool isThisRegion(const G4Region *, std::vector< const G4Region * > &) const
int ke
bool savePDandCinTracker
double gRusRoEnerLim
const G4Region * regionHcal
double maxTrackTimeForward
const G4Region * regionPreShower
const TrackingAction * trackAction
int isItFromPrimary(const G4Track &, int) const
double gRusRoMuonIron
std::vector< const G4Region * > trackerRegions
#define LogDebug(id)
std::vector< const G4Region * > caloRegions
double limitEnergyForVacuum
const G4Region * regionWorld
const G4Track * geant4Track() const
void StackingAction::initPointer ( )
private

Definition at line 348 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, pileupDistInMC::num, regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, rname, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, and trackerRegions.

Referenced by StackingAction().

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 }
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
int StackingAction::isItFromPrimary ( const G4Track &  mother,
int  flagIn 
) const
private

Definition at line 443 of file StackingAction.cc.

References extractor, and TrackInformation::isPrimary().

Referenced by ClassifyNewTrack().

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 }
TrackInformationExtractor extractor
bool StackingAction::isItOutOfTimeWindow ( const G4Region *  reg,
const double &  t 
) const
private

Definition at line 454 of file StackingAction.cc.

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

Referenced by ClassifyNewTrack().

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 }
std::vector< double > maxTrackTimes
unsigned int numberTimes
std::vector< const G4Region * > maxTimeRegions
int StackingAction::isItPrimaryDecayProductOrConversion ( const G4Track *  aTrack,
const G4Track &  mother 
) const
private

Definition at line 421 of file StackingAction.cc.

References extractor, and TrackInformation::isPrimary().

Referenced by ClassifyNewTrack().

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 }
TrackInformationExtractor extractor
bool StackingAction::isThisRegion ( const G4Region *  reg,
std::vector< const G4Region * > &  regions 
) const
private

Definition at line 410 of file StackingAction.cc.

References HLT_FULL_cff::region.

Referenced by ClassifyNewTrack().

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 }
void StackingAction::NewStage ( )
override

Definition at line 344 of file StackingAction.cc.

344 {}
void StackingAction::PrepareNewEvent ( )
override

Definition at line 346 of file StackingAction.cc.

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

Definition at line 465 of file StackingAction.cc.

References mps_fire::i.

Referenced by StackingAction().

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 }
Log< level::Info, true > LogVerbatim
uint64_t word
bool StackingAction::rrApplicable ( const G4Track *  aTrack,
const G4Track &  mother 
) const
private

Definition at line 435 of file StackingAction.cc.

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

Referenced by ClassifyNewTrack().

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 }
TrackInformationExtractor extractor
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

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

Definition at line 67 of file StackingAction.h.

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

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

Definition at line 62 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

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

Definition at line 69 of file StackingAction.h.

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

TrackInformationExtractor StackingAction::extractor
private
bool StackingAction::gRRactive
private

Definition at line 103 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::gRusRoCastor
private

Definition at line 98 of file StackingAction.h.

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

double StackingAction::gRusRoEcal
private

Definition at line 90 of file StackingAction.h.

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

double StackingAction::gRusRoEnerLim
private

Definition at line 86 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::gRusRoHcal
private

Definition at line 92 of file StackingAction.h.

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

double StackingAction::gRusRoMuonIron
private

Definition at line 94 of file StackingAction.h.

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

double StackingAction::gRusRoPreShower
private

Definition at line 96 of file StackingAction.h.

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

double StackingAction::gRusRoWorld
private

Definition at line 100 of file StackingAction.h.

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

bool StackingAction::killDeltaRay
private

Definition at line 50 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killExtra
private

Definition at line 51 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killGamma
private

Definition at line 52 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killHeavy
private

Definition at line 50 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killInCalo
private

Definition at line 49 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killInCaloEfH
private

Definition at line 49 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::kmaxGamma
private

Definition at line 55 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::kmaxIon
private

Definition at line 54 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::kmaxNeutron
private

Definition at line 54 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::kmaxProton
private

Definition at line 54 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::limitEnergyForVacuum
private

Definition at line 53 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

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

Definition at line 68 of file StackingAction.h.

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

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

Definition at line 61 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

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

Definition at line 64 of file StackingAction.h.

Referenced by initPointer(), and isItOutOfTimeWindow().

double StackingAction::maxTrackTime
private

Definition at line 56 of file StackingAction.h.

Referenced by isItOutOfTimeWindow(), and StackingAction().

double StackingAction::maxTrackTimeForward
private

Definition at line 57 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

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

Definition at line 60 of file StackingAction.h.

Referenced by isItOutOfTimeWindow(), and StackingAction().

double StackingAction::maxZCentralCMS
private

Definition at line 58 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

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

Definition at line 66 of file StackingAction.h.

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

NewTrackAction* StackingAction::newTA
private

Definition at line 74 of file StackingAction.h.

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

bool StackingAction::nRRactive
private

Definition at line 104 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::nRusRoCastor
private

Definition at line 99 of file StackingAction.h.

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

double StackingAction::nRusRoEcal
private

Definition at line 91 of file StackingAction.h.

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

double StackingAction::nRusRoEnerLim
private

Definition at line 87 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::nRusRoHcal
private

Definition at line 93 of file StackingAction.h.

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

double StackingAction::nRusRoMuonIron
private

Definition at line 95 of file StackingAction.h.

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

double StackingAction::nRusRoPreShower
private

Definition at line 97 of file StackingAction.h.

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

double StackingAction::nRusRoWorld
private

Definition at line 101 of file StackingAction.h.

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

unsigned int StackingAction::numberTimes
private

Definition at line 59 of file StackingAction.h.

Referenced by isItOutOfTimeWindow(), and StackingAction().

const G4Region* StackingAction::regionCastor
private

Definition at line 82 of file StackingAction.h.

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

const G4Region* StackingAction::regionEcal
private

Definition at line 78 of file StackingAction.h.

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

const G4Region* StackingAction::regionHcal
private

Definition at line 79 of file StackingAction.h.

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

const G4Region* StackingAction::regionMuonIron
private

Definition at line 80 of file StackingAction.h.

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

const G4Region* StackingAction::regionPreShower
private

Definition at line 81 of file StackingAction.h.

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

const G4Region* StackingAction::regionWorld
private

Definition at line 83 of file StackingAction.h.

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

bool StackingAction::saveFirstSecondary
private

Definition at line 47 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::savePDandCinAll
private

Definition at line 48 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::savePDandCinCalo
private

Definition at line 46 of file StackingAction.h.

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

bool StackingAction::savePDandCinMuon
private

Definition at line 47 of file StackingAction.h.

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

bool StackingAction::savePDandCinTracker
private

Definition at line 46 of file StackingAction.h.

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

const CMSSteppingVerbose* StackingAction::steppingVerbose
private

Definition at line 73 of file StackingAction.h.

Referenced by ClassifyNewTrack().

const TrackingAction* StackingAction::trackAction
private

Definition at line 72 of file StackingAction.h.

Referenced by ClassifyNewTrack().

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

Definition at line 65 of file StackingAction.h.

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

bool StackingAction::trackNeutrino
private

Definition at line 50 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

G4VSolid* StackingAction::worldSolid
private

Definition at line 71 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().