Skip to content

Commit 54ea8be

Browse files
authored
Merge pull request #48337 from civanch/update_regions
[SIM] Update handling of G4Regions, improved printouts, added Phase2 stacking action
2 parents 3c8ad1e + fe5a4e7 commit 54ea8be

File tree

6 files changed

+696
-29
lines changed

6 files changed

+696
-29
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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

SimG4Core/Application/interface/RunManagerMT.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class CustomUIsession;
1717
class SimWatcher;
1818
class SimProducer;
1919
class G4SimEvent;
20+
class G4LogicalVolume;
2021

2122
class RunAction;
2223

@@ -87,6 +88,15 @@ class RunManagerMT {
8788

8889
void runForPhase2();
8990

91+
void addRegions();
92+
93+
void addG4Region(const std::vector<G4LogicalVolume*>&,
94+
const std::string& regName,
95+
double cutg,
96+
double cute,
97+
double cutp,
98+
double cuti);
99+
90100
G4MTRunManagerKernel* m_kernel;
91101

92102
CustomUIsession* m_UIsession;

0 commit comments

Comments
 (0)