Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-02 02:23:11

0001 #ifndef SimG4Core_StackingAction_H
0002 #define SimG4Core_StackingAction_H
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "SimG4Core/Notification/interface/TrackInformationExtractor.h"
0006 
0007 #include "G4UserStackingAction.hh"
0008 #include "G4Region.hh"
0009 #include "G4Track.hh"
0010 #include "G4LogicalVolume.hh"
0011 
0012 #include <string>
0013 #include <vector>
0014 
0015 class NewTrackAction;
0016 class TrackingAction;
0017 class CMSSteppingVerbose;
0018 
0019 class StackingAction : public G4UserStackingAction {
0020 public:
0021   explicit StackingAction(const TrackingAction*, const edm::ParameterSet& ps, const CMSSteppingVerbose*);
0022 
0023   ~StackingAction() override;
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 G4Track*, 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, killInCaloEfH;
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   NewTrackAction* newTA;
0075   TrackInformationExtractor extractor;
0076 
0077   // Russian roulette regions
0078   const G4Region* regionEcal;
0079   const G4Region* regionHcal;
0080   const G4Region* regionMuonIron;
0081   const G4Region* regionPreShower;
0082   const G4Region* regionCastor;
0083   const G4Region* regionWorld;
0084 
0085   // Russian roulette energy limits
0086   double gRusRoEnerLim;
0087   double nRusRoEnerLim;
0088 
0089   // Russian roulette factors
0090   double gRusRoEcal;
0091   double nRusRoEcal;
0092   double gRusRoHcal;
0093   double nRusRoHcal;
0094   double gRusRoMuonIron;
0095   double nRusRoMuonIron;
0096   double gRusRoPreShower;
0097   double nRusRoPreShower;
0098   double gRusRoCastor;
0099   double nRusRoCastor;
0100   double gRusRoWorld;
0101   double nRusRoWorld;
0102   // flags
0103   bool gRRactive;
0104   bool nRRactive;
0105 };
0106 
0107 #endif