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 class G4VProcess;
19 
20 class StackingAction : public G4UserStackingAction {
21 public:
22  explicit StackingAction(const TrackingAction*, const edm::ParameterSet& ps, const CMSSteppingVerbose*);
23 
24  ~StackingAction() override;
25 
26  G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack) final;
27 
28  void NewStage() override;
29  void PrepareNewEvent() override;
30 
31 private:
32  void initPointer();
33 
34  int isItPrimaryDecayProductOrConversion(const int subtype, const G4Track&) const;
35 
36  int isItFromPrimary(const G4Track&, int) const;
37 
38  bool rrApplicable(const G4Track*, const G4Track&) const;
39 
40  bool isItOutOfTimeWindow(const G4Region*, const double&) const;
41 
42  bool isThisRegion(const G4Region*, std::vector<const G4Region*>&) const;
43 
44  void printRegions(const std::vector<const G4Region*>& reg, const std::string& word) const;
45 
46 private:
50  bool killInCalo{false};
51  bool killInCaloEfH{false};
53  bool killExtra;
54  bool killGamma;
57  double kmaxGamma;
58  double maxTrackTime;
61  unsigned int numberTimes;
62  std::vector<double> maxTrackTimes;
63  std::vector<std::string> maxTimeNames;
64  std::vector<std::string> deadRegionNames;
65 
66  std::vector<const G4Region*> maxTimeRegions;
67  std::vector<const G4Region*> trackerRegions;
68  std::vector<const G4Region*> muonRegions;
69  std::vector<const G4Region*> caloRegions;
70  std::vector<const G4Region*> lowdensRegions;
71  std::vector<const G4Region*> deadRegions;
72 
73  G4VSolid* worldSolid;
76  const G4VProcess* m_Compton{nullptr};
79 
80  // Russian roulette regions
81  const G4Region* regionEcal{nullptr};
82  const G4Region* regionHcal{nullptr};
83  const G4Region* regionMuonIron{nullptr};
84  const G4Region* regionPreShower{nullptr};
85  const G4Region* regionCastor{nullptr};
86  const G4Region* regionWorld{nullptr};
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{false};
107  bool nRRactive{false};
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
double maxZCentralCMS
void PrepareNewEvent() override
std::vector< double > maxTrackTimes
TrackInformationExtractor extractor
bool rrApplicable(const G4Track *, const G4Track &) const
double gRusRoPreShower
double nRusRoEnerLim
const G4Region * regionCastor
const G4Region * regionMuonIron
int isItFromPrimary(const G4Track &, int) const
std::vector< const G4Region * > deadRegions
const G4VProcess * m_Compton
const CMSSteppingVerbose * steppingVerbose
uint64_t word
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 isItOutOfTimeWindow(const G4Region *, const double &) const
bool isThisRegion(const G4Region *, std::vector< const G4Region *> &) const
bool savePDandCinTracker
std::vector< std::string > deadRegionNames
double gRusRoEnerLim
const G4Region * regionHcal
std::vector< const G4Region * > maxTimeRegions
double maxTrackTimeForward
const G4Region * regionPreShower
const TrackingAction * trackAction
double gRusRoMuonIron
std::vector< const G4Region * > trackerRegions
int isItPrimaryDecayProductOrConversion(const int subtype, const G4Track &) const
std::vector< const G4Region * > caloRegions
double limitEnergyForVacuum
const G4Region * regionWorld