/home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/core/include/RAT/Gsim.hh Source File

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/core/include/RAT/Gsim.hh Source File
Ratpac-two
Gsim.hh
1 #ifndef __RAT_Gsim__
2 #define __RAT_Gsim__
3 
4 #include <G4IonTable.hh>
5 #include <G4Run.hh>
6 #include <G4RunManager.hh>
7 #include <G4String.hh>
8 #include <G4TrajectoryContainer.hh>
9 #include <G4UserEventAction.hh>
10 #include <G4UserRunAction.hh>
11 #include <G4UserTrackingAction.hh>
12 #include <RAT/DS/ChannelStatus.hh>
13 #include <RAT/DS/NestedTubeInfo.hh>
14 #include <RAT/DS/PMTInfo.hh>
15 #include <RAT/DS/Root.hh>
16 #include <RAT/DS/Run.hh>
17 #include <RAT/EventInfo.hh>
18 #include <RAT/GLG4VEventAction.hh>
19 #include <RAT/GeoFiberSensitiveDetectorHit.hh>
20 #include <RAT/Producer.hh>
21 #include <set>
22 
23 class G4RunManager;
24 class GLG4DebugMessenger;
25 
26 namespace RAT {
27 
28 class ProcBlock;
30 class PMTTime;
31 class PMTCharge;
32 
33 int get_pdgcode(const G4PrimaryParticle *p);
34 
35 class G4VisExecutive;
36 
37 class Gsim : public Producer, G4UserRunAction, G4UserEventAction, G4UserTrackingAction {
38  public:
39  Gsim();
40  Gsim(ProcBlock *theMainBlock);
41  virtual ~Gsim();
42 
43  // G4UserRunAction methods
44  virtual void BeginOfRunAction(const G4Run *aRun);
45  virtual void EndOfRunAction(const G4Run *aRun);
46 
47  // G4UserEventAction methods
48  virtual void BeginOfEventAction(const G4Event *anEvent);
49  virtual void EndOfEventAction(const G4Event *anEvent);
50 
51  // G4UserTrackingAction methods
52  virtual void PreUserTrackingAction(const G4Track *aTrack);
53  virtual void PostUserTrackingAction(const G4Track *aTrack);
54 
55  // Creates run description and adds it to the RunStore
56  void MakeRun(int runID);
57 
58  // Convert G4Event into DS::Root
59  void MakeEvent(const G4Event *g4ev, DS::Root *ds);
60 
61  static bool GetFillPointCont() { return FillPointCont; }
62  static void SetFillPointCont(bool on = false) { FillPointCont = on; }
63 
64  // The following methods are used to check whether to store full track info
65  // for a particle with particleName.
66  static void SetStoreParticleTraj(const G4String &particleName, const bool &gDoStore);
67  bool GetStoreParticleTraj(const G4String &particleName);
68  static G4String GetStoreParticleTrajString(const bool &gDoStore);
69 
70  static bool GetStoreOpticalTrackID() { return StoreOpticalTrackID; }
71  static void SetStoreOpticalTrackID(bool on = false) { StoreOpticalTrackID = on; }
72 
73  static void SetMaxWallTime(double time) { MaxWallTime = time; }
74 
75  protected:
76  void Init(); // the real constructor
77  void AddMCPhoton(DS::MCPMT *rat_mcpmt, const GLG4HitPhoton *photon, EventInfo *exinfo = NULL,
78  std::string process = "unknown");
79  void AddMCNestedTubeHit(DS::MCNestedTube *rat_mcnt, const GeoFiberSensitiveDetectorHit *hit);
80 
81  /* Storing optical creation track ID and step */
82  void PhotonRecurse(std::vector<int> &PhotonIDs, int trackID, int &parentID, int &firstCreatedID);
83  void SetOpticalPhotonIDs(std::string particle_type, int trackID, int parentID);
84  std::vector<int> OpticalPhotonIDs;
85 
86  G4RunManager *theRunManager;
87  GLG4DebugMessenger *theDebugMessenger;
88  RAT::DS::PMTInfo *fPMTInfo;
89  std::vector<RAT::PMTTime *> fPMTTime; //< PMT transit time/delay calculator (indexed by modeltype)
90  std::vector<RAT::PMTCharge *> fPMTCharge; //< PMT single-pe charge calculator (indexed by modeltype)
91 
92  RAT::DS::NestedTubeInfo *fNestedTubeInfo;
93 
94  RAT::DS::Run *run;
95  int runID;
96  TTimeStamp utc;
97  int maxpe;
98  int nabort;
99 
101  int npmts;
102  double pretriggertime;
103  double eventwindow;
104  std::vector<double> specharge;
105  std::vector<double> transitTime;
106  std::vector<double> fTubeRate;
107  double fNnoise;
108  double noiseRate;
109  double channelEfficiency;
110 
111  std::map<int, std::vector<double>> trackEndMap;
112 
113  bool fInitialStoreTrajectoryState;
114 
115  static bool FillPointCont;
116  static bool StoreOpticalTrackID;
117  static double MaxWallTime;
118  static std::set<G4String> fStoreParticleTraj;
119  static std::set<G4String> fDiscardParticleTraj;
120 
121  G4VisExecutive *theVisExecutive;
122 };
123 
124 } // namespace RAT
125 
126 #endif
Load detector geometry and materials.
Definition: GLG4DebugMessenger.hh:14
Definition: GLG4HitPhoton.hh:30
Definition: MCNestedTube.hh:20
Definition: MCPMT.hh:21
Definition: NestedTubeInfo.hh:19
Definition: PMTInfo.hh:19
Definition: Root.hh:39
Definition: Run.hh:22
Definition: EventInfo.hh:13
Definition: GeoFiberSensitiveDetectorHit.hh:14
Definition: Gsim.hh:37
int npmts
Definition: Gsim.hh:101
void MakeEvent(const G4Event *g4ev, DS::Root *ds)
Definition: Gsim.cc:443
Definition: ProcBlock.hh:33
Definition: Producer.hh:54
Definition: CCCrossSecMessenger.hh:29
Definition: FitPathProc.hh:18