CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StackingAction.cc
Go to the documentation of this file.
6 
8 
9 #include "G4VProcess.hh"
10 #include "G4EmProcessSubType.hh"
11 #include "G4LogicalVolumeStore.hh"
12 #include "G4RegionStore.hh"
13 #include "Randomize.hh"
14 #include "G4SystemOfUnits.hh"
15 
16 #include<algorithm>
17 
18 //#define DebugLog
19 
21  : trackAction(trka)
22 {
23  trackNeutrino = p.getParameter<bool>("TrackNeutrino");
24  killHeavy = p.getParameter<bool>("KillHeavy");
25  killGamma = p.getParameter<bool>("KillGamma");
26  kmaxGamma = p.getParameter<double>("GammaThreshold")*MeV;
27  kmaxIon = p.getParameter<double>("IonThreshold")*MeV;
28  kmaxProton = p.getParameter<double>("ProtonThreshold")*MeV;
29  kmaxNeutron = p.getParameter<double>("NeutronThreshold")*MeV;
30  killDeltaRay = p.getParameter<bool>("KillDeltaRay");
31  limitEnergyForVacuum = p.getParameter<double>("CriticalEnergyForVacuum")*MeV;
32  maxTrackTime = p.getParameter<double>("MaxTrackTime")*ns;
33  maxTrackTimes = p.getParameter<std::vector<double> >("MaxTrackTimes");
34  maxTimeNames = p.getParameter<std::vector<std::string> >("MaxTimeNames");
35  deadRegionNames= p.getParameter<std::vector<std::string> >("DeadRegions");
37  p.getUntrackedParameter<bool>("SaveAllPrimaryDecayProductsAndConversions",
38  true);
40  p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInTracker",
41  false);
43  p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInCalo",
44  false);
46  p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInMuon",
47  false);
49  p.getUntrackedParameter<bool>("SaveFirstLevelSecondary",false);
50  killInCalo = false;
51  killInCaloEfH = false;
52 
53  // Russian Roulette
54  regionEcal = 0;
55  regionHcal = 0;
56  regionMuonIron = 0;
57  regionPreShower= 0;
58  regionCastor = 0;
59  regionWorld = 0;
60 
61  gRusRoEnerLim = p.getParameter<double>("RusRoGammaEnergyLimit")*MeV;
62  nRusRoEnerLim = p.getParameter<double>("RusRoNeutronEnergyLimit")*MeV;
63  pRusRoEnerLim = p.getParameter<double>("RusRoProtonEnergyLimit")*MeV;
64 
65  gRusRoEcal = p.getParameter<double>("RusRoEcalGamma");
66  gRusRoHcal = p.getParameter<double>("RusRoHcalGamma");
67  gRusRoMuonIron = p.getParameter<double>("RusRoMuonIronGamma");
68  gRusRoPreShower = p.getParameter<double>("RusRoPreShowerGamma");
69  gRusRoCastor = p.getParameter<double>("RusRoCastorGamma");
70  gRusRoWorld = p.getParameter<double>("RusRoWorldGamma");
71 
72  nRusRoEcal = p.getParameter<double>("RusRoEcalNeutron");
73  nRusRoHcal = p.getParameter<double>("RusRoHcalNeutron");
74  nRusRoMuonIron = p.getParameter<double>("RusRoMuonIronNeutron");
75  nRusRoPreShower = p.getParameter<double>("RusRoPreShowerNeutron");
76  nRusRoCastor = p.getParameter<double>("RusRoCastorNeutron");
77  nRusRoWorld = p.getParameter<double>("RusRoWorldNeutron");
78 
79  pRusRoEcal = p.getParameter<double>("RusRoEcalProton");
80  pRusRoHcal = p.getParameter<double>("RusRoHcalProton");
81  pRusRoMuonIron = p.getParameter<double>("RusRoMuonIronProton");
82  pRusRoPreShower = p.getParameter<double>("RusRoPreShowerProton");
83  pRusRoCastor = p.getParameter<double>("RusRoCastorProton");
84  pRusRoWorld = p.getParameter<double>("RusRoWorldProton");
85 
86  gRRactive = false;
87  nRRactive = false;
88  pRRactive = false;
89  if(gRusRoEnerLim > 0.0 &&
90  (gRusRoEcal < 1.0 || gRusRoHcal < 1.0 ||
91  gRusRoMuonIron < 1.0 || gRusRoPreShower < 1.0 || gRusRoCastor < 1.0 ||
92  gRusRoWorld < 1.0)) { gRRactive = true; }
93  if(nRusRoEnerLim > 0.0 &&
94  (nRusRoEcal < 1.0 || nRusRoHcal < 1.0 ||
95  nRusRoMuonIron < 1.0 || nRusRoPreShower < 1.0 || nRusRoCastor < 1.0 ||
96  nRusRoWorld < 1.0)) { nRRactive = true; }
97  if(pRusRoEnerLim > 0.0 &&
98  (pRusRoEcal < 1.0 || pRusRoHcal < 1.0 ||
99  pRusRoMuonIron < 1.0 || pRusRoPreShower < 1.0 || pRusRoCastor < 1.0 ||
100  pRusRoWorld < 1.0)) { pRRactive = true; }
101 
102  if ( p.exists("TestKillingOptions") ) {
103  killInCalo = (p.getParameter<edm::ParameterSet>("TestKillingOptions"))
104  .getParameter<bool>("KillInCalo");
105  killInCaloEfH = (p.getParameter<edm::ParameterSet>("TestKillingOptions"))
106  .getParameter<bool>("KillInCaloEfH");
107  edm::LogWarning("SimG4CoreApplication")
108  << " *** Activating special test killing options in StackingAction \n"
109  << " *** Kill secondaries in Calorimetetrs volume = " << killInCalo << "\n"
110  << " *** Kill electromagnetic secondaries from hadrons in Calorimeters volume= "
111  << killInCaloEfH;
112 
113  }
114 
115  initPointer();
116  newTA = new NewTrackAction();
117 
118  edm::LogInfo("SimG4CoreApplication") << "StackingAction initiated with"
119  << " flag for saving decay products in "
120  << " Tracker: " << savePDandCinTracker
121  << " in Calo: " << savePDandCinCalo
122  << " in Muon: " << savePDandCinMuon
123  << " everywhere: " << savePDandCinAll
124  << "\n saveFirstSecondary"
125  << ": " << saveFirstSecondary
126  << " Tracking neutrino flag: "
127  << trackNeutrino
128  << " Kill Delta Ray flag: "
129  << killDeltaRay
130  << " Kill hadrons/ions flag: "
131  << killHeavy;
132 
133 
134  if(killHeavy) {
135  edm::LogInfo("SimG4CoreApplication") << "StackingAction kill protons below "
136  << kmaxProton/MeV <<" MeV, neutrons below "
137  << kmaxNeutron/MeV << " MeV and ions"
138  << " below " << kmaxIon/MeV << " MeV";
139  }
140 
141  edm::LogInfo("SimG4CoreApplication") << "StackingAction kill tracks with "
142  << "time larger than " << maxTrackTime/ns
143  << " ns ";
144  numberTimes = maxTimeNames.size();
145  if(0 < numberTimes) {
146  for (unsigned int i=0; i<numberTimes; ++i) {
147  edm::LogInfo("SimG4CoreApplication") << "StackingAction MaxTrackTime for "
148  << maxTimeNames[i] << " is "
149  << maxTrackTimes[i] << " ns ";
150  maxTrackTimes[i] *= ns;
151  }
152  }
153  if(limitEnergyForVacuum > 0.0) {
154  edm::LogInfo("SimG4CoreApplication")
155  << "StackingAction LowDensity regions - kill if E < "
156  << limitEnergyForVacuum/MeV << " MeV";
157  printRegions(lowdensRegions,"LowDensity");
158  }
159  if(deadRegions.size() > 0.0) {
160  edm::LogInfo("SimG4CoreApplication")
161  << "StackingAction Dead regions - kill all secondaries ";
162  printRegions(deadRegions, "Dead");
163  }
164  if(gRRactive) {
165  edm::LogInfo("SimG4CoreApplication")
166  << "StackingAction: "
167  << "Russian Roulette for gamma Elimit(MeV)= "
168  << gRusRoEnerLim/MeV << "\n"
169  << " ECAL Prob= " << gRusRoEcal << "\n"
170  << " HCAL Prob= " << gRusRoHcal << "\n"
171  << " MuonIron Prob= " << gRusRoMuonIron << "\n"
172  << " PreShower Prob= " << gRusRoPreShower << "\n"
173  << " CASTOR Prob= " << gRusRoCastor << "\n"
174  << " World Prob= " << gRusRoWorld;
175  }
176  if(nRRactive) {
177  edm::LogInfo("SimG4CoreApplication")
178  << "StackingAction: "
179  << "Russian Roulette for neutron Elimit(MeV)= "
180  << nRusRoEnerLim/MeV << "\n"
181  << " ECAL Prob= " << nRusRoEcal << "\n"
182  << " HCAL Prob= " << nRusRoHcal << "\n"
183  << " MuonIron Prob= " << nRusRoMuonIron << "\n"
184  << " PreShower Prob= " << nRusRoPreShower << "\n"
185  << " CASTOR Prob= " << nRusRoCastor << "\n"
186  << " World Prob= " << nRusRoWorld;
187  }
188  if(pRRactive) {
189  edm::LogInfo("SimG4CoreApplication")
190  << "StackingAction: "
191  << "Russian Roulette for proton Elimit(MeV)= "
192  << pRusRoEnerLim/MeV << "\n"
193  << " ECAL Prob= " << pRusRoEcal << "\n"
194  << " HCAL Prob= " << pRusRoHcal << "\n"
195  << " MuonIron Prob= " << pRusRoMuonIron << "\n"
196  << " PreShower Prob= " << pRusRoPreShower << "\n"
197  << " CASTOR Prob= " << pRusRoCastor << "\n"
198  << " World Prob= " << pRusRoWorld;
199  }
200 
201  if(savePDandCinTracker) {
202  edm::LogInfo("SimG4CoreApplication") << "StackingAction Tracker regions: ";
203  printRegions(trackerRegions,"Tracker");
204  }
205  if(savePDandCinCalo) {
206  edm::LogInfo("SimG4CoreApplication") << "StackingAction Calo regions: ";
207  printRegions(caloRegions, "Calo");
208  }
209  if(savePDandCinMuon) {
210  edm::LogInfo("SimG4CoreApplication") << "StackingAction Muon regions: ";
211  printRegions(muonRegions,"Muon");
212  }
213 }
214 
216 {
217  delete newTA;
218 }
219 
220 G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track * aTrack)
221 {
222  // G4 interface part
223  G4ClassificationOfNewTrack classification = fUrgent;
224  if (aTrack->GetCreatorProcess()==0 || aTrack->GetParentID()==0) {
225  /*
226  std::cout << "StackingAction: primary weight= "
227  << aTrack->GetWeight() << " "
228  << aTrack->GetDefinition()->GetParticleName()
229  << " " << aTrack->GetKineticEnergy()
230  << " Id=" << aTrack->GetTrackID()
231  << " trackInfo " << aTrack->GetUserInformation()
232  << std::endl;
233  */
234  newTA->primary(aTrack);
235  /*
236  if (!trackNeutrino) {
237  int pdg = std::abs(aTrack->GetDefinition()->GetPDGEncoding());
238  if (pdg == 12 || pdg == 14 || pdg == 16 || pdg == 18) {
239  classification = fKill;
240  }
241  }
242  */
243  } else if (aTrack->GetTouchable() == 0) {
244  edm::LogError("SimG4CoreApplication")
245  << "StackingAction: no touchable for track " << aTrack->GetTrackID()
246  << " from " << aTrack->GetParentID()
247  << " with PDG code " << aTrack->GetDefinition()->GetParticleName();
248  classification = fKill;
249  } else {
250  int pdg = aTrack->GetDefinition()->GetPDGEncoding();
251  double ke = aTrack->GetKineticEnergy();
252 
253  if (aTrack->GetTrackStatus() == fStopAndKill) { classification = fKill; }
254  if (killHeavy && classification != fKill) {
255  if (((pdg/1000000000 == 1) && (((pdg/10000)%100) > 0) &&
256  (((pdg/10)%100) > 0) && (ke<kmaxIon)) ||
257  ((pdg == 2212) && (ke < kmaxProton)) ||
258  ((pdg == 2112) && (ke < kmaxNeutron))) { classification = fKill; }
259  }
260  if (!trackNeutrino && classification != fKill) {
261  if (pdg == 12 || pdg == 14 || pdg == 16 || pdg == 18)
262  classification = fKill;
263  }
264  if (classification != fKill && isItLongLived(aTrack))
265  { classification = fKill; }
266 
267  if (classification != fKill && killGamma && pdg == 22 && ke < kmaxGamma)
268  {
269  classification = fKill;
270  //std::cout << "### next gamma killed E(MeV)= " << ke
271  // << " " << aTrack->GetCreatorProcess()->GetProcessName()
272  // << std::endl;
273  }
274 
275 
276  if (killDeltaRay && classification != fKill
277  && aTrack->GetCreatorProcess()->GetProcessSubType() == fIonisation) {
278  classification = fKill;
279  }
280 
281  const G4Region* reg = aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
282  if (killInCalo && classification != fKill
283  && isThisRegion(reg, caloRegions)) {
284  classification = fKill;
285  }
286  if (classification != fKill && ke <= limitEnergyForVacuum
287  && isThisRegion(reg, lowdensRegions)) {
288  classification = fKill;
289  }
290  if (classification != fKill && isThisRegion(reg, deadRegions)) {
291  classification = fKill;
292  }
293 
294  // Russian roulette && MC truth
295  if(classification != fKill) {
296  const G4Track * mother = trackAction->geant4Track();
297  int flag = 0;
298  if(savePDandCinAll) {
299  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
300  } else {
304  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
305  }
306  }
307  if (saveFirstSecondary && 0 == flag) {
308  flag = isItFromPrimary(*mother, flag);
309  }
310 
311  // Russian roulette
312  if(2112 == pdg || 22 == pdg || 2212 == pdg) {
313  double currentWeight = aTrack->GetWeight();
314 
315  if(1.0 >= currentWeight) {
316  double prob = 1.0;
317  double elim = 0.0;
318 
319  // neutron
320  if(nRRactive && pdg == 2112) {
321  elim = nRusRoEnerLim;
322  if(reg == regionEcal) { prob = nRusRoEcal; }
323  else if(reg == regionHcal) { prob = nRusRoHcal; }
324  else if(reg == regionMuonIron) { prob = nRusRoMuonIron; }
325  else if(reg == regionPreShower) { prob = nRusRoPreShower; }
326  else if(reg == regionCastor) { prob = nRusRoCastor; }
327  else if(reg == regionWorld) { prob = nRusRoWorld; }
328 
329  // gamma
330  } else if(gRRactive && pdg == 22) {
331  elim = gRusRoEnerLim;
332  if(reg == regionEcal || reg == regionPreShower) {
333  if(rrApplicable(aTrack, *mother)) {
334  if(reg == regionEcal) { prob = gRusRoEcal; }
335  else { prob = gRusRoPreShower; }
336  }
337  } else {
338  if(reg == regionHcal) { prob = gRusRoHcal; }
339  else if(reg == regionMuonIron) { prob = gRusRoMuonIron; }
340  else if(reg == regionCastor) { prob = gRusRoCastor; }
341  else if(reg == regionWorld) { prob = gRusRoWorld; }
342  }
343 
344  // proton
345  } else if(pRRactive && pdg == 2212) {
346  elim = pRusRoEnerLim;
347  if(reg == regionEcal) { prob = pRusRoEcal; }
348  else if(reg == regionHcal) { prob = pRusRoHcal; }
349  else if(reg == regionMuonIron) { prob = pRusRoMuonIron; }
350  else if(reg == regionPreShower) { prob = pRusRoPreShower; }
351  else if(reg == regionCastor) { prob = pRusRoCastor; }
352  else if(reg == regionWorld) { prob = pRusRoWorld; }
353  }
354  if(prob < 1.0 && aTrack->GetKineticEnergy() < elim) {
355  if(G4UniformRand() < prob) {
356  const_cast<G4Track*>(aTrack)->SetWeight(currentWeight/prob);
357  } else {
358  classification = fKill;
359  }
360  }
361  }
362  }
363 
364  if(classification != fKill && killInCaloEfH) {
365  int pdgMother = mother->GetDefinition()->GetPDGEncoding();
366  if ( (pdg == 22 || std::abs(pdg) == 11) &&
367  (std::abs(pdgMother) < 11 || std::abs(pdgMother) > 17) &&
368  pdgMother != 22 ) {
369  if ( isThisRegion(reg,caloRegions)) {
370  classification = fKill;
371  }
372  }
373  }
374 
375  if (classification != fKill) {
376  newTA->secondary(aTrack, *mother, flag);
377  }
378  }
379  /*
380  double wt2 = aTrack->GetWeight();
381  if(wt2 != 1.0) {
382  G4Region* reg = aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
383  std::cout << "StackingAction: weight= " << wt2 << " "
384  << aTrack->GetDefinition()->GetParticleName()
385  << " " << aTrack->GetKineticEnergy()
386  << " Id=" << aTrack->GetTrackID()
387  << " IdP=" << aTrack->GetParentID();
388  const G4VProcess* pr = aTrack->GetCreatorProcess();
389  if(pr) std::cout << " from " << pr->GetProcessName();
390  if(reg) std::cout << " in " << reg->GetName()
391  << " trackInfo " << aTrack->GetUserInformation();
392  std::cout << std::endl;
393  }
394  */
395  }
396 #ifdef DebugLog
397  LogDebug("SimG4CoreApplication") << "StackingAction:Classify Track "
398  << aTrack->GetTrackID() << " Parent "
399  << aTrack->GetParentID() << " Type "
400  << aTrack->GetDefinition()->GetParticleName()
401  << " K.E. " << aTrack->GetKineticEnergy()/MeV
402  << " MeV from process/subprocess "
403  << aTrack->GetCreatorProcess()->GetProcessType()
404  << "|"
405  <<aTrack->GetCreatorProcess()->GetProcessSubType()
406  << " as " << classification << " Flag " << flag;
407 #endif
408 
409  return classification;
410 }
411 
413 
415 
417 {
418  // Russian roulette
419  const G4RegionStore * rs = G4RegionStore::GetInstance();
420  std::vector<G4Region*>::const_iterator rcite;
421  std::vector<std::string>::const_iterator rd;
422 
423  for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
424  const G4Region* reg = (*rcite);
425  G4String rname = reg->GetName();
426  if ((gRusRoEcal < 1.0 || nRusRoEcal < 1.0 || pRusRoEcal < 1.0) &&
427  rname == "EcalRegion") {
428  regionEcal = reg;
429  }
430  if ((gRusRoHcal < 1.0 || nRusRoHcal < 1.0 || pRusRoHcal < 1.0) &&
431  rname == "HcalRegion") {
432  regionHcal = reg;
433  }
434  if ((gRusRoMuonIron < 1.0 || nRusRoMuonIron < 1.0 || pRusRoMuonIron < 1.0) &&
435  rname == "MuonIron") {
436  regionMuonIron = reg;
437  }
438  if ((gRusRoPreShower < 1.0 || nRusRoPreShower < 1.0 || pRusRoPreShower < 1.0)
439  && rname == "PreshowerRegion") {
440  regionPreShower = reg;
441  }
442  if ((gRusRoCastor < 1.0 || nRusRoCastor < 1.0 || pRusRoCastor < 1.0) &&
443  rname == "CastorRegion") {
444  regionCastor = reg;
445  }
446  if ((nRusRoWorld < 1.0 || nRusRoWorld < 1.0 || pRusRoWorld < 1.0) &&
447  rname == "DefaultRegionForTheWorld") {
448  regionWorld = reg;
449  }
450 
451  // time limits
452  unsigned int num = maxTimeNames.size();
453  maxTimeRegions.resize(num, 0);
454  if (num > 0) {
455  for (unsigned int i=0; i<num; i++) {
456  if (rname == (G4String)(maxTimeNames[i])) {
457  maxTimeRegions[i] = reg;
458  break;
459  }
460  }
461  }
462  //
463  if(savePDandCinTracker &&
464  (rname == "BeamPipe" || rname == "BeamPipeVacuum"
465  || rname == "TrackerPixelSensRegion"
466  || rname == "TrackerPixelDeadRegion"
467  || rname == "TrackerDeadRegion" || rname == "TrackerSensRegion")) {
468  trackerRegions.push_back(reg);
469  }
470  if(savePDandCinCalo &&
471  (rname == "HcalRegion" || rname == "EcalRegion"
472  || rname == "PreshowerSensRegion" || rname == "PreshowerRegion")) {
473  caloRegions.push_back(reg);
474  }
475  if(savePDandCinMuon &&
476  (rname == "MuonChamber" || rname == "MuonSensitive_RPC"
477  || rname == "MuonIron" || rname == "Muon"
478  || rname == "MuonSensitive_DT-CSC") ) {
479  muonRegions.push_back(reg);
480  }
481  if(rname == "BeamPipeOutside" || rname == "BeamPipeVacuum") {
482  lowdensRegions.push_back(reg);
483  }
484  for (rd = deadRegionNames.begin(); rd != deadRegionNames.end(); ++rd) {
485  if(rname == (G4String)(*rd)) {
486  deadRegions.push_back(reg);
487  }
488  }
489  }
490 }
491 
492 bool StackingAction::isThisRegion(const G4Region* reg,
493  std::vector<const G4Region*>& regions) const
494 {
495  bool flag = false;
496  unsigned int nRegions = regions.size();
497  for(unsigned int i=0; i<nRegions; ++i) {
498  if(reg == regions[i]) {
499  flag = true;
500  break;
501  }
502  }
503  return flag;
504 }
505 
507  const G4Track & mother) const
508 {
509  int flag = 0;
510  TrackInformationExtractor extractor;
511  const TrackInformation & motherInfo(extractor(mother));
512  // Check whether mother is a primary
513  if (motherInfo.isPrimary()) {
514  if (aTrack->GetCreatorProcess()->GetProcessType() == fDecay) {
515  flag = 1;
516  } else if (aTrack->GetCreatorProcess()->GetProcessSubType()==fGammaConversion) {
517  flag = 2;
518  }
519  }
520  return flag;
521 }
522 
523 bool StackingAction::rrApplicable(const G4Track * aTrack,
524  const G4Track & mother) const
525 {
526  bool flag = true;
527  TrackInformationExtractor extractor;
528  const TrackInformation & motherInfo(extractor(mother));
529  // Check whether mother is a primary
530  //if (motherInfo.isPrimary()) {
531  // }
532  int genID = motherInfo.genParticlePID();
533  if(22 == genID || 11 == genID || -11 == genID) { flag = false; }
534 
535  /*
536  //check if the primary was g, e+, e-
537  int genID = motherInfo.genParticlePID();
538  double genp = motherInfo.genParticleP();
539  std::cout << "Track# " << aTrack->GetTrackID() << " "
540  << aTrack->GetDefinition()->GetParticleName()
541  << " E(MeV)= " << aTrack->GetKineticEnergy()/MeV
542  << " mother: " << mother.GetTrackID()
543  << " " << mother.GetDefinition()->GetParticleName()
544  << " E(GeV)= " << mother.GetKineticEnergy()/GeV
545  << " flag: " << flag << " genID= " << genID
546  << " p(GeV)= " << genp/GeV << std::endl;
547  */
548  return flag;
549 }
550 
551 int StackingAction::isItFromPrimary(const G4Track & mother, int flagIn) const
552 {
553  int flag = flagIn;
554  if (flag != 1) {
555  TrackInformationExtractor extractor;
556  const TrackInformation & motherInfo(extractor(mother));
557  if (motherInfo.isPrimary()) { flag = 3; }
558  }
559  return flag;
560 }
561 
562 bool StackingAction::isItLongLived(const G4Track * aTrack) const
563 {
564  bool flag = false;
565  double tofM = maxTrackTime;
566  if (numberTimes > 0) {
567  G4Region* reg =
568  aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
569  for (unsigned int i=0; i<numberTimes; ++i) {
570  if (reg == maxTimeRegions[i]) {
571  tofM = maxTrackTimes[i];
572  break;
573  }
574  }
575  }
576  if (aTrack->GetGlobalTime() > tofM) { flag = true; }
577  return flag;
578 }
579 
580 void StackingAction::printRegions(const std::vector<const G4Region*>& reg,
581  const std::string& word) const
582 {
583  for (unsigned int i=0; i<reg.size(); ++i) {
584  edm::LogInfo("SimG4CoreApplication") << " StackingAction: " << word
585  << "Region " << i
586  << ". " << reg[i]->GetName();
587  }
588 }
#define LogDebug(id)
void primary(const G4Track *aSecondary) const
double nRusRoPreShower
T getParameter(std::string const &) const
NewTrackAction * newTA
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< const G4Region * > lowdensRegions
std::vector< double > maxTrackTimes
bool exists(std::string const &parameterName) const
checks if a parameter exists
double gRusRoPreShower
double nRusRoEnerLim
double pRusRoEnerLim
const G4Region * regionCastor
const G4Region * regionMuonIron
bool rrApplicable(const G4Track *, const G4Track &) const
int isItPrimaryDecayProductOrConversion(const G4Track *, const G4Track &) const
virtual ~StackingAction()
std::vector< const G4Region * > deadRegions
const double MeV
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *aTrack)
std::vector< const G4Region * > muonRegions
std::vector< std::string > maxTimeNames
const G4Region * regionEcal
int genParticlePID() const
unsigned int numberTimes
double pRusRoPreShower
void printRegions(const std::vector< const G4Region * > &reg, const std::string &word) const
void secondary(const G4Track *aSecondary, const G4Track &mother, int) const
StackingAction(const TrackingAction *, const edm::ParameterSet &ps)
double nRusRoMuonIron
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isThisRegion(const G4Region *, std::vector< const G4Region * > &) const
int ke
bool isPrimary() const
bool savePDandCinTracker
std::vector< std::string > deadRegionNames
double gRusRoEnerLim
const G4Region * regionHcal
std::vector< const G4Region * > maxTimeRegions
const G4Region * regionPreShower
const TrackingAction * trackAction
int isItFromPrimary(const G4Track &, int) const
double gRusRoMuonIron
std::vector< const G4Region * > trackerRegions
double pRusRoMuonIron
bool isItLongLived(const G4Track *) const
std::vector< const G4Region * > caloRegions
double limitEnergyForVacuum
const G4Region * regionWorld
const G4Track * geant4Track() const