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 (EventAction *e, const edm::ParameterSet &ps)
 
virtual ~StackingAction ()
 

Private Member Functions

void initPointer ()
 
bool isItLongLived (const G4Track *) const
 
int isItPrimaryDecayProductOrConversion (const G4Track *, const G4Track &) const
 
bool isThisVolume (const G4VTouchable *, std::vector< G4LogicalVolume * > &) const
 
bool rrApplicable (const G4Track *, const G4Track &) const
 

Private Attributes

std::vector< G4LogicalVolume * > calo
 
EventActioneventAction_
 
bool gRRactive
 
double gRusRoCastor
 
double gRusRoEcal
 
double gRusRoEnerLim
 
double gRusRoHcal
 
double gRusRoMuonIron
 
double gRusRoPreShower
 
double gRusRoWorld
 
bool killDeltaRay
 
bool killHeavy
 
bool killInCalo
 
bool killInCaloEfH
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
std::vector< std::string > maxTimeNames
 
std::vector< G4Region * > maxTimeRegions
 
double maxTrackTime
 
std::vector< double > maxTrackTimes
 
std::vector< G4LogicalVolume * > muon
 
NewTrackActionnewTA
 
bool nRRactive
 
double nRusRoCastor
 
double nRusRoEcal
 
double nRusRoEnerLim
 
double nRusRoHcal
 
double nRusRoMuonIron
 
double nRusRoPreShower
 
double nRusRoWorld
 
bool pRRactive
 
double pRusRoCastor
 
double pRusRoEcal
 
double pRusRoEnerLim
 
double pRusRoHcal
 
double pRusRoMuonIron
 
double pRusRoPreShower
 
double pRusRoWorld
 
G4Region * regionCastor
 
G4Region * regionEcal
 
G4Region * regionHcal
 
G4Region * regionMuonIron
 
G4Region * regionPreShower
 
G4Region * regionWorld
 
bool saveFirstSecondary
 
bool savePDandCinCalo
 
bool savePDandCinMuon
 
bool savePDandCinTracker
 
std::vector< G4LogicalVolume * > tracker
 
bool trackNeutrino
 

Detailed Description

Definition at line 17 of file StackingAction.h.

Constructor & Destructor Documentation

StackingAction::StackingAction ( EventAction e,
const edm::ParameterSet ps 
)

Definition at line 21 of file StackingAction.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), gRRactive, gRusRoCastor, gRusRoEcal, gRusRoEnerLim, gRusRoHcal, gRusRoMuonIron, gRusRoPreShower, gRusRoWorld, i, initPointer(), killDeltaRay, killHeavy, killInCalo, killInCaloEfH, kmaxIon, kmaxNeutron, kmaxProton, maxTimeNames, maxTrackTime, maxTrackTimes, newTA, nRRactive, nRusRoCastor, nRusRoEcal, nRusRoEnerLim, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, pRRactive, pRusRoCastor, pRusRoEcal, pRusRoEnerLim, pRusRoHcal, pRusRoMuonIron, pRusRoPreShower, pRusRoWorld, regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, saveFirstSecondary, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, and trackNeutrino.

