CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
G4Svc.h
Go to the documentation of this file.
1#ifndef G4SIM_G4SVC_H
2#define G4SIM_G4SVC_H
3
4#include "GaudiKernel/Service.h"
5#include "G4Svc/IG4Svc.h"
6#include "GaudiKernel/NTuple.h"
7
8// G4 includes
9#include "G4UImanager.hh"
10
11#ifdef G4VIS_USE
12 #include "G4VisManager.hh"
13#endif
14
15#include <vector>
16#include <string>
19
20// Forward declarations
21template <class TYPE> class SvcFactory;
22
23class G4VUserPhysicsList;
24class G4RunManager;
25class G4SvcRunManager;
26
27// ClassName: G4Svc
28// Description: This service provides access to Geant 4
29//
30
31class G4Svc: public Service, virtual public IG4Svc
32{
33public:
34
35 virtual StatusCode initialize();
36 virtual StatusCode finalize();
37
38 // Query the interfaces.
39 virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface );
40
41 G4RunManager * runMgr();
42
43 // Detector init
44 void SetUserInitialization(G4VUserDetectorConstruction* userInit);
45
46 // Physics init
47 void SetUserInitialization(G4VUserPhysicsList* physInit);
48
49 // User Action
50 void SetUserAction(G4UserRunAction *);
51 void SetUserAction(G4UserEventAction *);
52 void SetUserAction(G4VUserPrimaryGeneratorAction*);
53 void SetUserAction(G4UserStackingAction*);
54 void SetUserAction(G4UserTrackingAction*);
55 void SetUserAction(G4UserSteppingAction*);
56
57 // G4Event
58 const G4Event* GetCurrentEvent() const;
59 const G4Run* GetCurrentRun() const;
60
61#ifdef G4VIS_USE
62 G4VisManager * visMgr() { return p_visMgr; }
63#endif
64 G4UImanager * uiMgr();
65 void StartUISession();
66
67 //for vertex parameters
68 double GetBeamPosX() {return m_beamPosX;}
69 double GetBeamPosY() {return m_beamPosY;}
70 double GetBeamPosZ() {return m_beamPosZ;}
71
72 double GetBeamSizeX() {return m_beamSizeX;}
73 double GetBeamSizeY() {return m_beamSizeY;}
74 double GetBeamSizeZ() {return m_beamSizeZ;}
75
76 double GetBeamShiftPx(){return m_beamShiftPx;}
77 double GetBeamShiftPy(){return m_beamShiftPy;}
78 double GetBeamShiftPz(){return m_beamShiftPz;}
79
80 double GetBeamStartTime() {return m_beamStartTime;}
81 double GetBeamDeltaTime() {return m_beamDeltaTime;}
82 double GetNBunch() {return m_nBunch;}
83 double GetBunchTimeSigma() {return m_bunchTimeSigma;}
84
85 double GetBeamTime() {return m_beamTime;}
86 void SetBeamTime(double value) {m_beamTime = value;}
87 std::string GetMdcNoiseFile(){return m_mdcNoiseFile;}
88
89 double GetBeamAngle() {return m_beamAngle;}
90 bool GetBoostLab() {return m_boostLab;}
91 bool GetSetBeamShift() {return m_setBeamShift;}
92
93 int GetMdcDataInput() { return m_mdcDataInput; }
94 int GetMdcDedxFlag(){return m_mdcDedxFlag;}
95 double GetCgemStripEff(){return m_cgemStripEff;}
96
97 NTuple::Tuple* GetTupleMdc() {return m_tupleMdc;}
98 void SetTupleMdc (NTuple::Tuple* tuple) {m_tupleMdc = tuple;}
99
100 std::string GetCgemNoiseFile(){return m_cgemNoiseFile;}
101 int GetCgemDataInput() { return m_cgemDataInput; }
102 int GetCgemDedxFlag(){return m_cgemDedxFlag;}
103
104 NTuple::Tuple* GetTupleCgem() {return m_tupleCgem;}
105 void SetTupleCgem (NTuple::Tuple* tuple) {m_tupleCgem = tuple;}
106
107 NTuple::Tuple* GetTupleTof1() {return m_tupleTof1;}
108 void SetTupleTof1 (NTuple::Tuple* tuple) {m_tupleTof1 = tuple;}
109
110 NTuple::Tuple* GetTupleTof2() {return m_tupleTof2;}
111 void SetTupleTof2 (NTuple::Tuple* tuple) {m_tupleTof2 = tuple;}
112
113 NTuple::Tuple* GetTupleTof3() {return m_tupleTof3;}
114 void SetTupleTof3 (NTuple::Tuple* tuple) {m_tupleTof3 = tuple;}
115
116 NTuple::Tuple* GetTupleEmc1() {return m_tupleEmc1;}
117 void SetTupleEmc1 (NTuple::Tuple* tuple) {m_tupleEmc1 = tuple;}
118
119 NTuple::Tuple* GetTupleEmc2() {return m_tupleEmc2;}
120 void SetTupleEmc2 (NTuple::Tuple* tuple) {m_tupleEmc2 = tuple;}
121
122 NTuple::Tuple* GetTupleMuc() {return m_tupleMuc;}
123 void SetTupleMuc (NTuple::Tuple* tuple) {m_tupleMuc = tuple;}
124
125 bool MdcRootFlag() {return m_mdcRootFlag;}
126 bool CgemRootFlag() {return m_cgemRootFlag;}
127 bool TofRootFlag() {return m_tofRootFlag;}
128 bool EmcRootFlag() {return m_emcRootFlag;}
129 bool MucRootFlag() {return m_mucRootFlag;}
130
131 bool TofSaturationFlag() {return m_tofSaturationFlag;} // Tof Q Saturation in bhabha events
132
133 bool EmcLightOutput() {return m_emcLightOutput;}
134 double EmcIncoherentNoise() {return m_emcIncoherentNoise;}
135 double EmcCoherentNoise() {return m_emcCoherentNoise;}
136 double EmcNoiseMean() {return m_emcNoiseMean;}
137 double EmcNoiseSigma() {return m_emcNoiseSigma;}
138 double EmcNoiseThreshold() {return m_emcNoiseThreshold;}
139 int EmcNoiseLevel() {return m_emcNoiseLevel;}
140 int EmcTime() {return m_emcTime;}
141
142 int MucNoiseMode() {return m_mucNoiseMode;}
143
144 int LogLevel() {return m_logLevel;}
145
146protected:
147
148 G4Svc( const std::string& name, ISvcLocator* svc );
149
150 // Destructor.
151 virtual ~G4Svc();
152
153public:
154
155 void G4Init();
156
157 // Run initialization, termination and single event generation for G4SimAlg
158 void RunInitialize();
159 void RunTerminate();
160 void SimulateEvents(int);
161
162private:
163
164 // Allow SvcFactory to instantiate the service.
165 friend class SvcFactory<G4Svc>;
166
167 G4SvcRunManager *p_runMgr;
168 G4UImanager *p_uiMgr;
169
170 //std::string m_PhysicsList;
171 //double m_PhysicsCut;
172
173 // Visualization
174 bool m_vis;
175 //std::string m_visType;
176
177 // Initialization macro file
178
179 std::string m_macroName;
180 std::string m_mdcNoiseFile;
181 std::string m_cgemNoiseFile;
182
183#ifdef G4VIS_USE
184 G4VisManager *p_visMgr;
185#endif
186
187 // Save Hits and Tracks in StoreGate
188 //bool m_saveHits;
189 //bool m_saveTracks;
190 int m_logLevel;
191
192 // Verbosity
193 int m_runVerb;
194 int m_eventVerb;
195 int m_trackVerb;
196
197 bool _init;
198
199 bool m_interactiveG4;
200
201 bool m_besGenAction;
202
203 int m_runID;
204
205 int m_mdcDataInput;
206 int m_mdcDedxFlag;
207
208 int m_cgemDataInput;
209 int m_cgemDedxFlag;
210 double m_cgemStripEff;
211
212 //vertex parameters
213 double m_beamPosX;
214 double m_beamPosY;
215 double m_beamPosZ;
216
217 double m_beamSizeX;
218 double m_beamSizeY;
219 double m_beamSizeZ;
220
221 double m_beamStartTime;
222 double m_beamDeltaTime;
223 double m_nBunch;
224
225 double m_bunchTimeSigma;
226 double m_beamTime;
227
228 double m_beamShiftPx;
229 double m_beamShiftPy;
230 double m_beamShiftPz;
231
232 bool m_boostLab;
233 bool m_setBeamShift;
234 double m_beamAngle;
235
236 // MC Monitor
237 NTuple::Tuple* m_tupleMdc;
238 bool m_mdcRootFlag;
239
240 NTuple::Tuple* m_tupleCgem;
241 bool m_cgemRootFlag;
242
243 NTuple::Tuple* m_tupleTof1;
244 NTuple::Tuple* m_tupleTof2;
245 NTuple::Tuple* m_tupleTof3;
246 bool m_tofRootFlag;
247 bool m_tofSaturationFlag;
248
249 NTuple::Tuple* m_tupleEmc1; //digi level
250 NTuple::Tuple* m_tupleEmc2; //event level
251 bool m_emcRootFlag;
252
253 // Emc Crystal Light Output
254 bool m_emcLightOutput;
255 // Incoherent Noise
256 double m_emcIncoherentNoise;
257 // Coherent Noise
258 double m_emcCoherentNoise;
259 // Noise for fast simulation
260 double m_emcNoiseMean;
261 double m_emcNoiseSigma;
262 // Only energy above noise threshold will be recorded
263 double m_emcNoiseThreshold;
264 // Noise Level:
265 // 0: No noise, 1: Only singal crystals have noise,
266 // 2: Only 5x5 matrix has noise, 3: All noise.
267 int m_emcNoiseLevel;
268 // Time
269 int m_emcTime;
270 // Muc noise mode
271 int m_mucNoiseMode;
272
273 NTuple::Tuple* m_tupleMuc;
274 bool m_mucRootFlag;
275
276 RealizationSvc* m_RealizationSvc;
277};
278
279#endif
Definition: G4Svc.h:32
bool EmcLightOutput()
Definition: G4Svc.h:133
bool MdcRootFlag()
Definition: G4Svc.h:125
virtual StatusCode initialize()
Definition: G4Svc.cpp:145
std::string GetMdcNoiseFile()
Definition: G4Svc.h:87
std::string GetCgemNoiseFile()
Definition: G4Svc.h:100
const G4Event * GetCurrentEvent() const
Definition: G4Svc.cpp:198
NTuple::Tuple * GetTupleMdc()
Definition: G4Svc.h:97
void SetTupleTof3(NTuple::Tuple *tuple)
Definition: G4Svc.h:114
void SetTupleMdc(NTuple::Tuple *tuple)
Definition: G4Svc.h:98
void SetTupleCgem(NTuple::Tuple *tuple)
Definition: G4Svc.h:105
double GetBeamSizeZ()
Definition: G4Svc.h:74
void RunTerminate()
Definition: G4Svc.cpp:381
double GetBeamPosX()
Definition: G4Svc.h:68
double EmcNoiseSigma()
Definition: G4Svc.h:137
double EmcNoiseThreshold()
Definition: G4Svc.h:138
double GetBeamPosZ()
Definition: G4Svc.h:70
bool EmcRootFlag()
Definition: G4Svc.h:128
G4UImanager * uiMgr()
Definition: G4Svc.cpp:219
virtual ~G4Svc()
Definition: G4Svc.cpp:114
double GetBeamShiftPz()
Definition: G4Svc.h:78
void RunInitialize()
Definition: G4Svc.cpp:369
double EmcNoiseMean()
Definition: G4Svc.h:136
bool GetBoostLab()
Definition: G4Svc.h:90
bool CgemRootFlag()
Definition: G4Svc.h:126
void StartUISession()
Definition: G4Svc.cpp:288
NTuple::Tuple * GetTupleTof3()
Definition: G4Svc.h:113
G4RunManager * runMgr()
Definition: G4Svc.cpp:128
double EmcIncoherentNoise()
Definition: G4Svc.h:134
int MucNoiseMode()
Definition: G4Svc.h:142
double GetNBunch()
Definition: G4Svc.h:82
double GetBeamAngle()
Definition: G4Svc.h:89
double GetBeamShiftPx()
Definition: G4Svc.h:76
double GetBeamTime()
Definition: G4Svc.h:85
void G4Init()
Definition: G4Svc.cpp:301
void SetTupleMuc(NTuple::Tuple *tuple)
Definition: G4Svc.h:123
double GetBeamDeltaTime()
Definition: G4Svc.h:81
int GetMdcDedxFlag()
Definition: G4Svc.h:94
void SetTupleEmc1(NTuple::Tuple *tuple)
Definition: G4Svc.h:117
double GetBunchTimeSigma()
Definition: G4Svc.h:83
double GetBeamShiftPy()
Definition: G4Svc.h:77
int GetCgemDataInput()
Definition: G4Svc.h:101
void SetTupleEmc2(NTuple::Tuple *tuple)
Definition: G4Svc.h:120
double GetBeamStartTime()
Definition: G4Svc.h:80
bool GetSetBeamShift()
Definition: G4Svc.h:91
bool TofRootFlag()
Definition: G4Svc.h:127
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
Definition: G4Svc.cpp:184
double EmcCoherentNoise()
Definition: G4Svc.h:135
void SimulateEvents(int)
Definition: G4Svc.cpp:386
NTuple::Tuple * GetTupleEmc2()
Definition: G4Svc.h:119
int GetMdcDataInput()
Definition: G4Svc.h:93
void SetTupleTof2(NTuple::Tuple *tuple)
Definition: G4Svc.h:111
double GetCgemStripEff()
Definition: G4Svc.h:95
void SetBeamTime(double value)
Definition: G4Svc.h:86
void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Definition: G4Svc.cpp:228
double GetBeamSizeX()
Definition: G4Svc.h:72
int LogLevel()
Definition: G4Svc.h:144
NTuple::Tuple * GetTupleCgem()
Definition: G4Svc.h:104
int GetCgemDedxFlag()
Definition: G4Svc.h:102
NTuple::Tuple * GetTupleTof2()
Definition: G4Svc.h:110
int EmcNoiseLevel()
Definition: G4Svc.h:139
void SetTupleTof1(NTuple::Tuple *tuple)
Definition: G4Svc.h:108
bool MucRootFlag()
Definition: G4Svc.h:129
virtual StatusCode finalize()
Definition: G4Svc.cpp:172
bool TofSaturationFlag()
Definition: G4Svc.h:131
double GetBeamPosY()
Definition: G4Svc.h:69
const G4Run * GetCurrentRun() const
Definition: G4Svc.cpp:212
double GetBeamSizeY()
Definition: G4Svc.h:73
NTuple::Tuple * GetTupleMuc()
Definition: G4Svc.h:122
NTuple::Tuple * GetTupleEmc1()
Definition: G4Svc.h:116
void SetUserAction(G4UserRunAction *)
Definition: G4Svc.cpp:244
int EmcTime()
Definition: G4Svc.h:140
NTuple::Tuple * GetTupleTof1()
Definition: G4Svc.h:107
Definition: IG4Svc.h:30
Forward and external declarations.
Definition: CalibDataSvc.h:35