CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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

virtual G4ClassificationOfNewTrack ClassifyNewTrack (const G4Track *aTrack)
 
void NewStage ()
 
void PrepareNewEvent ()
 
 StackingAction (const edm::ParameterSet &ps)
 
virtual ~StackingAction ()
 

Private Member Functions

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

Private Attributes

std::vector< const G4Region * > caloRegions
 
std::vector< std::string > deadRegionNames
 
std::vector< const G4Region * > deadRegions
 
bool gRRactive
 
double gRusRoCastor
 
double gRusRoEcal
 
double gRusRoEnerLim
 
double gRusRoHcal
 
double gRusRoMuonIron
 
double gRusRoPreShower
 
double gRusRoWorld
 
bool killDeltaRay
 
bool killGamma
 
bool killHeavy
 
bool killInCalo
 
bool killInCaloEfH
 
double kmaxGamma
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
double limitEnergyForVacuum
 
std::vector< const G4Region * > lowdensRegions
 
std::vector< std::string > maxTimeNames
 
std::vector< const G4Region * > maxTimeRegions
 
double maxTrackTime
 
std::vector< double > maxTrackTimes
 
std::vector< const G4Region * > muonRegions
 
NewTrackActionnewTA
 
bool nRRactive
 
double nRusRoCastor
 
double nRusRoEcal
 
double nRusRoEnerLim
 
double nRusRoHcal
 
double nRusRoMuonIron
 
double nRusRoPreShower
 
double nRusRoWorld
 
unsigned int numberTimes
 
bool pRRactive
 
double pRusRoCastor
 
double pRusRoEcal
 
double pRusRoEnerLim
 
double pRusRoHcal
 
double pRusRoMuonIron
 
double pRusRoPreShower
 
double pRusRoWorld
 
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
 
std::vector< const G4Region * > trackerRegions
 
bool trackNeutrino
 

Detailed Description

Definition at line 16 of file StackingAction.h.

Constructor & Destructor Documentation

StackingAction::StackingAction ( const edm::ParameterSet ps)

Definition at line 20 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, i, initPointer(), killDeltaRay, killGamma, killHeavy, killInCalo, killInCaloEfH, kmaxGamma, kmaxIon, kmaxNeutron, kmaxProton, limitEnergyForVacuum, lowdensRegions, maxTimeNames, maxTrackTime, maxTrackTimes, MeV, muonRegions, newTA, nRRactive, nRusRoCastor, nRusRoEcal, nRusRoEnerLim, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, numberTimes, printRegions(), pRRactive, pRusRoCastor, pRusRoEcal, pRusRoEnerLim, pRusRoHcal, pRusRoMuonIron, pRusRoPreShower, pRusRoWorld, regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, saveFirstSecondary, savePDandCinAll, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, trackerRegions, and trackNeutrino.

