CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
Simulation/G4Svc/G4Svc-00-04-01/G4Svc/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>
17#include "RealizationSvc/RealizationSvc.h"
18#include "RealizationSvc/IRealizationSvc.h"
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();
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
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
virtual StatusCode finalize()
void SetUserAction(G4UserTrackingAction *)
virtual ~G4Svc()
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
const G4Event * GetCurrentEvent() const
void SetTupleTof3(NTuple::Tuple *tuple)
virtual StatusCode initialize()
void SetTupleMdc(NTuple::Tuple *tuple)
void SetTupleCgem(NTuple::Tuple *tuple)
void RunTerminate()
G4UImanager * uiMgr()
void RunInitialize()
G4Svc(const std::string &name, ISvcLocator *svc)
void StartUISession()
void SetUserAction(G4UserSteppingAction *)
void SetUserInitialization(G4VUserPhysicsList *physInit)
G4RunManager * runMgr()
void SetUserAction(G4VUserPrimaryGeneratorAction *)
void SetUserAction(G4UserStackingAction *)
void G4Init()
void SetTupleMuc(NTuple::Tuple *tuple)
void SetTupleEmc1(NTuple::Tuple *tuple)
void SetTupleEmc2(NTuple::Tuple *tuple)
void SimulateEvents(int)
void SetTupleTof2(NTuple::Tuple *tuple)
void SetUserAction(G4UserEventAction *)
void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetTupleTof1(NTuple::Tuple *tuple)
const G4Run * GetCurrentRun() const
void SetUserAction(G4UserRunAction *)