G4StationSimulator.h
Go to the documentation of this file.
1 #ifndef _G4StationSimulatorOG_G4StationSimulator_h_
2 #define _G4StationSimulatorOG_G4StationSimulator_h_
3 
5 
6 #include <fwk/VModule.h>
7 
8 #include <utl/TimeDistribution.h>
9 #include <utl/TabulatedFunction.h>
10 
11 #include <sevt/SEvent.h>
12 #include <sevt/StationSimData.h>
13 
14 #include <mevt/MEvent.h>
15 #include <mevt/Counter.h>
16 
17 #include <cevt/CEvent.h>
18 
19 
20 class G4RunManager;
21 class G4UImanager;
22 class G4VisManager;
23 
24 namespace sdet {
25  class Station;
26 }
27 
28 namespace mdet {
29  class Counter;
30 }
31 
32 namespace mevt {
33  class Counter;
34 }
35 
36 namespace G4StationSimulatorOG {
37 
41  };
42 
44  class G4StationStackingAction;
46 
47  // container of station id, weight
48  typedef std::map<int, double> AccumulatedWeights;
49 
50 
66 
67  public:
68  G4StationSimulator() = default;
69  virtual ~G4StationSimulator() = default;
70 
71  fwk::VModule::ResultFlag Init() override;
72  fwk::VModule::ResultFlag Run(evt::Event& event) override;
74 
75  class Setup {
76  // Resource acquisition is initialization (RAII) via object G4StationSimulator::fgCurrent
77  public:
79  {
80  if (fgLock)
81  throw utl::DoesNotComputeException("Setup already locked by another object!");
82  fgLock = true;
83  Clear();
84  }
85 
86  template<class T>
87  Setup(T& x) : Setup() { Set(x); }
88 
89  ~Setup() { Clear(); fgLock = false; }
90 
92 
94 
96 
98 
100 
102 
103  private:
104  static bool fgLock;
105  };
106 
107  class Current {
108  public:
109  // public getters prevent direct assigment to the members
110  int GetStationID() const { return fDetectorStation->GetId(); }
115  utl::Particle& GetParticle() const { return *fParticle; }
116 
117  private:
118  const sdet::Station* fDetectorStation = nullptr;
123 
124  void
126  {
127  fDetectorStation = nullptr;
128  fEventStation = nullptr;
129  fDetectorUMDCounter = nullptr;
130  fEventUMDCounter = nullptr;
131  fParticle = nullptr;
132  }
133 
134  friend class Setup;
135  };
136 
137  private:
138  void ConstructTraces(sevt::Station& station) const;
140  void AddPhoton(const int nPMT, const double peTime) const;
141 
142  // Method to add photons to UMD
143  void AddUMDPhoton(const size_t modId, const size_t pixId, const double peTime) const;
144  // Method to add injected particles to UMD
145  void AddInjectedParticle(const size_t modId, const size_t pixId, const utl::Particle& injectedParticle) const;
146 
147  // Method to add simulation particles to CEvent simulation data
148  void FillRPCSimData(cevt::StationSimData& simData) const;
149 
152 
153  bool IsUMDEnabled() const { return fUMDEnabled; }
154  bool OnlyMuonsInUMD() const { return fUMDOnlyMuons; }
155  bool IsMARTAEnabled() const { return fMARTAEnabled; }
156 
157  // static stuff
159 
160  static bool fgMuCapture;
161 
162  //
163 
164  G4RunManager* fRunManager = nullptr;
165  G4UImanager* fUImanager = nullptr;
166  G4VisManager* fVisManager = nullptr;
168 
169  bool fGeoVisOn = false;
170  bool fTrajVisOn = false;
171  unsigned int fVerbosity = 0;
172  std::string fRenderFile;
174 
175  bool fDetectorConstructed = false;
176  bool fFastMode = false;
177  bool fUMDFastMode = false;
178  bool fUMDFastProp = false;
179  // Injects exclusively (anti)muons in the scintillators
180  // (basically avoids electrons and positrons from ionization that produces further signals, many time as corner-clipping)
181  bool fUMDOnlyMuons = false;
182 
183  double fUMDMuonsCut = 0;
184  double fUMDElectCut = 0;
185  double fUMDGammaCut = 0;
186  double fUMDOtherCut = 0;
187 
188  bool fTrackMode = false;
190  bool fUMDEnabled = false;
191  double fScintYield = 0;
192  bool fMARTAEnabled = false;
193 
194  //G4 Range cut values
195  double fRangeCutDefault = 0;
196  double fRangeCutGamma = 0;
197  double fRangeCutElectron = 0;
198  double fRangeCutPositron = 0;
199  double fRangeCutMuonPlus = 0;
200  double fRangeCutMuonMinus = 0;
202 
204 
205  std::string fEventId;
206 
207  std::string fSimulatorSignature;
208 
210  friend class G4StationFastCerenkov;
211  friend class G4StationConstruction;
212  friend class G4TankPMTAction;
214  friend class G4ScintillatorAction;
215  friend class G4StationPhysicsList;
216  friend class G4StationEventAction;
217  friend class G4UMDScintStripAction;
218  friend class G4SoilAction;
220 
221  REGISTER_MODULE("G4StationSimulatorOG", G4StationSimulator);
222 
223  };
224 
225 }
226 
227 
228 #endif
void AddPhoton(const int nPMT, const double peTime) const
peTime in Auger units!
Station Level Simulated Data
Detector description interface for Station-related data.
fwk::VModule::ResultFlag RunFull(evt::Event &event)
Counter level event data.
const mdet::Counter & GetDetectorUMDCounter() const
Describes a particle for Simulation.
Definition: Particle.h:26
REGISTER_MODULE("G4StationSimulatorOG", G4StationSimulator)
fwk::VModule::ResultFlag Init() override
Initialize: invoked at beginning of run (NOT beginning of event)
void Set(const sdet::Station &s) const
void ConstructTraces(sevt::Station &station) const
class to hold data at Station level
constexpr double s
Definition: AugerUnits.h:163
void AddInjectedParticle(const size_t modId, const size_t pixId, const utl::Particle &injectedParticle) const
class that handles hits to scintillator bars
fwk::VModule::ResultFlag Finish() override
Finish: invoked at end of the run (NOT end of the event)
void FillRPCSimData(cevt::StationSimData &simData) const
Module interface.
Definition: VModule.h:53
Base class for inconsistency/illogicality exceptions.
Root detector of the muon detector hierarchy.
fwk::VModule::ResultFlag Run(evt::Event &event) override
Run: invoked once per event.
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
class that handles Geant4 SD Station simulation adopted from G4TankSimulator
void Set(const mdet::Counter &c) const
class that passes particles to Geant4 particle gun
std::map< int, double > AccumulatedWeights
fwk::VModule::ResultFlag RunFast(evt::Event &event)
int GetId() const
Station ID.
constexpr double m
Definition: AugerUnits.h:121
void AddUMDPhoton(const size_t modId, const size_t pixId, const double peTime) const
Definition: XbArray.h:7

, generated on Tue Sep 26 2023.