21 {
22  trackNeutrino = p.getParameter<bool>("TrackNeutrino");
23  killHeavy = p.getParameter<bool>("KillHeavy");
24  killGamma = p.getParameter<bool>("KillGamma");
25  kmaxGamma = p.getParameter<double>("GammaThreshold")*MeV;
26  kmaxIon = p.getParameter<double>("IonThreshold")*MeV;
27  kmaxProton = p.getParameter<double>("ProtonThreshold")*MeV;
28  kmaxNeutron = p.getParameter<double>("NeutronThreshold")*MeV;
29  killDeltaRay = p.getParameter<bool>("KillDeltaRay");
30  limitEnergyForVacuum = p.getParameter<double>("CriticalEnergyForVacuum")*MeV;
31  maxTrackTime = p.getParameter<double>("MaxTrackTime")*ns;
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");
36  p.getUntrackedParameter<bool>("SaveAllPrimaryDecayProductsAndConversions",
37  true);
39  p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInTracker",
40  false);
42  p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInCalo",
43  false);
45  p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInMuon",
46  false);
48  p.getUntrackedParameter<bool>("SaveFirstLevelSecondary",false);
49  killInCalo = false;
50  killInCaloEfH = false;
51 
52  // Russian Roulette
53  regionEcal = 0;
54  regionHcal = 0;
55  regionMuonIron = 0;
56  regionPreShower= 0;
57  regionCastor = 0;
58  regionWorld = 0;
59 
60  gRusRoEnerLim = p.getParameter<double>("RusRoGammaEnergyLimit")*MeV;
61  nRusRoEnerLim = p.getParameter<double>("RusRoNeutronEnergyLimit")*MeV;
62  pRusRoEnerLim = p.getParameter<double>("RusRoProtonEnergyLimit")*MeV;
63 
64  gRusRoEcal = p.getParameter<double>("RusRoEcalGamma");
65  gRusRoHcal = p.getParameter<double>("RusRoHcalGamma");
66  gRusRoMuonIron = p.getParameter<double>("RusRoMuonIronGamma");
67  gRusRoPreShower = p.getParameter<double>("RusRoPreShowerGamma");
68  gRusRoCastor = p.getParameter<double>("RusRoCastorGamma");
69  gRusRoWorld = p.getParameter<double>("RusRoWorldGamma");
70 
71  nRusRoEcal = p.getParameter<double>("RusRoEcalNeutron");
72  nRusRoHcal = p.getParameter<double>("RusRoHcalNeutron");
73  nRusRoMuonIron = p.getParameter<double>("RusRoMuonIronNeutron");
74  nRusRoPreShower = p.getParameter<double>("RusRoPreShowerNeutron");
75  nRusRoCastor = p.getParameter<double>("RusRoCastorNeutron");
76  nRusRoWorld = p.getParameter<double>("RusRoWorldNeutron");
77 
78  pRusRoEcal = p.getParameter<double>("RusRoEcalProton");
79  pRusRoHcal = p.getParameter<double>("RusRoHcalProton");
80  pRusRoMuonIron = p.getParameter<double>("RusRoMuonIronProton");
81  pRusRoPreShower = p.getParameter<double>("RusRoPreShowerProton");
82  pRusRoCastor = p.getParameter<double>("RusRoCastorProton");
83  pRusRoWorld = p.getParameter<double>("RusRoWorldProton");
84 
85  gRRactive = false;
86  nRRactive = false;
87  pRRactive = false;
88  if(gRusRoEnerLim > 0.0 &&
89  (gRusRoEcal < 1.0 || gRusRoHcal < 1.0 ||
90  gRusRoMuonIron < 1.0 || gRusRoPreShower < 1.0 || gRusRoCastor < 1.0 ||
91  gRusRoWorld < 1.0)) { gRRactive = true; }
92  if(nRusRoEnerLim > 0.0 &&
93  (nRusRoEcal < 1.0 || nRusRoHcal < 1.0 ||
94  nRusRoMuonIron < 1.0 || nRusRoPreShower < 1.0 || nRusRoCastor < 1.0 ||
95  nRusRoWorld < 1.0)) { nRRactive = true; }
96  if(pRusRoEnerLim > 0.0 &&
97  (pRusRoEcal < 1.0 || pRusRoHcal < 1.0 ||
98  pRusRoMuonIron < 1.0 || pRusRoPreShower < 1.0 || pRusRoCastor < 1.0 ||
99  pRusRoWorld < 1.0)) { pRRactive = true; }
100 
101  if ( p.exists("TestKillingOptions") ) {
102  killInCalo = (p.getParameter<edm::ParameterSet>("TestKillingOptions"))
103  .getParameter<bool>("KillInCalo");
104  killInCaloEfH = (p.getParameter<edm::ParameterSet>("TestKillingOptions"))
105  .getParameter<bool>("KillInCaloEfH");
106  edm::LogWarning("SimG4CoreApplication")
107  << " *** Activating special test killing options in StackingAction \n"
108  << " *** Kill secondaries in Calorimetetrs volume = " << killInCalo << "\n"
109  << " *** Kill electromagnetic secondaries from hadrons in Calorimeters volume= "
110  << killInCaloEfH;
111  }
112 
113  initPointer();
114  newTA = new NewTrackAction();
115 
116  edm::LogInfo("SimG4CoreApplication") << "StackingAction initiated with"
117  << " flag for saving decay products in "
118  << " Tracker: " << savePDandCinTracker
119  << " in Calo: " << savePDandCinCalo
120  << " in Muon: " << savePDandCinMuon
121  << " everywhere: " << savePDandCinAll
122  << "\n saveFirstSecondary"
123  << ": " << saveFirstSecondary
124  << " Tracking neutrino flag: "
125  << trackNeutrino
126  << " Kill Delta Ray flag: "
127  << killDeltaRay
128  << " Kill hadrons/ions flag: "
129  << killHeavy;
130 
131 
132  if(killHeavy) {
133  edm::LogInfo("SimG4CoreApplication") << "StackingAction kill protons below "
134  << kmaxProton/MeV <<" MeV, neutrons below "
135  << kmaxNeutron/MeV << " MeV and ions"
136  << " below " << kmaxIon/MeV << " MeV";
137  }
138 
139  edm::LogInfo("SimG4CoreApplication") << "StackingAction kill tracks with "
140  << "time larger than " << maxTrackTime/ns
141  << " ns ";
142  numberTimes = maxTimeNames.size();
143  if(0 < numberTimes) {
144  for (unsigned int i=0; i<numberTimes; ++i) {
145  edm::LogInfo("SimG4CoreApplication") << "StackingAction MaxTrackTime for "
146  << maxTimeNames[i] << " is "
147  << maxTrackTimes[i] << " ns ";
148  maxTrackTimes[i] *= ns;
149  }
150  }
151  if(limitEnergyForVacuum > 0.0) {
152  edm::LogInfo("SimG4CoreApplication")
153  << "StackingAction LowDensity regions - kill if E < "
154  << limitEnergyForVacuum/MeV << " MeV";
155  printRegions(lowdensRegions,"LowDensity");
156  }
157  if(deadRegions.size() > 0.0) {
158  edm::LogInfo("SimG4CoreApplication")
159  << "StackingAction Dead regions - kill all secondaries ";
160  printRegions(deadRegions, "Dead");
161  }
162  if(gRRactive) {
163  edm::LogInfo("SimG4CoreApplication")
164  << "StackingAction: "
165  << "Russian Roulette for gamma Elimit(MeV)= "
166  << gRusRoEnerLim/MeV << "\n"
167  << " ECAL Prob= " << gRusRoEcal << "\n"
168  << " HCAL Prob= " << gRusRoHcal << "\n"
169  << " MuonIron Prob= " << gRusRoMuonIron << "\n"
170  << " PreShower Prob= " << gRusRoPreShower << "\n"
171  << " CASTOR Prob= " << gRusRoCastor << "\n"
172  << " World Prob= " << gRusRoWorld;
173  }
174  if(nRRactive) {
175  edm::LogInfo("SimG4CoreApplication")
176  << "StackingAction: "
177  << "Russian Roulette for neutron Elimit(MeV)= "
178  << nRusRoEnerLim/MeV << "\n"
179  << " ECAL Prob= " << nRusRoEcal << "\n"
180  << " HCAL Prob= " << nRusRoHcal << "\n"
181  << " MuonIron Prob= " << nRusRoMuonIron << "\n"
182  << " PreShower Prob= " << nRusRoPreShower << "\n"
183  << " CASTOR Prob= " << nRusRoCastor << "\n"
184  << " World Prob= " << nRusRoWorld;
185  }
186  if(pRRactive) {
187  edm::LogInfo("SimG4CoreApplication")
188  << "StackingAction: "
189  << "Russian Roulette for proton Elimit(MeV)= "
190  << pRusRoEnerLim/MeV << "\n"
191  << " ECAL Prob= " << pRusRoEcal << "\n"
192  << " HCAL Prob= " << pRusRoHcal << "\n"
193  << " MuonIron Prob= " << pRusRoMuonIron << "\n"
194  << " PreShower Prob= " << pRusRoPreShower << "\n"
195  << " CASTOR Prob= " << pRusRoCastor << "\n"
196  << " World Prob= " << pRusRoWorld;
197  }
198 
199  if(savePDandCinTracker) {
200  edm::LogInfo("SimG4CoreApplication") << "StackingAction Tracker regions: ";
201  printRegions(trackerRegions,"Tracker");
202  }
203  if(savePDandCinCalo) {
204  edm::LogInfo("SimG4CoreApplication") << "StackingAction Calo regions: ";
205  printRegions(caloRegions, "Calo");
206  }
207  if(savePDandCinMuon) {
208  edm::LogInfo("SimG4CoreApplication") << "StackingAction Muon regions: ";
209  printRegions(muonRegions,"Muon");
210  }
211 }
double nRusRoPreShower
NewTrackAction * newTA
int i
Definition: DBlmapReader.cc:9
std::vector< const G4Region * > lowdensRegions
std::vector< double > maxTrackTimes
double gRusRoPreShower
double nRusRoEnerLim
double pRusRoEnerLim
const G4Region * regionCastor
const G4Region * regionMuonIron
std::vector< const G4Region * > deadRegions
const double MeV
std::vector< const G4Region * > muonRegions
std::vector< std::string > maxTimeNames
const G4Region * regionEcal
unsigned int numberTimes
double pRusRoPreShower
void printRegions(const std::vector< const G4Region * > &reg, const std::string &word) const
double nRusRoMuonIron
bool savePDandCinTracker
std::vector< std::string > deadRegionNames
double gRusRoEnerLim
const G4Region * regionHcal
const G4Region * regionPreShower
double gRusRoMuonIron
std::vector< const G4Region * > trackerRegions
double pRusRoMuonIron
std::vector< const G4Region * > caloRegions
double limitEnergyForVacuum
const G4Region * regionWorld
StackingAction::~StackingAction ( )
virtual