22  : eventAction_(e)
23 {
24  trackNeutrino = p.getParameter<bool>("TrackNeutrino");
25  killHeavy = p.getParameter<bool>("KillHeavy");
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  maxTrackTime = p.getParameter<double>("MaxTrackTime")*ns;
31  maxTrackTimes = p.getParameter<std::vector<double> >("MaxTrackTimes");
32  for(unsigned int i=0; i<maxTrackTimes.size(); ++i) { maxTrackTimes[i] *= ns; }
33  maxTimeNames = p.getParameter<std::vector<std::string> >("MaxTimeNames");
35  p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInTracker",
36  false);
38  p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInCalo",
39  false);
41  p.getUntrackedParameter<bool>("SavePrimaryDecayProductsAndConversionsInMuon",
42  false);
44  p.getUntrackedParameter<bool>("SaveFirstLevelSecondary",false);
45  killInCalo = false;
46  killInCaloEfH = false;
47 
48  // Russian Roulette
49  regionEcal = 0;
50  regionHcal = 0;
51  regionMuonIron = 0;
52  regionPreShower= 0;
53  regionCastor = 0;
54  regionWorld = 0;
55 
56  gRusRoEnerLim = p.getParameter<double>("RusRoGammaEnergyLimit")*MeV;
57  nRusRoEnerLim = p.getParameter<double>("RusRoNeutronEnergyLimit")*MeV;
58  pRusRoEnerLim = p.getParameter<double>("RusRoProtonEnergyLimit")*MeV;
59 
60  gRusRoEcal = p.getParameter<double>("RusRoEcalGamma");
61  gRusRoHcal = p.getParameter<double>("RusRoHcalGamma");
62  gRusRoMuonIron = p.getParameter<double>("RusRoMuonIronGamma");
63  gRusRoPreShower = p.getParameter<double>("RusRoPreShowerGamma");
64  gRusRoCastor = p.getParameter<double>("RusRoCastorGamma");
65  gRusRoWorld = p.getParameter<double>("RusRoWorldGamma");
66 
67  nRusRoEcal = p.getParameter<double>("RusRoEcalNeutron");
68  nRusRoHcal = p.getParameter<double>("RusRoHcalNeutron");
69  nRusRoMuonIron = p.getParameter<double>("RusRoMuonIronNeutron");
70  nRusRoPreShower = p.getParameter<double>("RusRoPreShowerNeutron");
71  nRusRoCastor = p.getParameter<double>("RusRoCastorNeutron");
72  nRusRoWorld = p.getParameter<double>("RusRoWorldNeutron");
73 
74  pRusRoEcal = p.getParameter<double>("RusRoEcalProton");
75  pRusRoHcal = p.getParameter<double>("RusRoHcalProton");
76  pRusRoMuonIron = p.getParameter<double>("RusRoMuonIronProton");
77  pRusRoPreShower = p.getParameter<double>("RusRoPreShowerProton");
78  pRusRoCastor = p.getParameter<double>("RusRoCastorProton");
79  pRusRoWorld = p.getParameter<double>("RusRoWorldProton");
80 
81  gRRactive = false;
82  nRRactive = false;
83  pRRactive = false;
84  if(gRusRoEcal < 1.0 || gRusRoHcal < 1.0 ||
85  gRusRoMuonIron < 1.0 || gRusRoPreShower < 1.0 || gRusRoCastor < 1.0 ||
86  gRusRoWorld < 1.0) { gRRactive = true; }
87  if(nRusRoEcal < 1.0 || nRusRoHcal < 1.0 ||
88  nRusRoMuonIron < 1.0 || nRusRoPreShower < 1.0 || nRusRoCastor < 1.0 ||
89  nRusRoWorld < 1.0) { nRRactive = true; }
90  if(pRusRoEcal < 1.0 || pRusRoHcal < 1.0 ||
91  pRusRoMuonIron < 1.0 || pRusRoPreShower < 1.0 || pRusRoCastor < 1.0 ||
92  pRusRoWorld < 1.0) { pRRactive = true; }
93 
94  if ( p.exists("TestKillingOptions") ) {
95 
96  killInCalo = (p.getParameter<edm::ParameterSet>("TestKillingOptions")).getParameter<bool>("KillInCalo");
97  killInCaloEfH = (p.getParameter<edm::ParameterSet>("TestKillingOptions")).getParameter<bool>("KillInCaloEfH");
98  edm::LogWarning("SimG4CoreApplication")
99  << " *** Activating special test killing options in StackingAction \n"
100  << " *** Kill secondaries in Calorimetetrs volume = " << killInCalo << "\n"
101  << " *** Kill electromagnetic secondaries from hadrons in Calorimeters volume = " << killInCaloEfH;
102 
103  }
104 
105  edm::LogInfo("SimG4CoreApplication") << "StackingAction initiated with"
106  << " flag for saving decay products in "
107  << " Tracker: " << savePDandCinTracker
108  << " in Calo: " << savePDandCinCalo
109  << " in Muon: " << savePDandCinMuon
110  << "\n saveFirstSecondary"
111  << ": " << saveFirstSecondary
112  << " Flag for tracking neutrino: "
113  << trackNeutrino << " Killing Flag "
114  << killHeavy << " protons below "
115  << kmaxProton <<" MeV, neutrons below "
116  << kmaxNeutron << " MeV and ions"
117  << " below " << kmaxIon << " MeV\n"
118  << " kill tracks with "
119  << "time larger than " << maxTrackTime
120  << " ns and kill Delta Ray flag set to "
121  << killDeltaRay;
122  for (unsigned int i=0; i<maxTrackTimes.size(); i++) {
123  maxTrackTimes[i] *= ns;
124  edm::LogInfo("SimG4CoreApplication") << "StackingAction::MaxTrackTime for "
125  << maxTimeNames[i] << " is "
126  << maxTrackTimes[i];
127  }
128  if(gRRactive) {
129  edm::LogInfo("SimG4CoreApplication")
130  << "StackingAction: "
131  << "Russian Roulette for gamma Elimit(MeV)= "
132  << nRusRoEnerLim/MeV << "\n"
133  << " ECAL Prob= " << gRusRoEcal << "\n"
134  << " HCAL Prob= " << gRusRoHcal << "\n"
135  << " MuonIron Prob= " << gRusRoMuonIron << "\n"
136  << " PreShower Prob= " << gRusRoPreShower << "\n"
137  << " CASTOR Prob= " << gRusRoCastor << "\n"
138  << " World Prob= " << gRusRoWorld;
139  }
140  if(nRRactive) {
141  edm::LogInfo("SimG4CoreApplication")
142  << "StackingAction: "
143  << "Russian Roulette for neutron Elimit(MeV)= "
144  << nRusRoEnerLim/MeV << "\n"
145  << " ECAL Prob= " << nRusRoEcal << "\n"
146  << " HCAL Prob= " << nRusRoHcal << "\n"
147  << " MuonIron Prob= " << nRusRoMuonIron << "\n"
148  << " PreShower Prob= " << nRusRoPreShower << "\n"
149  << " CASTOR Prob= " << nRusRoCastor << "\n"
150  << " World Prob= " << nRusRoWorld;
151  }
152  if(pRRactive) {
153  edm::LogInfo("SimG4CoreApplication")
154  << "StackingAction: "
155  << "Russian Roulette for proton Elimit(MeV)= "
156  << pRusRoEnerLim/MeV << "\n"
157  << " ECAL Prob= " << pRusRoEcal << "\n"
158  << " HCAL Prob= " << pRusRoHcal << "\n"
159  << " MuonIron Prob= " << pRusRoMuonIron << "\n"
160  << " PreShower Prob= " << pRusRoPreShower << "\n"
161  << " CASTOR Prob= " << pRusRoCastor << "\n"
162  << " World Prob= " << pRusRoWorld;
163  }
164  initPointer();
165  newTA = new NewTrackAction();
166 }
double nRusRoPreShower
NewTrackAction * newTA
int i
Definition: DBlmapReader.cc:9
std::vector< double > maxTrackTimes
G4Region * regionPreShower
double gRusRoPreShower
G4Region * regionHcal
double nRusRoEnerLim
double pRusRoEnerLim
G4Region * regionMuonIron
G4Region * regionEcal
std::vector< std::string > maxTimeNames
double pRusRoPreShower
double nRusRoMuonIron
G4Region * regionCastor
G4Region * regionWorld
EventAction * eventAction_
bool savePDandCinTracker
double gRusRoEnerLim
double gRusRoMuonIron
double pRusRoMuonIron
StackingAction::~StackingAction ( )
virtual

