File indexing completed on 2024-04-06 12:30:13
0001 #ifndef SimG4Core_StackingAction_H
0002 #define SimG4Core_StackingAction_H
0003
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005
0006 #include "G4UserStackingAction.hh"
0007 #include "G4Region.hh"
0008 #include "G4Track.hh"
0009 #include "G4LogicalVolume.hh"
0010
0011 #include <string>
0012 #include <vector>
0013
0014 class TrackingAction;
0015 class CMSSteppingVerbose;
0016 class G4VProcess;
0017
0018 class StackingAction : public G4UserStackingAction {
0019 public:
0020 explicit StackingAction(const TrackingAction*, const edm::ParameterSet& ps, const CMSSteppingVerbose*);
0021
0022 ~StackingAction() override = default;
0023
0024 G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack) final;
0025
0026 void NewStage() override;
0027 void PrepareNewEvent() override;
0028
0029 private:
0030 void initPointer();
0031
0032 int isItPrimaryDecayProductOrConversion(const int subtype, const G4Track&) const;
0033
0034 int isItFromPrimary(const G4Track&, int) const;
0035
0036 bool rrApplicable(const G4Track*, const G4Track&) const;
0037
0038 bool isItOutOfTimeWindow(const G4Region*, const double&) const;
0039
0040 bool isThisRegion(const G4Region*, std::vector<const G4Region*>&) const;
0041
0042 void printRegions(const std::vector<const G4Region*>& reg, const std::string& word) const;
0043
0044 private:
0045 bool savePDandCinTracker, savePDandCinCalo;
0046 bool savePDandCinMuon, saveFirstSecondary;
0047 bool savePDandCinAll;
0048 bool killInCalo{false};
0049 bool killInCaloEfH{false};
0050 bool killHeavy, trackNeutrino, killDeltaRay;
0051 bool killExtra;
0052 bool killGamma;
0053 double limitEnergyForVacuum;
0054 double kmaxIon, kmaxNeutron, kmaxProton;
0055 double kmaxGamma;
0056 double maxTrackTime;
0057 double maxTrackTimeForward;
0058 double maxZCentralCMS;
0059 unsigned int numberTimes;
0060 std::vector<double> maxTrackTimes;
0061 std::vector<std::string> maxTimeNames;
0062 std::vector<std::string> deadRegionNames;
0063
0064 std::vector<const G4Region*> maxTimeRegions;
0065 std::vector<const G4Region*> trackerRegions;
0066 std::vector<const G4Region*> muonRegions;
0067 std::vector<const G4Region*> caloRegions;
0068 std::vector<const G4Region*> lowdensRegions;
0069 std::vector<const G4Region*> deadRegions;
0070
0071 G4VSolid* worldSolid;
0072 const TrackingAction* trackAction;
0073 const CMSSteppingVerbose* steppingVerbose;
0074 const G4VProcess* m_Compton{nullptr};
0075
0076
0077 const G4Region* regionEcal{nullptr};
0078 const G4Region* regionHcal{nullptr};
0079 const G4Region* regionMuonIron{nullptr};
0080 const G4Region* regionPreShower{nullptr};
0081 const G4Region* regionCastor{nullptr};
0082 const G4Region* regionZDC{nullptr};
0083 const G4Region* regionHGcal{nullptr};
0084 const G4Region* regionWorld{nullptr};
0085
0086
0087 double gRusRoEnerLim;
0088 double nRusRoEnerLim;
0089
0090
0091 double gRusRoEcal;
0092 double nRusRoEcal;
0093 double gRusRoHcal;
0094 double nRusRoHcal;
0095 double gRusRoMuonIron;
0096 double nRusRoMuonIron;
0097 double gRusRoPreShower;
0098 double nRusRoPreShower;
0099 double gRusRoCastor;
0100 double nRusRoCastor;
0101 double gRusRoZDC;
0102 double nRusRoZDC;
0103 double gRusRoHGcal;
0104 double nRusRoHGcal;
0105 double gRusRoWorld;
0106 double nRusRoWorld;
0107
0108 bool gRRactive{false};
0109 bool nRRactive{false};
0110 };
0111
0112 #endif