Definition at line 213 of file StackingAction.cc.

References newTA.

214 {
215  delete newTA;
216 }
NewTrackAction * newTA

Member Function Documentation

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

Definition at line 218 of file StackingAction.cc.

References funct::abs(), caloRegions, deadRegions, archive::flag, gRRactive, gRusRoCastor, gRusRoEcal, gRusRoEnerLim, gRusRoHcal, gRusRoMuonIron, gRusRoPreShower, gRusRoWorld, isItFromPrimary(), isItLongLived(), isItPrimaryDecayProductOrConversion(), isThisRegion(), ke, killDeltaRay, killGamma, killHeavy, killInCalo, killInCaloEfH, kmaxGamma, kmaxIon, kmaxNeutron, kmaxProton, limitEnergyForVacuum, LogDebug, lowdensRegions, MeV, muonRegions, newTA, nRRactive, nRusRoCastor, nRusRoEcal, nRusRoEnerLim, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, NewTrackAction::primary(), mix_2012_Summer_inTimeOnly_cff::prob, pRRactive, pRusRoCastor, pRusRoEcal, pRusRoEnerLim, pRusRoHcal, pRusRoMuonIron, pRusRoPreShower, pRusRoWorld, regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, rrApplicable(), saveFirstSecondary, savePDandCinAll, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, NewTrackAction::secondary(), CurrentG4Track::track(), trackerRegions, and trackNeutrino.

