test
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 TrackingAction *, 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
 
const TrackingActiontrackAction
 
std::vector< const G4Region * > trackerRegions
 
bool trackNeutrino
 

Detailed Description

Definition at line 17 of file StackingAction.h.

Constructor & Destructor Documentation

StackingAction::StackingAction ( const TrackingAction trka,
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  : 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 }
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
const TrackingAction * trackAction
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 215 of file StackingAction.cc.

References newTA.

216 {
217  delete newTA;
218 }
NewTrackAction * newTA

Member Function Documentation

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

Definition at line 220 of file StackingAction.cc.

References funct::abs(), caloRegions, deadRegions, TrackingAction::geant4Track(), 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(), pRRactive, pRusRoCastor, pRusRoEcal, pRusRoEnerLim, pRusRoHcal, pRusRoMuonIron, pRusRoPreShower, pRusRoWorld, regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, rrApplicable(), saveFirstSecondary, savePDandCinAll, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, NewTrackAction::secondary(), trackAction, trackerRegions, and trackNeutrino.

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 }
#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
int ke
bool savePDandCinTracker
double gRusRoEnerLim
const G4Region * regionHcal
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
void StackingAction::initPointer ( )
private

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

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

References TrackInformation::isPrimary().

Referenced by ClassifyNewTrack().

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 }
bool StackingAction::isItLongLived ( const G4Track *  aTrack) const
private

Definition at line 562 of file StackingAction.cc.

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

Referenced by ClassifyNewTrack().

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

References TrackInformation::isPrimary().

Referenced by ClassifyNewTrack().

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

Definition at line 492 of file StackingAction.cc.

References i.

Referenced by ClassifyNewTrack().

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 }
int i
Definition: DBlmapReader.cc:9
void StackingAction::NewStage ( )

Definition at line 412 of file StackingAction.cc.

412 {}
void StackingAction::PrepareNewEvent ( )

Definition at line 414 of file StackingAction.cc.

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

Definition at line 580 of file StackingAction.cc.

References i.

Referenced by StackingAction().

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 }
int i
Definition: DBlmapReader.cc:9
bool StackingAction::rrApplicable ( const G4Track *  aTrack,
const G4Track &  mother 
) const
private

Definition at line 523 of file StackingAction.cc.

References TrackInformation::genParticlePID().

Referenced by ClassifyNewTrack().

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 }

Member Data Documentation

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

Definition at line 65 of file StackingAction.h.

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

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

Definition at line 60 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

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

Definition at line 67 of file StackingAction.h.

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

bool StackingAction::gRRactive
private

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

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

double StackingAction::gRusRoEnerLim
private

Definition at line 81 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::gRusRoHcal
private

Definition at line 89 of file StackingAction.h.

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

double StackingAction::gRusRoMuonIron
private

Definition at line 92 of file StackingAction.h.

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

double StackingAction::gRusRoPreShower
private

Definition at line 95 of file StackingAction.h.

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

double StackingAction::gRusRoWorld
private

Definition at line 101 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killDeltaRay
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 51 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killInCalo
private

Definition at line 50 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killInCaloEfH
private

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

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

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

Definition at line 59 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

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

Definition at line 62 of file StackingAction.h.

Referenced by initPointer(), and isItLongLived().

double StackingAction::maxTrackTime
private

Definition at line 56 of file StackingAction.h.

Referenced by isItLongLived(), and StackingAction().

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

Definition at line 58 of file StackingAction.h.

Referenced by isItLongLived(), and StackingAction().

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

Definition at line 64 of file StackingAction.h.

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

NewTrackAction* StackingAction::newTA
private

Definition at line 70 of file StackingAction.h.

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

bool StackingAction::nRRactive
private

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

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

double StackingAction::nRusRoEnerLim
private

Definition at line 82 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::nRusRoHcal
private

Definition at line 90 of file StackingAction.h.

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

double StackingAction::nRusRoMuonIron
private

Definition at line 93 of file StackingAction.h.

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

double StackingAction::nRusRoPreShower
private

Definition at line 96 of file StackingAction.h.

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

double StackingAction::nRusRoWorld
private

Definition at line 102 of file StackingAction.h.

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

unsigned int StackingAction::numberTimes
private

Definition at line 57 of file StackingAction.h.

Referenced by isItLongLived(), and StackingAction().

bool StackingAction::pRRactive
private

Definition at line 107 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::pRusRoCastor
private

Definition at line 100 of file StackingAction.h.

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

double StackingAction::pRusRoEcal
private

Definition at line 88 of file StackingAction.h.

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

double StackingAction::pRusRoEnerLim
private

Definition at line 83 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::pRusRoHcal
private

Definition at line 91 of file StackingAction.h.

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

double StackingAction::pRusRoMuonIron
private

Definition at line 94 of file StackingAction.h.

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

double StackingAction::pRusRoPreShower
private

Definition at line 97 of file StackingAction.h.

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

double StackingAction::pRusRoWorld
private

Definition at line 103 of file StackingAction.h.

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

const G4Region* StackingAction::regionCastor
private

Definition at line 77 of file StackingAction.h.

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

const G4Region* StackingAction::regionEcal
private

Definition at line 73 of file StackingAction.h.

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

const G4Region* StackingAction::regionHcal
private

Definition at line 74 of file StackingAction.h.

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

const G4Region* StackingAction::regionMuonIron
private

Definition at line 75 of file StackingAction.h.

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

const G4Region* StackingAction::regionPreShower
private

Definition at line 76 of file StackingAction.h.

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

const G4Region* StackingAction::regionWorld
private

Definition at line 78 of file StackingAction.h.

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

bool StackingAction::saveFirstSecondary
private

Definition at line 48 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::savePDandCinAll
private

Definition at line 49 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::savePDandCinCalo
private

Definition at line 47 of file StackingAction.h.

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

bool StackingAction::savePDandCinMuon
private

Definition at line 48 of file StackingAction.h.

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

bool StackingAction::savePDandCinTracker
private

Definition at line 47 of file StackingAction.h.

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

const TrackingAction* StackingAction::trackAction
private

Definition at line 69 of file StackingAction.h.

Referenced by ClassifyNewTrack().

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

Definition at line 63 of file StackingAction.h.

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

bool StackingAction::trackNeutrino
private

Definition at line 51 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().