|
| 1 | +#ifndef SimG4Core_Phase2StackingAction_H |
| 2 | +#define SimG4Core_Phase2StackingAction_H |
| 3 | + |
| 4 | +#include "FWCore/ParameterSet/interface/ParameterSet.h" |
| 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 | +class CMSG4TrackInterface; |
| 18 | + |
| 19 | +class Phase2StackingAction : public G4UserStackingAction { |
| 20 | +public: |
| 21 | + explicit Phase2StackingAction(const edm::ParameterSet& ps, const CMSSteppingVerbose*); |
| 22 | + |
| 23 | + ~Phase2StackingAction() override = default; |
| 24 | + |
| 25 | + G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack) final; |
| 26 | + |
| 27 | + void NewStage() override; |
| 28 | + void PrepareNewEvent() override; |
| 29 | + |
| 30 | +private: |
| 31 | + void initPointer(); |
| 32 | + |
| 33 | + int isItPrimaryDecayProductOrConversion(const int subtype, const G4Track&) const; |
| 34 | + |
| 35 | + int isItFromPrimary(const G4Track&, int) const; |
| 36 | + |
| 37 | + bool rrApplicable(const G4Track*, const G4Track&) const; |
| 38 | + |
| 39 | + bool isItOutOfTimeWindow(const G4Region*, const double&) const; |
| 40 | + |
| 41 | + bool isThisRegion(const G4Region*, std::vector<const G4Region*>&) const; |
| 42 | + |
| 43 | + void printRegions(const std::vector<const G4Region*>& reg, const std::string& word) const; |
| 44 | + |
| 45 | +private: |
| 46 | + bool savePDandCinTracker, savePDandCinCalo; |
| 47 | + bool savePDandCinMuon, saveFirstSecondary; |
| 48 | + bool savePDandCinAll; |
| 49 | + bool killInCalo{false}; |
| 50 | + bool killInCaloEfH{false}; |
| 51 | + bool killHeavy, trackNeutrino, killDeltaRay; |
| 52 | + bool killExtra; |
| 53 | + bool killGamma; |
| 54 | + double limitEnergyForVacuum; |
| 55 | + double kmaxIon, kmaxNeutron, kmaxProton; |
| 56 | + double kmaxGamma; |
| 57 | + double maxTrackTime; |
| 58 | + double maxTrackTimeForward; |
| 59 | + double maxZCentralCMS; |
| 60 | + unsigned int numberTimes; |
| 61 | + std::vector<double> maxTrackTimes; |
| 62 | + std::vector<std::string> maxTimeNames; |
| 63 | + std::vector<std::string> deadRegionNames; |
| 64 | + |
| 65 | + std::vector<const G4Region*> maxTimeRegions; |
| 66 | + std::vector<const G4Region*> trackerRegions; |
| 67 | + std::vector<const G4Region*> muonRegions; |
| 68 | + std::vector<const G4Region*> caloRegions; |
| 69 | + std::vector<const G4Region*> lowdensRegions; |
| 70 | + std::vector<const G4Region*> deadRegions; |
| 71 | + |
| 72 | + G4VSolid* worldSolid; |
| 73 | + CMSG4TrackInterface* m_trackInterface; |
| 74 | + const CMSSteppingVerbose* steppingVerbose; |
| 75 | + const G4VProcess* m_Compton{nullptr}; |
| 76 | + |
| 77 | + // Russian roulette regions |
| 78 | + const G4Region* regionEcal{nullptr}; |
| 79 | + const G4Region* regionHcal{nullptr}; |
| 80 | + const G4Region* regionMuonIron{nullptr}; |
| 81 | + const G4Region* regionPreShower{nullptr}; |
| 82 | + const G4Region* regionCastor{nullptr}; |
| 83 | + const G4Region* regionZDC{nullptr}; |
| 84 | + const G4Region* regionHGcal{nullptr}; |
| 85 | + const G4Region* regionWorld{nullptr}; |
| 86 | + |
| 87 | + // Russian roulette energy limits |
| 88 | + double gRusRoEnerLim; |
| 89 | + double nRusRoEnerLim; |
| 90 | + |
| 91 | + // Russian roulette factors |
| 92 | + double gRusRoEcal; |
| 93 | + double nRusRoEcal; |
| 94 | + double gRusRoHcal; |
| 95 | + double nRusRoHcal; |
| 96 | + double gRusRoMuonIron; |
| 97 | + double nRusRoMuonIron; |
| 98 | + double gRusRoPreShower; |
| 99 | + double nRusRoPreShower; |
| 100 | + double gRusRoCastor; |
| 101 | + double nRusRoCastor; |
| 102 | + double gRusRoZDC; |
| 103 | + double nRusRoZDC; |
| 104 | + double gRusRoHGcal; |
| 105 | + double nRusRoHGcal; |
| 106 | + double gRusRoWorld; |
| 107 | + double nRusRoWorld; |
| 108 | + // flags |
| 109 | + bool gRRactive{false}; |
| 110 | + bool nRRactive{false}; |
| 111 | +}; |
| 112 | + |
| 113 | +#endif |
0 commit comments