BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
Simulation/G4Svc/G4Svc-00-01-52/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
96 NTuple::Tuple* GetTupleMdc() {return m_tupleMdc;}
97 void SetTupleMdc (NTuple::Tuple* tuple) {m_tupleMdc = tuple;}
98
99 NTuple::Tuple* GetTupleTof1() {return m_tupleTof1;}
100 void SetTupleTof1 (NTuple::Tuple* tuple) {m_tupleTof1 = tuple;}
101
102 NTuple::Tuple* GetTupleTof2() {return m_tupleTof2;}
103 void SetTupleTof2 (NTuple::Tuple* tuple) {m_tupleTof2 = tuple;}
104
105 NTuple::Tuple* GetTupleTof3() {return m_tupleTof3;}
106 void SetTupleTof3 (NTuple::Tuple* tuple) {m_tupleTof3 = tuple;}
107
108 NTuple::Tuple* GetTupleEmc1() {return m_tupleEmc1;}
109 void SetTupleEmc1 (NTuple::Tuple* tuple) {m_tupleEmc1 = tuple;}
110
111 NTuple::Tuple* GetTupleEmc2() {return m_tupleEmc2;}
112 void SetTupleEmc2 (NTuple::Tuple* tuple) {m_tupleEmc2 = tuple;}
113
114 NTuple::Tuple* GetTupleMuc() {return m_tupleMuc;}
115 void SetTupleMuc (NTuple::Tuple* tuple) {m_tupleMuc = tuple;}
116
117 bool MdcRootFlag() {return m_mdcRootFlag;}
118 bool TofRootFlag() {return m_tofRootFlag;}
119 bool EmcRootFlag() {return m_emcRootFlag;}
120 bool MucRootFlag() {return m_mucRootFlag;}
121
122 bool TofSaturationFlag() {return m_tofSaturationFlag;} // Tof Q Saturation in bhabha events
123
124 bool EmcLightOutput() {return m_emcLightOutput;}
125 double EmcIncoherentNoise() {return m_emcIncoherentNoise;}
126 double EmcCoherentNoise() {return m_emcCoherentNoise;}
127 double EmcNoiseMean() {return m_emcNoiseMean;}
128 double EmcNoiseSigma() {return m_emcNoiseSigma;}
129 double EmcNoiseThreshold() {return m_emcNoiseThreshold;}
130 int EmcNoiseLevel() {return m_emcNoiseLevel;}
131 int EmcTime() {return m_emcTime;}
132 int EmcElecSaturation(){return m_emcELecSaturation;}
133
134
135 int MucNoiseMode() {return m_mucNoiseMode;}
136
137 int LogLevel() {return m_logLevel;}
138
139protected:
140
141 G4Svc( const std::string& name, ISvcLocator* svc );
142
143 // Destructor.
144 virtual ~G4Svc();
145
146public:
147
148 void G4Init();
149
150 // Run initialization, termination and single event generation for G4SimAlg
153 void SimulateEvents(int);
154
155private:
156
157 // Allow SvcFactory to instantiate the service.
158 friend class SvcFactory<G4Svc>;
159
160 G4SvcRunManager *p_runMgr;
161 G4UImanager *p_uiMgr;
162
163 //std::string m_PhysicsList;
164 //double m_PhysicsCut;
165
166 // Visualization
167 bool m_vis;
168 //std::string m_visType;
169
170 // Initialization macro file
171
172 std::string m_macroName;
173 std::string m_mdcNoiseFile;
174
175#ifdef G4VIS_USE
176 G4VisManager *p_visMgr;
177#endif
178
179 // Save Hits and Tracks in StoreGate
180 //bool m_saveHits;
181 //bool m_saveTracks;
182 int m_logLevel;
183
184 // Verbosity
185 int m_runVerb;
186 int m_eventVerb;
187 int m_trackVerb;
188
189 bool _init;
190
191 bool m_interactiveG4;
192
193 bool m_besGenAction;
194
195 int m_runID;
196
197 int m_mdcDataInput;
198 int m_mdcDedxFlag;
199
200 //vertex parameters
201 double m_beamPosX;
202 double m_beamPosY;
203 double m_beamPosZ;
204
205 double m_beamSizeX;
206 double m_beamSizeY;
207 double m_beamSizeZ;
208
209 double m_beamStartTime;
210 double m_beamDeltaTime;
211 double m_nBunch;
212
213 double m_bunchTimeSigma;
214 double m_beamTime;
215
216 double m_beamShiftPx;
217 double m_beamShiftPy;
218 double m_beamShiftPz;
219
220 bool m_boostLab;
221 bool m_setBeamShift;
222 double m_beamAngle;
223
224 // MC Monitor
225 NTuple::Tuple* m_tupleMdc;
226 bool m_mdcRootFlag;
227
228 NTuple::Tuple* m_tupleTof1;
229 NTuple::Tuple* m_tupleTof2;
230 NTuple::Tuple* m_tupleTof3;
231 bool m_tofRootFlag;
232 bool m_tofSaturationFlag;
233
234 NTuple::Tuple* m_tupleEmc1; //digi level
235 NTuple::Tuple* m_tupleEmc2; //event level
236 bool m_emcRootFlag;
237
238 // Emc Crystal Light Output
239 bool m_emcLightOutput;
240 // Incoherent Noise
241 double m_emcIncoherentNoise;
242 // Coherent Noise
243 double m_emcCoherentNoise;
244 // Noise for fast simulation
245 double m_emcNoiseMean;
246 double m_emcNoiseSigma;
247 // Only energy above noise threshold will be recorded
248 double m_emcNoiseThreshold;
249 // Noise Level:
250 // 0: No noise, 1: Only singal crystals have noise,
251 // 2: Only 5x5 matrix has noise, 3: All noise.
252 int m_emcNoiseLevel;
253 // Time
254 int m_emcTime;
255 //MC electronics saturation of crystal:
256 //0:using Bhabha calibration constants;
257 //1:using EmaxData from data;
258 int m_emcELecSaturation;
259
260 // Muc noise mode
261 int m_mucNoiseMode;
262
263 NTuple::Tuple* m_tupleMuc;
264 bool m_mucRootFlag;
265
266 RealizationSvc* m_RealizationSvc;
267};
268
269#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 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 *)