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