Definition at line 168 of file StackingAction.cc.

References newTA.

169 {
170  delete newTA;
171 }
NewTrackAction * newTA

Member Function Documentation

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

Definition at line 173 of file StackingAction.cc.

References funct::abs(), calo, gRRactive, gRusRoCastor, gRusRoEcal, gRusRoEnerLim, gRusRoHcal, gRusRoMuonIron, gRusRoPreShower, gRusRoWorld, isItLongLived(), isItPrimaryDecayProductOrConversion(), isThisVolume(), ke, killDeltaRay, killHeavy, killInCalo, killInCaloEfH, kmaxIon, kmaxNeutron, kmaxProton, LogDebug, muon, 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(), savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, NewTrackAction::secondary(), CurrentG4Track::track(), tracker, and trackNeutrino.

174 {
175  // G4 interface part
176  G4ClassificationOfNewTrack classification = fUrgent;
177  if (aTrack->GetCreatorProcess()==0 || aTrack->GetParentID()==0) {
178  /*
179  std::cout << "StackingAction: primary weight= "
180  << aTrack->GetWeight() << " "
181  << aTrack->GetDefinition()->GetParticleName()
182  << " " << aTrack->GetKineticEnergy()
183  << " Id=" << aTrack->GetTrackID()
184  << " trackInfo " << aTrack->GetUserInformation()
185  << std::endl;
186  */
187  newTA->primary(aTrack);
188  /*
189  if (!trackNeutrino) {
190  int pdg = std::abs(aTrack->GetDefinition()->GetPDGEncoding());
191  if (pdg == 12 || pdg == 14 || pdg == 16 || pdg == 18) {
192  classification = fKill;
193  }
194  }
195  */
196  } else if (aTrack->GetTouchable() == 0) {
197  edm::LogError("SimG4CoreApplication")
198  << "StackingAction: no touchable for track " << aTrack->GetTrackID()
199  << " from " << aTrack->GetParentID()
200  << " with PDG code " << aTrack->GetDefinition()->GetParticleName();
201  classification = fKill;
202  } else {
203  int pdg = aTrack->GetDefinition()->GetPDGEncoding();
204 
205  if (aTrack->GetTrackStatus() == fStopAndKill) { classification = fKill; }
206  if (killHeavy && classification != fKill) {
207  double ke = aTrack->GetKineticEnergy()/MeV;
208  if (((pdg/1000000000 == 1) && (((pdg/10000)%100) > 0) &&
209  (((pdg/10)%100) > 0) && (ke<kmaxIon)) ||
210  ((pdg == 2212) && (ke < kmaxProton)) ||
211  ((pdg == 2112) && (ke < kmaxNeutron))) { classification = fKill; }
212  }
213  if (!trackNeutrino && classification != fKill) {
214  if (pdg == 12 || pdg == 14 || pdg == 16 || pdg == 18)
215  classification = fKill;
216  }
217  if (classification != fKill && isItLongLived(aTrack))
218  { classification = fKill; }
219  if (killDeltaRay && classification != fKill) {
220  if (aTrack->GetCreatorProcess()->GetProcessType() == fElectromagnetic &&
221  aTrack->GetCreatorProcess()->GetProcessSubType() == fIonisation)
222  classification = fKill;
223  }
224  if (killInCalo && classification != fKill) {
225  if ( isThisVolume(aTrack->GetTouchable(),calo)) {
226  classification = fKill;
227  }
228  }
229  // Russian roulette && MC truth
230  if(classification != fKill) {
231  const G4Track * mother = CurrentG4Track::track();
232  int flag = 0;
233  if (savePDandCinTracker && isThisVolume(aTrack->GetTouchable(),tracker)) {
234  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
235  }
236  if (savePDandCinCalo && 0 == flag
237  && isThisVolume(aTrack->GetTouchable(),calo)) {
238  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
239  }
240  if (savePDandCinMuon && 0 == flag
241  && isThisVolume(aTrack->GetTouchable(),muon)) {
242  flag = isItPrimaryDecayProductOrConversion(aTrack, *mother);
243  }
244 
245  // Russian roulette
246  if(2112 == pdg || 22 == pdg || 2212 == pdg) {
247  double currentWeight = aTrack->GetWeight();
248 
249  if(1.0 >= currentWeight) {
250  double prob = 1.0;
251  double elim = 0.0;
252 
253  // neutron
254  if(nRRactive && pdg == 2112) {
255  elim = nRusRoEnerLim;
256  G4Region* reg = aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
257  if(reg == regionEcal) { prob = nRusRoEcal; }
258  else if(reg == regionHcal) { prob = nRusRoHcal; }
259  else if(reg == regionMuonIron) { prob = nRusRoMuonIron; }
260  else if(reg == regionPreShower) { prob = nRusRoPreShower; }
261  else if(reg == regionCastor) { prob = nRusRoCastor; }
262  else if(reg == regionWorld) { prob = nRusRoWorld; }
263 
264  // gamma
265  } else if(gRRactive && pdg == 22) {
266  elim = gRusRoEnerLim;
267 
268  G4Region* reg = aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
269  if(reg == regionEcal || reg == regionPreShower) {
270  if(rrApplicable(aTrack, *mother)) {
271  if(reg == regionEcal) { prob = gRusRoEcal; }
272  else { prob = gRusRoPreShower; }
273  }
274  } else {
275  if(reg == regionHcal) { prob = gRusRoHcal; }
276  else if(reg == regionMuonIron) { prob = gRusRoMuonIron; }
277  else if(reg == regionCastor) { prob = gRusRoCastor; }
278  else if(reg == regionWorld) { prob = gRusRoWorld; }
279  }
280 
281  // proton
282  } else if(pRRactive && pdg == 2212) {
283  elim = pRusRoEnerLim;
284  G4Region* reg = aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
285  if(reg == regionEcal) { prob = pRusRoEcal; }
286  else if(reg == regionHcal) { prob = pRusRoHcal; }
287  else if(reg == regionMuonIron) { prob = pRusRoMuonIron; }
288  else if(reg == regionPreShower) { prob = pRusRoPreShower; }
289  else if(reg == regionCastor) { prob = pRusRoCastor; }
290  else if(reg == regionWorld) { prob = pRusRoWorld; }
291  }
292  if(prob < 1.0 && aTrack->GetKineticEnergy() < elim) {
293  if(G4UniformRand() < prob) {
294  const_cast<G4Track*>(aTrack)->SetWeight(currentWeight/prob);
295  } else {
296  classification = fKill;
297  }
298  }
299  }
300  }
301 
302  if(classification != fKill && killInCaloEfH) {
303  int pdgMother = mother->GetDefinition()->GetPDGEncoding();
304  if ( (pdg == 22 || std::abs(pdg) == 11) &&
305  (std::abs(pdgMother) < 11 || std::abs(pdgMother) > 17) &&
306  pdgMother != 22 ) {
307  if ( isThisVolume(aTrack->GetTouchable(),calo)) {
308  classification = fKill;
309  }
310  }
311  }
312 
313  if (classification != fKill) {
314  newTA->secondary(aTrack, *mother, flag);
315  }
316  }
317  /*
318  double wt2 = aTrack->GetWeight();
319  if(wt2 != 1.0) {
320  G4Region* reg = aTrack->GetVolume()->GetLogicalVolume()->GetRegion();
321  std::cout << "StackingAction: weight= " << wt2 << " "
322  << aTrack->GetDefinition()->GetParticleName()
323  << " " << aTrack->GetKineticEnergy()
324  << " Id=" << aTrack->GetTrackID()
325  << " IdP=" << aTrack->GetParentID();
326  const G4VProcess* pr = aTrack->GetCreatorProcess();
327  if(pr) std::cout << " from " << pr->GetProcessName();
328  if(reg) std::cout << " in " << reg->GetName()
329  << " trackInfo " << aTrack->GetUserInformation();
330  std::cout << std::endl;
331  }
332  */
333  }
334 #ifdef DebugLog
335  LogDebug("SimG4CoreApplication") << "StackingAction:Classify Track "
336  << aTrack->GetTrackID() << " Parent "
337  << aTrack->GetParentID() << " Type "
338  << aTrack->GetDefinition()->GetParticleName()
339  << " K.E. " << aTrack->GetKineticEnergy()/MeV
340  << " MeV from process/subprocess "
341  << aTrack->GetCreatorProcess()->GetProcessType()
342  << "|"
343  <<aTrack->GetCreatorProcess()->GetProcessSubType()
344  << " as " << classification << " Flag " << flag;
345 #endif
346 
347  return classification;
348 }
#define LogDebug(id)
void primary(const G4Track *aSecondary) const
double nRusRoPreShower
std::vector< G4LogicalVolume * > tracker
NewTrackAction * newTA
G4Region * regionPreShower
double gRusRoPreShower
G4Region * regionHcal
double nRusRoEnerLim
double pRusRoEnerLim
G4Region * regionMuonIron
G4Region * regionEcal
bool rrApplicable(const G4Track *, const G4Track &) const
int isItPrimaryDecayProductOrConversion(const G4Track *, const G4Track &) const
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
G4Region * regionCastor
G4Region * regionWorld
std::vector< G4LogicalVolume * > calo
int ke
bool savePDandCinTracker
double gRusRoEnerLim
std::vector< G4LogicalVolume * > muon
bool isThisVolume(const G4VTouchable *, std::vector< G4LogicalVolume * > &) const
double gRusRoMuonIron
double pRusRoMuonIron
bool isItLongLived(const G4Track *) const
static const G4Track * track()
void StackingAction::initPointer ( )
private

