CMS 3D CMS Logo

StackingAction.h
Go to the documentation of this file.
1 #ifndef SimG4Core_StackingAction_H
2 #define SimG4Core_StackingAction_H
3 
5 
6 #include "G4UserStackingAction.hh"
7 #include "G4Region.hh"
8 #include "G4Track.hh"
9 #include "G4LogicalVolume.hh"
10 
11 #include <string>
12 #include <vector>
13 
14 class TrackingAction;
15 class CMSSteppingVerbose;
16 class G4VProcess;
17 
18 class StackingAction : public G4UserStackingAction {
19 public:
20  explicit StackingAction(const TrackingAction*, const edm::ParameterSet& ps, const CMSSteppingVerbose*);
21 
22  ~StackingAction() override = default;
23 
24  G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack) final;
25 
26  void NewStage() override;
27  void PrepareNewEvent() override;
28 
29 private:
30  void initPointer();
31 
32  int isItPrimaryDecayProductOrConversion(const int subtype, const G4Track&) const;
33 
34  int isItFromPrimary(const G4Track&, int) const;
35 
36  bool rrApplicable(const G4Track*, const G4Track&) const;
37 
38  bool isItOutOfTimeWindow(const G4Region*, const double&) const;
39 
40  bool isThisRegion(const G4Region*, std::vector<const G4Region*>&) const;
41 
42  void printRegions(const std::vector<const G4Region*>& reg, const std::string& word) const;
43 
44 private:
48  bool killInCalo{false};
49  bool killInCaloEfH{false};
51  bool killExtra;
52  bool killGamma;
55  double kmaxGamma;
56  double maxTrackTime;
59  unsigned int numberTimes;
60  std::vector<double> maxTrackTimes;
61  std::vector<std::string> maxTimeNames;
62  std::vector<std::string> deadRegionNames;
63 
64  std::vector<const G4Region*> maxTimeRegions;
65  std::vector<const G4Region*> trackerRegions;
66  std::vector<const G4Region*> muonRegions;
67  std::vector<const G4Region*> caloRegions;
68  std::vector<const G4Region*> lowdensRegions;
69  std::vector<const G4Region*> deadRegions;
70 
71  G4VSolid* worldSolid;
74  const G4VProcess* m_Compton{nullptr};
75 
76  // Russian roulette regions
77  const G4Region* regionEcal{nullptr};
78  const G4Region* regionHcal{nullptr};
79  const G4Region* regionMuonIron{nullptr};
80  const G4Region* regionPreShower{nullptr};
81  const G4Region* regionCastor{nullptr};
82  const G4Region* regionZDC{nullptr};
83  const G4Region* regionHGcal{nullptr};
84  const G4Region* regionWorld{nullptr};
85 
86  // Russian roulette energy limits
87  double gRusRoEnerLim;
88  double nRusRoEnerLim;
89 
90  // Russian roulette factors
91  double gRusRoEcal;
92  double nRusRoEcal;
93  double gRusRoHcal;
94  double nRusRoHcal;
99  double gRusRoCastor;
100  double nRusRoCastor;
101  double gRusRoZDC;
102  double nRusRoZDC;
103  double gRusRoHGcal;
104  double nRusRoHGcal;
105  double gRusRoWorld;
106  double nRusRoWorld;
107  // flags
108  bool gRRactive{false};
109  bool nRRactive{false};
110 };
111 
112 #endif
double nRusRoPreShower
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
const G4Region * regionZDC
std::vector< double > maxTrackTimes
bool rrApplicable(const G4Track *, const G4Track &) const
double gRusRoPreShower
double nRusRoEnerLim
const G4Region * regionCastor
const G4Region * regionMuonIron
int isItFromPrimary(const G4Track &, int) const
~StackingAction() override=default
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
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
const G4Region * regionHGcal
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