219 {
220  // G4 interface part
221  G4ClassificationOfNewTrack classification = fUrgent;
222  if (aTrack->GetCreatorProcess()==0 || aTrack->GetParentID()==0) {
223  /*
224  std::cout << "StackingAction: primary weight= "
225  << aTrack->GetWeight() << " "
226  << aTrack->GetDefinition()->GetParticleName()
227  << " " << aTrack->GetKineticEnergy()
228  << " Id=" << aTrack->GetTrackID()
229  << " trackInfo " << aTrack->GetUserInformation()
230  << std::endl;
231  */
232  newTA->primary(aTrack);
233  /*
234  if (!trackNeutrino) {
235  int pdg = std::abs(aTrack->GetDefinition()->GetPDGEncoding());
236  if (pdg == 12 || pdg == 14 || pdg == 16 || pdg == 18) {
237  classification = fKill;
238  }
239  }
240  */
241  } else if (aTrack->GetTouchable() == 0) {
242  edm::LogError("SimG4CoreApplication")
243  << "StackingAction: no touchable for track " << aTrack->GetTrackID()
244  << " from " << aTrack->GetParentID()
245  << " with PDG code " << aTrack->GetDefinition()->GetParticleName();
246  classification = fKill;
247  } else {
248  int pdg = aTrack->GetDefinition()->GetPDGEncoding();
249  double ke = aTrack->GetKineticEnergy();
250 
251  if (aTrack->GetTrackStatus() == fStopAndKill) { classification = fKill; }
252  if (killHeavy && classification != fKill) {
253  if (((pdg/1000000000 == 1) && (((pdg/10000)%100) > 0) &&
254  (((pdg/10)%100) > 0) && (ke<kmaxIon)) ||
255  ((pdg == 2212) && (ke < kmaxProton)) ||
256  ((pdg == 2112) && (ke < kmaxNeutron))) { classification = fKill; }
257  }
258  if (!trackNeutrino && classification != fKill) {
259  if (pdg == 12 || pdg == 14 || pdg == 16 || pdg == 18)
260  classification = fKill;
261  }
262  if (classification != fKill && isItLongLived(aTrack))
263  { classification = fKill; }
264 
265  if (classification != fKill && killGamma && pdg == 22 && ke < kmaxGamma)
266  {
267  classification = fKill;
268  //std::cout << "### next gamma killed E(MeV)= " << ke
269  // << " " << aTrack->GetCreatorProcess()->GetProcessName()
270  // << std::endl;
271  }
272 
273 
274  if (killDeltaRay && classification != fKill
275  && aTrack->GetCreatorProcess()->GetProcessSubType() == fIonisation) {
276  classification = fKill;
277  }
278 
279  const G4Region* reg = aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
280  if (killInCalo && classification != fKill
281  && isThisRegion(reg, caloRegions)) {
282  classification = fKill;
283  }
284  if (classification != fKill && ke <= limitEnergyForVacuum
285  && isThisRegion(reg, lowdensRegions)) {
286  classification = fKill;
287  }
288  if (classification != fKill && isThisRegion(reg, deadRegions)) {
289  classification = fKill;
290  }
291 
292  // Russian roulette && MC truth
293  if(classification != fKill) {
294  const G4Track * mother = CurrentG4Track::track();
295  int flag = 0;
296  if(savePDandCinAll) {
297  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
298  } else {
302  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
303  }
304  }
305  if (saveFirstSecondary && 0 == flag) {
306  flag = isItFromPrimary(*mother, flag);
307  }
308 
309  // Russian roulette
310  if(2112 == pdg || 22 == pdg || 2212 == pdg) {
311  double currentWeight = aTrack->GetWeight();
312 
313  if(1.0 >= currentWeight) {
314  double prob = 1.0;
315  double elim = 0.0;
316 
317  // neutron
318  if(nRRactive && pdg == 2112) {
319  elim = nRusRoEnerLim;
320  if(reg == regionEcal) { prob = nRusRoEcal; }
321  else if(reg == regionHcal) { prob = nRusRoHcal; }
322  else if(reg == regionMuonIron) { prob = nRusRoMuonIron; }
323  else if(reg == regionPreShower) { prob = nRusRoPreShower; }
324  else if(reg == regionCastor) { prob = nRusRoCastor; }
325  else if(reg == regionWorld) { prob = nRusRoWorld; }
326 
327  // gamma
328  } else if(gRRactive && pdg == 22) {
329  elim = gRusRoEnerLim;
330  if(reg == regionEcal || reg == regionPreShower) {
331  if(rrApplicable(aTrack, *mother)) {
332  if(reg == regionEcal) { prob = gRusRoEcal; }
333  else { prob = gRusRoPreShower; }
334  }
335  } else {
336  if(reg == regionHcal) { prob = gRusRoHcal; }
337  else if(reg == regionMuonIron) { prob = gRusRoMuonIron; }
338  else if(reg == regionCastor) { prob = gRusRoCastor; }
339  else if(reg == regionWorld) { prob = gRusRoWorld; }
340  }
341 
342  // proton
343  } else if(pRRactive && pdg == 2212) {
344  elim = pRusRoEnerLim;
345  if(reg == regionEcal) { prob = pRusRoEcal; }
346  else if(reg == regionHcal) { prob = pRusRoHcal; }
347  else if(reg == regionMuonIron) { prob = pRusRoMuonIron; }
348  else if(reg == regionPreShower) { prob = pRusRoPreShower; }
349  else if(reg == regionCastor) { prob = pRusRoCastor; }
350  else if(reg == regionWorld) { prob = pRusRoWorld; }
351  }
352  if(prob < 1.0 && aTrack->GetKineticEnergy() < elim) {
353  if(G4UniformRand() < prob) {
354  const_cast<G4Track*>(aTrack)->SetWeight(currentWeight/prob);
355  } else {
356  classification = fKill;
357  }
358  }
359  }
360  }
361 
362  if(classification != fKill && killInCaloEfH) {
363  int pdgMother = mother->GetDefinition()->GetPDGEncoding();
364  if ( (pdg == 22 || std::abs(pdg) == 11) &&
365  (std::abs(pdgMother) < 11 || std::abs(pdgMother) > 17) &&
366  pdgMother != 22 ) {
367  if ( isThisRegion(reg,caloRegions)) {
368  classification = fKill;
369  }
370  }
371  }
372 
373  if (classification != fKill) {
374  newTA->secondary(aTrack, *mother, flag);
375  }
376  }
377  /*
378  double wt2 = aTrack->GetWeight();
379  if(wt2 != 1.0) {
380  G4Region* reg = aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
381  std::cout << "StackingAction: weight= " << wt2 << " "
382  << aTrack->GetDefinition()->GetParticleName()
383  << " " << aTrack->GetKineticEnergy()
384  << " Id=" << aTrack->GetTrackID()
385  << " IdP=" << aTrack->GetParentID();
386  const G4VProcess* pr = aTrack->GetCreatorProcess();
387  if(pr) std::cout << " from " << pr->GetProcessName();
388  if(reg) std::cout << " in " << reg->GetName()
389  << " trackInfo " << aTrack->GetUserInformation();
390  std::cout << std::endl;
391  }
392  */
393  }
394 #ifdef DebugLog
395  LogDebug("SimG4CoreApplication") << "StackingAction:Classify Track "
396  << aTrack->GetTrackID() << " Parent "
397  << aTrack->GetParentID() << " Type "
398  << aTrack->GetDefinition()->GetParticleName()
399  << " K.E. " << aTrack->GetKineticEnergy()/MeV
400  << " MeV from process/subprocess "
401  << aTrack->GetCreatorProcess()->GetProcessType()
402  << "|"
403  <<aTrack->GetCreatorProcess()->GetProcessSubType()
404  << " as " << classification << " Flag " << flag;
405 #endif
406 
407  return classification;
408 }
#define LogDebug(id)
void primary(const G4Track *aSecondary) const
double nRusRoPreShower
NewTrackAction * newTA
std::vector< const G4Region * > lowdensRegions
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
std::vector< const G4Region * > deadRegions
const double MeV
std::vector< const G4Region * > muonRegions
const G4Region * regionEcal
double pRusRoPreShower
void secondary(const G4Track *aSecondary, const G4Track &mother, int) const
double nRusRoMuonIron
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isThisRegion(const G4Region *, std::vector< const G4Region * > &) const
bool savePDandCinTracker
double gRusRoEnerLim
const G4Region * regionHcal
const G4Region * regionPreShower
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
static const G4Track * track()
const G4Region * regionWorld
void StackingAction::initPointer ( )
private