Definition at line 354 of file StackingAction.cc.

References calo, gRusRoCastor, gRusRoEcal, gRusRoHcal, gRusRoMuonIron, gRusRoPreShower, i, killInCalo, killInCaloEfH, maxTimeNames, maxTimeRegions, maxTrackTimes, muon, mergeVDriftHistosByStation::name, nRusRoCastor, nRusRoEcal, nRusRoHcal, nRusRoMuonIron, nRusRoPreShower, nRusRoWorld, pileupDistInMC::num, pRusRoCastor, pRusRoEcal, pRusRoHcal, pRusRoMuonIron, pRusRoPreShower, pRusRoWorld, regionCastor, regionEcal, regionHcal, regionMuonIron, regionPreShower, regionWorld, savePDandCinCalo, savePDandCinMuon, savePDandCinTracker, and tracker.

Referenced by StackingAction().

354  {
355 
356  const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
357  if (lvs) {
358  std::vector<G4LogicalVolume*>::const_iterator lvcite;
359  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
360  if (savePDandCinTracker) {
361  if (strcmp("Tracker",(*lvcite)->GetName().c_str()) == 0) {
362  tracker.push_back(*lvcite);
363  }
364  if (strcmp("BEAM",(*lvcite)->GetName().substr(0,4).c_str()) == 0) {
365  tracker.push_back(*lvcite);
366  }
367  }
369  if (strcmp("CALO",(*lvcite)->GetName().c_str()) == 0) {
370  calo.push_back(*lvcite);
371  }
372  if (strcmp("VCAL",(*lvcite)->GetName().c_str()) == 0) {
373  calo.push_back(*lvcite);
374  }
375  }
376  if (savePDandCinMuon) {
377  if (strcmp("MUON",(*lvcite)->GetName().c_str()) == 0) {
378  muon.push_back(*lvcite);
379  }
380  }
381  }
382  edm::LogInfo("SimG4CoreApplication") << "# of LV for Tracker "
383  << tracker.size() << " for Calo "
384  << calo.size() << " for Muon "
385  << muon.size();
386  for (unsigned int i=0; i<tracker.size(); ++i)
387  edm::LogInfo("SimG4CoreApplication") << "Tracker vol " << i << " name "
388  << tracker[i]->GetName();
389  for (unsigned int i=0; i<calo.size(); ++i)
390  edm::LogInfo("SimG4CoreApplication") << "Calorimeter vol " <<i <<" name "
391  << calo[i]->GetName();
392  for (unsigned int i=0; i<muon.size(); ++i)
393  edm::LogInfo("SimG4CoreApplication") << "Muon vol " << i << " name "
394  << muon[i]->GetName();
395  }
396 
397  std::vector<double> tofs;
398 
399  // Russian roulette
400  const G4RegionStore * rs = G4RegionStore::GetInstance();
401  std::vector<G4Region*>::const_iterator rcite;
402  for (rcite = rs->begin(); rcite != rs->end(); rcite++) {
403  if ((gRusRoEcal < 1.0 || nRusRoEcal < 1.0 || pRusRoEcal < 1.0) &&
404  (*rcite)->GetName() == "EcalRegion") {
405  regionEcal = (*rcite);
406  }
407  if ((gRusRoHcal < 1.0 || nRusRoHcal < 1.0 || pRusRoHcal < 1.0) &&
408  (*rcite)->GetName() == "HcalRegion") {
409  regionHcal = (*rcite);
410  }
411  if ((gRusRoMuonIron < 1.0 || nRusRoMuonIron < 1.0 || pRusRoMuonIron < 1.0) &&
412  (*rcite)->GetName() == "MuonIron") {
413  regionMuonIron = (*rcite);
414  }
415  if ((gRusRoPreShower < 1.0 || nRusRoPreShower < 1.0 || pRusRoPreShower < 1.0)
416  && (*rcite)->GetName() == "PreshowerRegion") {
417  regionPreShower = (*rcite);
418  }
419  if ((gRusRoCastor < 1.0 || nRusRoCastor < 1.0 || pRusRoCastor < 1.0) &&
420  (*rcite)->GetName() == "CastorRegion") {
421  regionCastor = (*rcite);
422  }
423  if ((nRusRoWorld < 1.0 || nRusRoWorld < 1.0 || pRusRoWorld < 1.0) &&
424  (*rcite)->GetName() == "DefaultRegionForTheWorld") {
425  regionWorld = (*rcite);
426  }
427 
428  // time limits
429  unsigned int num = maxTimeNames.size();
430  if (num > 0) {
431  for (unsigned int i=0; i<num; i++) {
432  if ((*rcite)->GetName() == (G4String)(maxTimeNames[i])) {
433  maxTimeRegions.push_back(*rcite);
434  tofs.push_back(maxTrackTimes[i]);
435  break;
436  }
437  }
438  }
439  }
440  if(0 < tofs.size()) {
441  for (unsigned int i=0; i<tofs.size(); i++) {
442  maxTrackTimes[i] = tofs[i];
443  G4String name = "Unknown";
444  if (maxTimeRegions[i]) { name = maxTimeRegions[i]->GetName(); }
445  edm::LogInfo("SimG4CoreApplication") << name << " with pointer "
446  << maxTimeRegions[i]<<" KE cut off "
447  << maxTrackTimes[i];
448  }
449  }
450 }
double nRusRoPreShower
std::vector< G4LogicalVolume * > tracker
int i
Definition: DBlmapReader.cc:9
std::vector< G4Region * > maxTimeRegions
std::vector< double > maxTrackTimes
G4Region * regionPreShower
double gRusRoPreShower
G4Region * regionHcal
G4Region * regionMuonIron
G4Region * regionEcal
std::vector< std::string > maxTimeNames
double pRusRoPreShower
double nRusRoMuonIron
G4Region * regionCastor
G4Region * regionWorld
std::vector< G4LogicalVolume * > calo
bool savePDandCinTracker
std::vector< G4LogicalVolume * > muon
double gRusRoMuonIron
double pRusRoMuonIron
bool StackingAction::isItLongLived ( const G4Track *  aTrack) const
private

