CMS 3D CMS Logo

StackingAction.h
Go to the documentation of this file.
1 #ifndef SimG4Core_StackingAction_H
2 #define SimG4Core_StackingAction_H
3 
6 
7 #include "G4UserStackingAction.hh"
8 #include "G4Region.hh"
9 #include "G4Track.hh"
10 #include "G4LogicalVolume.hh"
11 
12 #include <string>
13 #include <vector>
14 
15 class NewTrackAction;
16 class TrackingAction;
17 class CMSSteppingVerbose;
18 
19 class StackingAction : public G4UserStackingAction {
20 
21 public:
22  explicit StackingAction(const TrackingAction*, const edm::ParameterSet & ps,
23  const CMSSteppingVerbose*);
24 
25  ~StackingAction() override;
26 
27  G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track * aTrack) final;
28 
29  void NewStage() override;
30  void PrepareNewEvent() override;
31 
32 private:
33 
34  void initPointer();
35 
36  int isItPrimaryDecayProductOrConversion(const G4Track*, const G4Track &) const;
37 
38  int isItFromPrimary(const G4Track &, int) const;
39 
40  bool rrApplicable(const G4Track*, const G4Track&) const;
41 
42  bool isItOutOfTimeWindow(const G4Region*, const G4Track*) const;
43 
44  bool isThisRegion(const G4Region*, std::vector<const G4Region*>&) const;
45 
46  void printRegions(const std::vector<const G4Region*>& reg,
47  const std::string& word) const;
48 
49 private:
50 
56  bool killExtra;
57  bool killGamma;
60  double kmaxGamma;
61  double maxTrackTime;
62  unsigned int numberTimes;
63  std::vector<double> maxTrackTimes;
64  std::vector<std::string> maxTimeNames;
65  std::vector<std::string> deadRegionNames;
66 
67  std::vector<const G4Region*> maxTimeRegions;
68  std::vector<const G4Region*> trackerRegions;
69  std::vector<const G4Region*> muonRegions;
70  std::vector<const G4Region*> caloRegions;
71  std::vector<const G4Region*> lowdensRegions;
72  std::vector<const G4Region*> deadRegions;
73 
74  G4VSolid* worldSolid;
79 
80  // Russian roulette regions
81  const G4Region* regionEcal;
82  const G4Region* regionHcal;
83  const G4Region* regionMuonIron;
84  const G4Region* regionPreShower;
85  const G4Region* regionCastor;
86  const G4Region* regionWorld;
87 
88  // Russian roulette energy limits
89  double gRusRoEnerLim;
90  double nRusRoEnerLim;
91 
92  // Russian roulette factors
93  double gRusRoEcal;
94  double nRusRoEcal;
95  double gRusRoHcal;
96  double nRusRoHcal;
101  double gRusRoCastor;
102  double nRusRoCastor;
103  double gRusRoWorld;
104  double nRusRoWorld;
105  // flags
106  bool gRRactive;
107  bool nRRactive;
108 };
109 
110 #endif
double nRusRoPreShower
NewTrackAction * newTA
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *aTrack) final
StackingAction(const TrackingAction *, const edm::ParameterSet &ps, const CMSSteppingVerbose *)
std::vector< const G4Region * > lowdensRegions
void PrepareNewEvent() override
std::vector< double > maxTrackTimes
TrackInformationExtractor extractor
double gRusRoPreShower
double nRusRoEnerLim
const G4Region * regionCastor
const G4Region * regionMuonIron
bool rrApplicable(const G4Track *, const G4Track &) const
int isItPrimaryDecayProductOrConversion(const G4Track *, const G4Track &) const
std::vector< const G4Region * > deadRegions
const CMSSteppingVerbose * steppingVerbose
std::vector< const G4Region * > muonRegions
std::vector< std::string > maxTimeNames
void NewStage() override
const G4Region * regionEcal
~StackingAction() override
unsigned int numberTimes
void printRegions(const std::vector< const G4Region * > &reg, const std::string &word) const
double nRusRoMuonIron
G4VSolid * worldSolid
bool isThisRegion(const G4Region *, std::vector< const G4Region * > &) const
bool savePDandCinTracker
std::vector< std::string > deadRegionNames
double gRusRoEnerLim
const G4Region * regionHcal
bool isItOutOfTimeWindow(const G4Region *, const G4Track *) const
std::vector< const G4Region * > maxTimeRegions
const G4Region * regionPreShower
const TrackingAction * trackAction
int isItFromPrimary(const G4Track &, int) const
double gRusRoMuonIron
std::vector< const G4Region * > trackerRegions
std::vector< const G4Region * > caloRegions
double limitEnergyForVacuum
const G4Region * regionWorld