Definition at line 414 of file StackingAction.cc.

References caloRegions, deadRegionNames, deadRegions, gRusRoCastor, gRusRoEcal, gRusRoHcal, gRusRoMuonIron, gRusRoPreShower, i, lowdensRegions, maxTimeNames, maxTimeRegions, muonRegions, nRusRoCastor, nRusRoEcal, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, pileupDistInMC::num, pRusRoCastor, pRusRoEcal, pRusRoHcal, pRusRoMuonIron, pRusRoPreShower, pRusRoWorld, regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, and trackerRegions.

Referenced by StackingAction().

415 {
416  // Russian roulette
417  const G4RegionStore * rs = G4RegionStore::GetInstance();
418  std::vector<G4Region*>::const_iterator rcite;
419  std::vector<std::string>::const_iterator rd;
420 
421  for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
422  const G4Region* reg = (*rcite);
423  G4String rname = reg->GetName();
424  if ((gRusRoEcal < 1.0 || nRusRoEcal < 1.0 || pRusRoEcal < 1.0) &&
425  rname == "EcalRegion") {
426  regionEcal = reg;
427  }
428  if ((gRusRoHcal < 1.0 || nRusRoHcal < 1.0 || pRusRoHcal < 1.0) &&
429  rname == "HcalRegion") {
430  regionHcal = reg;
431  }
432  if ((gRusRoMuonIron < 1.0 || nRusRoMuonIron < 1.0 || pRusRoMuonIron < 1.0) &&
433  rname == "MuonIron") {
434  regionMuonIron = reg;
435  }
436  if ((gRusRoPreShower < 1.0 || nRusRoPreShower < 1.0 || pRusRoPreShower < 1.0)
437  && rname == "PreshowerRegion") {
438  regionPreShower = reg;
439  }
440  if ((gRusRoCastor < 1.0 || nRusRoCastor < 1.0 || pRusRoCastor < 1.0) &&
441  rname == "CastorRegion") {
442  regionCastor = reg;
443  }
444  if ((nRusRoWorld < 1.0 || nRusRoWorld < 1.0 || pRusRoWorld < 1.0) &&
445  rname == "DefaultRegionForTheWorld") {
446  regionWorld = reg;
447  }
448 
449  // time limits
450  unsigned int num = maxTimeNames.size();
451  maxTimeRegions.resize(num, 0);
452  if (num > 0) {
453  for (unsigned int i=0; i<num; i++) {
454  if (rname == (G4String)(maxTimeNames[i])) {
455  maxTimeRegions[i] = reg;
456  break;
457  }
458  }
459  }
460  //
461  if(savePDandCinTracker &&
462  (rname == "BeamPipe" || rname == "BeamPipeVacuum"
463  || rname == "TrackerPixelSensRegion"
464  || rname == "TrackerPixelDeadRegion"
465  || rname == "TrackerDeadRegion" || rname == "TrackerSensRegion")) {
466  trackerRegions.push_back(reg);
467  }
468  if(savePDandCinCalo &&
469  (rname == "HcalRegion" || rname == "EcalRegion"
470  || rname == "PreshowerSensRegion" || rname == "PreshowerRegion")) {
471  caloRegions.push_back(reg);
472  }
473  if(savePDandCinMuon &&
474  (rname == "MuonChamber" || rname == "MuonSensitive_RPC"
475  || rname == "MuonIron" || rname == "Muon"
476  || rname == "MuonSensitive_DT-CSC") ) {
477  muonRegions.push_back(reg);
478  }
479  if(rname == "BeamPipeOutside" || rname == "BeamPipeVacuum") {
480  lowdensRegions.push_back(reg);
481  }
482  for (rd = deadRegionNames.begin(); rd != deadRegionNames.end(); ++rd) {
483  if(rname == (G4String)(*rd)) {
484  deadRegions.push_back(reg);
485  }
486  }
487  }
488 }
double nRusRoPreShower
int i
Definition: DBlmapReader.cc:9
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 pRusRoPreShower
double nRusRoMuonIron
bool savePDandCinTracker
std::vector< std::string > deadRegionNames
const G4Region * regionHcal
std::vector< const G4Region * > maxTimeRegions
const G4Region * regionPreShower
double gRusRoMuonIron
std::vector< const G4Region * > trackerRegions
double pRusRoMuonIron
std::vector< const G4Region * > caloRegions
const G4Region * regionWorld
int StackingAction::isItFromPrimary ( const G4Track &  mother,
int  flagIn 
) const
private