Definition at line 514 of file StackingAction.cc.

References i, maxTimeRegions, maxTrackTime, maxTrackTimes, and cond::rpcobgas::time.

Referenced by ClassifyNewTrack().

515 {
516  bool flag = false;
517  double time = (aTrack->GetGlobalTime())/nanosecond;
518  double tofM = maxTrackTime;
519  if (maxTimeRegions.size() > 0) {
520  G4Region* reg =
521  aTrack->GetTouchable()->GetVolume(0)->GetLogicalVolume()->GetRegion();
522  for (unsigned int i=0; i<maxTimeRegions.size(); i++) {
523  if (reg == maxTimeRegions[i]) {
524  tofM = maxTrackTimes[i];
525  break;
526  }
527  }
528  }
529  if (time > tofM) { flag = true; }
530  return flag;
531 }
int i
Definition: DBlmapReader.cc:9
std::vector< G4Region * > maxTimeRegions
std::vector< double > maxTrackTimes
int StackingAction::isItPrimaryDecayProductOrConversion ( const G4Track *  aTrack,
const G4Track &  mother 
) const
private

Definition at line 467 of file StackingAction.cc.

References TrackInformation::isPrimary().

Referenced by ClassifyNewTrack().

469 {
470  int flag = 0;
471  TrackInformationExtractor extractor;
472  const TrackInformation & motherInfo(extractor(mother));
473  // Check whether mother is a primary
474  if (motherInfo.isPrimary()) {
475  if (aTrack->GetCreatorProcess()->GetProcessType() == fDecay) {
476  flag = 1;
477  } else if (aTrack->GetCreatorProcess()->GetProcessSubType()==fGammaConversion) {
478  flag = 2;
479  } else {
480  flag = 3;
481  }
482  }
483  return flag;
484 }
bool StackingAction::isThisVolume ( const G4VTouchable *  touch,
std::vector< G4LogicalVolume * > &  lvs 
) const
private

