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