Definition at line 549 of file StackingAction.cc.

References archive::flag, and TrackInformation::isPrimary().

Referenced by ClassifyNewTrack().

550 {
551  int flag = flagIn;
552  if (flag != 1) {
553  TrackInformationExtractor extractor;
554  const TrackInformation & motherInfo(extractor(mother));
555  if (motherInfo.isPrimary()) { flag = 3; }
556  }
557  return flag;
558 }
bool StackingAction::isItLongLived ( const G4Track *  aTrack) const
private

Definition at line 560 of file StackingAction.cc.

References archive::flag, i, maxTimeRegions, maxTrackTime, maxTrackTimes, and numberTimes.

Referenced by ClassifyNewTrack().

561 {
562  bool flag = false;
563  double tofM = maxTrackTime;
564  if (numberTimes > 0) {
565  G4Region* reg =
566  aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
567  for (unsigned int i=0; i<numberTimes; ++i) {
568  if (reg == maxTimeRegions[i]) {
569  tofM = maxTrackTimes[i];
570  break;
571  }
572  }
573  }
574  if (aTrack->GetGlobalTime() > tofM) { flag = true; }
575  return flag;
576 }
int i
Definition: DBlmapReader.cc:9
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 504 of file StackingAction.cc.

References archive::flag, and TrackInformation::isPrimary().