Definition at line 452 of file StackingAction.cc.

References prof2calltree::count, cuy::ii, and testEve_cfg::level.

Referenced by ClassifyNewTrack().

454 {
455  bool flag = false;
456  if (lvs.size() > 0 && touch !=0) {
457  int level = ((touch->GetHistoryDepth())+1);
458  if (level >= 3) {
459  unsigned int ii = (unsigned int)(level - 3);
460  flag = (std::count(lvs.begin(),lvs.end(),
461  (touch->GetVolume(ii)->GetLogicalVolume())) != 0);
462  }
463  }
464  return flag;
465 }
int ii
Definition: cuy.py:588
tuple level
Definition: testEve_cfg.py:34
void StackingAction::NewStage ( )

Definition at line 350 of file StackingAction.cc.

350 {}
void StackingAction::PrepareNewEvent ( )

Definition at line 352 of file StackingAction.cc.

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

Definition at line 486 of file StackingAction.cc.

References TrackInformation::genParticlePID().

Referenced by ClassifyNewTrack().

488 {
489  bool flag = true;
490  TrackInformationExtractor extractor;
491  const TrackInformation & motherInfo(extractor(mother));
492  // Check whether mother is a primary
493  //if (motherInfo.isPrimary()) {
494  // }
495  int genID = motherInfo.genParticlePID();
496  if(22 == genID || 11 == genID || -11 == genID) { flag = false; }
497 
498  /*
499  //check if the primary was g, e+, e-
500  int genID = motherInfo.genParticlePID();
501  double genp = motherInfo.genParticleP();
502  std::cout << "Track# " << aTrack->GetTrackID() << " "
503  << aTrack->GetDefinition()->GetParticleName()
504  << " E(MeV)= " << aTrack->GetKineticEnergy()/MeV
505  << " mother: " << mother.GetTrackID()
506  << " " << mother.GetDefinition()->GetParticleName()
507  << " E(GeV)= " << mother.GetKineticEnergy()/GeV
508  << " flag: " << flag << " genID= " << genID
509  << " p(GeV)= " << genp/GeV << std::endl;
510  */
511  return flag;
512 }