Referenced by ClassifyNewTrack().

506 {
507  int flag = 0;
508  TrackInformationExtractor extractor;
509  const TrackInformation & motherInfo(extractor(mother));
510  // Check whether mother is a primary
511  if (motherInfo.isPrimary()) {
512  if (aTrack->GetCreatorProcess()->GetProcessType() == fDecay) {
513  flag = 1;
514  } else if (aTrack->GetCreatorProcess()->GetProcessSubType()==fGammaConversion) {
515  flag = 2;
516  }
517  }
518  return flag;
519 }
bool StackingAction::isThisRegion ( const G4Region *  reg,
std::vector< const G4Region * > &  regions 
) const
private

Definition at line 490 of file StackingAction.cc.

References archive::flag, and i.

Referenced by ClassifyNewTrack().

492 {
493  bool flag = false;
494  unsigned int nRegions = regions.size();
495  for(unsigned int i=0; i<nRegions; ++i) {
496  if(reg == regions[i]) {
497  flag = true;
498  break;
499  }
500  }
501  return flag;
502 }
int i
Definition: DBlmapReader.cc:9
void StackingAction::NewStage ( )

Definition at line 410 of file StackingAction.cc.

410 {}
void StackingAction::PrepareNewEvent ( )

Definition at line 412 of file StackingAction.cc.

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

Definition at line 578 of file StackingAction.cc.

References i.

Referenced by StackingAction().

580 {
581  for (unsigned int i=0; i<reg.size(); ++i) {
582  edm::LogInfo("SimG4CoreApplication") << " StackingAction: " << word
583  << "Region " << i
584  << ". " << reg[i]->GetName();
585  }
586 }
int i
Definition: DBlmapReader.cc:9
bool StackingAction::rrApplicable ( const G4Track *  aTrack,
const G4Track &  mother 
) const
private

Definition at line 521 of file StackingAction.cc.

References archive::flag, and TrackInformation::genParticlePID().

Referenced by ClassifyNewTrack().