Member Data Documentation

std::vector<G4LogicalVolume*> StackingAction::calo
private

Definition at line 46 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and initPointer().

EventAction* StackingAction::eventAction_
private

Definition at line 36 of file StackingAction.h.

bool StackingAction::gRRactive
private

Definition at line 83 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::gRusRoCastor
private

Definition at line 76 of file StackingAction.h.

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

double StackingAction::gRusRoEcal
private

Definition at line 64 of file StackingAction.h.

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

double StackingAction::gRusRoEnerLim
private

Definition at line 59 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::gRusRoHcal
private

Definition at line 67 of file StackingAction.h.

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

double StackingAction::gRusRoMuonIron
private

Definition at line 70 of file StackingAction.h.

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

double StackingAction::gRusRoPreShower
private

Definition at line 73 of file StackingAction.h.

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

double StackingAction::gRusRoWorld
private

Definition at line 79 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killDeltaRay
private

Definition at line 40 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killHeavy
private

Definition at line 40 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

bool StackingAction::killInCalo
private

Definition at line 39 of file StackingAction.h.

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

bool StackingAction::killInCaloEfH
private

Definition at line 39 of file StackingAction.h.

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

double StackingAction::kmaxIon
private

Definition at line 41 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::kmaxNeutron
private

Definition at line 41 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::kmaxProton
private