523 {
524  bool flag = true;
525  TrackInformationExtractor extractor;
526  const TrackInformation & motherInfo(extractor(mother));
527  // Check whether mother is a primary
528  //if (motherInfo.isPrimary()) {
529  // }
530  int genID = motherInfo.genParticlePID();
531  if(22 == genID || 11 == genID || -11 == genID) { flag = false; }
532 
533  /*
534  //check if the primary was g, e+, e-
535  int genID = motherInfo.genParticlePID();
536  double genp = motherInfo.genParticleP();
537  std::cout << "Track# " << aTrack->GetTrackID() << " "
538  << aTrack->GetDefinition()->GetParticleName()
539  << " E(MeV)= " << aTrack->GetKineticEnergy()/MeV
540  << " mother: " << mother.GetTrackID()
541  << " " << mother.GetDefinition()->GetParticleName()
542  << " E(GeV)= " << mother.GetKineticEnergy()/GeV
543  << " flag: " << flag << " genID= " << genID
544  << " p(GeV)= " << genp/GeV << std::endl;
545  */
546  return flag;
547 }

Member Data Documentation

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

Definition at line 64 of file StackingAction.h.

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

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

Definition at line 59 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

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

Definition at line 66 of file StackingAction.h.

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

bool StackingAction::gRRactive
private

Definition at line 103 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::gRusRoCastor
private

Definition at line 96 of file StackingAction.h.

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

double StackingAction::gRusRoEcal
private

Definition at line 84 of file StackingAction.h.

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

double StackingAction::gRusRoEnerLim
private

Definition at line 79 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::gRusRoHcal
private

Definition at line 87 of file StackingAction.h.

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

double StackingAction::gRusRoMuonIron
private

Definition at line 90 of file StackingAction.h.

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

double StackingAction::gRusRoPreShower
private

Definition at line 93 of file StackingAction.h.

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

double StackingAction::gRusRoWorld
private

Definition at line 99 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killDeltaRay
private

Definition at line 50 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killGamma
private

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

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::kmaxIon
private

Definition at line 53 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::kmaxNeutron
private

Definition at line 53 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::kmaxProton
private

Definition at line 53 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::limitEnergyForVacuum
private

Definition at line 52 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

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

Definition at line 65 of file StackingAction.h.

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

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

Definition at line 58 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

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

Definition at line 61 of file StackingAction.h.

Referenced by initPointer(), and isItLongLived().

double StackingAction::maxTrackTime
private

Definition at line 55 of file StackingAction.h.

Referenced by isItLongLived(), and StackingAction().

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

Definition at line 57 of file StackingAction.h.

Referenced by isItLongLived(), and StackingAction().

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

Definition at line 63 of file StackingAction.h.

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

NewTrackAction* StackingAction::newTA
private

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

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

double StackingAction::nRusRoEcal
private

Definition at line 85 of file StackingAction.h.

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

double StackingAction::nRusRoEnerLim
private

Definition at line 80 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::nRusRoHcal
private

Definition at line 88 of file StackingAction.h.

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

double StackingAction::nRusRoMuonIron
private

Definition at line 91 of file StackingAction.h.

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

double StackingAction::nRusRoPreShower
private

Definition at line 94 of file StackingAction.h.

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

double StackingAction::nRusRoWorld
private

Definition at line 100 of file StackingAction.h.

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

unsigned int StackingAction::numberTimes
private

Definition at line 56 of file StackingAction.h.

Referenced by isItLongLived(), and StackingAction().

bool StackingAction::pRRactive
private

Definition at line 105 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::pRusRoCastor
private

Definition at line 98 of file StackingAction.h.

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

double StackingAction::pRusRoEcal
private

Definition at line 86 of file StackingAction.h.

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

double StackingAction::pRusRoEnerLim
private

Definition at line 81 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::pRusRoHcal
private

Definition at line 89 of file StackingAction.h.

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

double StackingAction::pRusRoMuonIron
private

Definition at line 92 of file StackingAction.h.

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

double StackingAction::pRusRoPreShower
private

Definition at line 95 of file StackingAction.h.

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

double StackingAction::pRusRoWorld
private

Definition at line 101 of file StackingAction.h.

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

const G4Region* StackingAction::regionCastor
private

Definition at line 75 of file StackingAction.h.

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

const G4Region* StackingAction::regionEcal
private

Definition at line 71 of file StackingAction.h.

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

const G4Region* StackingAction::regionHcal
private

Definition at line 72 of file StackingAction.h.

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

const G4Region* StackingAction::regionMuonIron
private

Definition at line 73 of file StackingAction.h.

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

const G4Region* StackingAction::regionPreShower
private

Definition at line 74 of file StackingAction.h.

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

const G4Region* StackingAction::regionWorld
private

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

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

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