Definition at line 41 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

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

Definition at line 44 of file StackingAction.h.

Referenced by initPointer(), and StackingAction().

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

Definition at line 45 of file StackingAction.h.

Referenced by initPointer(), and isItLongLived().

double StackingAction::maxTrackTime
private

Definition at line 42 of file StackingAction.h.

Referenced by isItLongLived(), and StackingAction().

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

Definition at line 43 of file StackingAction.h.

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

std::vector<G4LogicalVolume*> StackingAction::muon
private

Definition at line 46 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and initPointer().

NewTrackAction* StackingAction::newTA
private

Definition at line 48 of file StackingAction.h.

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

bool StackingAction::nRRactive
private

Definition at line 84 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::nRusRoCastor
private

Definition at line 77 of file StackingAction.h.

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

double StackingAction::nRusRoEcal
private

Definition at line 65 of file StackingAction.h.

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

double StackingAction::nRusRoEnerLim
private

Definition at line 60 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::nRusRoHcal
private

Definition at line 68 of file StackingAction.h.

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

double StackingAction::nRusRoMuonIron
private

Definition at line 71 of file StackingAction.h.

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

double StackingAction::nRusRoPreShower
private

Definition at line 74 of file StackingAction.h.

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

double StackingAction::nRusRoWorld
private

Definition at line 80 of file StackingAction.h.

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

bool StackingAction::pRRactive
private

Definition at line 85 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::pRusRoCastor
private

Definition at line 78 of file StackingAction.h.

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

double StackingAction::pRusRoEcal
private

Definition at line 66 of file StackingAction.h.

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

double StackingAction::pRusRoEnerLim
private

Definition at line 61 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().

double StackingAction::pRusRoHcal
private

Definition at line 69 of file StackingAction.h.

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

double StackingAction::pRusRoMuonIron
private

Definition at line 72 of file StackingAction.h.

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

double StackingAction::pRusRoPreShower
private

Definition at line 75 of file StackingAction.h.

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

double StackingAction::pRusRoWorld
private

Definition at line 81 of file StackingAction.h.

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

G4Region* StackingAction::regionCastor
private

Definition at line 55 of file StackingAction.h.

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

G4Region* StackingAction::regionEcal
private

Definition at line 51 of file StackingAction.h.

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

G4Region* StackingAction::regionHcal
private

Definition at line 52 of file StackingAction.h.

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

G4Region* StackingAction::regionMuonIron
private

Definition at line 53 of file StackingAction.h.

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

G4Region* StackingAction::regionPreShower
private

Definition at line 54 of file StackingAction.h.

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

G4Region* StackingAction::regionWorld
private

Definition at line 56 of file StackingAction.h.

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

bool StackingAction::saveFirstSecondary
private

Definition at line 38 of file StackingAction.h.

Referenced by StackingAction().

bool StackingAction::savePDandCinCalo
private

Definition at line 37 of file StackingAction.h.

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

bool StackingAction::savePDandCinMuon
private

Definition at line 38 of file StackingAction.h.

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

bool StackingAction::savePDandCinTracker
private

Definition at line 37 of file StackingAction.h.

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

std::vector<G4LogicalVolume*> StackingAction::tracker
private

Definition at line 46 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and initPointer().

bool StackingAction::trackNeutrino
private

Definition at line 40 of file StackingAction.h.

Referenced by ClassifyNewTrack(), and StackingAction().