BOSS 6.6.4.p03
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
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
133 int MucNoiseMode() {return m_mucNoiseMode;}
134
135 int LogLevel() {return m_logLevel;}
136
137protected:
138
139 G4Svc( const std::string& name, ISvcLocator* svc );
140
141 // Destructor.
142 virtual ~G4Svc();
143
144public:
145
146 void G4Init();
147
148 // Run initialization, termination and single event generation for G4SimAlg
149 void RunInitialize();
150 void RunTerminate();
151 void SimulateEvents(int);
152
153private:
154
155 // Allow SvcFactory to instantiate the service.
156 friend class SvcFactory<G4Svc>;
157
158 G4SvcRunManager *p_runMgr;
159 G4UImanager *p_uiMgr;
160
161 //std::string m_PhysicsList;
162 //double m_PhysicsCut;
163
164 // Visualization
165 bool m_vis;
166 //std::string m_visType;
167
168 // Initialization macro file
169
170 std::string m_macroName;
171 std::string m_mdcNoiseFile;
172
173#ifdef G4VIS_USE
174 G4VisManager *p_visMgr;
175#endif
176
177 // Save Hits and Tracks in StoreGate
178 //bool m_saveHits;
179 //bool m_saveTracks;
180 int m_logLevel;
181
182 // Verbosity
183 int m_runVerb;
184 int m_eventVerb;
185 int m_trackVerb;
186
187 bool _init;
188
189 bool m_interactiveG4;
190
191 bool m_besGenAction;
192
193 int m_runID;
194
195 int m_mdcDataInput;
196 int m_mdcDedxFlag;
197
198 //vertex parameters
199 double m_beamPosX;
200 double m_beamPosY;
201 double m_beamPosZ;
202
203 double m_beamSizeX;
204 double m_beamSizeY;
205 double m_beamSizeZ;
206
207 double m_beamStartTime;
208 double m_beamDeltaTime;
209 double m_nBunch;
210
211 double m_bunchTimeSigma;
212 double m_beamTime;
213
214 double m_beamShiftPx;
215 double m_beamShiftPy;
216 double m_beamShiftPz;
217
218 bool m_boostLab;
219 bool m_setBeamShift;
220 double m_beamAngle;
221
222 // MC Monitor
223 NTuple::Tuple* m_tupleMdc;
224 bool m_mdcRootFlag;
225
226 NTuple::Tuple* m_tupleTof1;
227 NTuple::Tuple* m_tupleTof2;
228 NTuple::Tuple* m_tupleTof3;
229 bool m_tofRootFlag;
230 bool m_tofSaturationFlag;
231
232 NTuple::Tuple* m_tupleEmc1; //digi level
233 NTuple::Tuple* m_tupleEmc2; //event level
234 bool m_emcRootFlag;
235
236 // Emc Crystal Light Output
237 bool m_emcLightOutput;
238 // Incoherent Noise
239 double m_emcIncoherentNoise;
240 // Coherent Noise
241 double m_emcCoherentNoise;
242 // Noise for fast simulation
243 double m_emcNoiseMean;
244 double m_emcNoiseSigma;
245 // Only energy above noise threshold will be recorded
246 double m_emcNoiseThreshold;
247 // Noise Level:
248 // 0: No noise, 1: Only singal crystals have noise,
249 // 2: Only 5x5 matrix has noise, 3: All noise.
250 int m_emcNoiseLevel;
251 // Time
252 int m_emcTime;
253 // Muc noise mode
254 int m_mucNoiseMode;
255
256 NTuple::Tuple* m_tupleMuc;
257 bool m_mucRootFlag;
258
259 RealizationSvc* m_RealizationSvc;
260};
261
262#endif
Definition: G4Svc.h:32
bool EmcLightOutput()
Definition: G4Svc.h:124
bool MdcRootFlag()
Definition: G4Svc.h:117
virtual StatusCode initialize()
Definition: G4Svc.cpp:139
std::string GetMdcNoiseFile()
Definition: G4Svc.h:87
const G4Event * GetCurrentEvent() const
Definition: G4Svc.cpp:192
NTuple::Tuple * GetTupleMdc()
Definition: G4Svc.h:96
void SetTupleTof3(NTuple::Tuple *tuple)
Definition: G4Svc.h:106
void SetTupleMdc(NTuple::Tuple *tuple)
Definition: G4Svc.h:97
double GetBeamSizeZ()
Definition: G4Svc.h:74
void RunTerminate()
Definition: G4Svc.cpp:375
double GetBeamPosX()
Definition: G4Svc.h:68
double EmcNoiseSigma()
Definition: G4Svc.h:128
double EmcNoiseThreshold()
Definition: G4Svc.h:129
double GetBeamPosZ()
Definition: G4Svc.h:70
bool EmcRootFlag()
Definition: G4Svc.h:119
G4UImanager * uiMgr()
Definition: G4Svc.cpp:213
virtual ~G4Svc()
Definition: G4Svc.cpp:108
double GetBeamShiftPz()
Definition: G4Svc.h:78
void RunInitialize()
Definition: G4Svc.cpp:363
double EmcNoiseMean()
Definition: G4Svc.h:127
bool GetBoostLab()
Definition: G4Svc.h:90
void StartUISession()
Definition: G4Svc.cpp:282
NTuple::Tuple * GetTupleTof3()
Definition: G4Svc.h:105
G4RunManager * runMgr()
Definition: G4Svc.cpp:122
double EmcIncoherentNoise()
Definition: G4Svc.h:125
int MucNoiseMode()
Definition: G4Svc.h:133
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:295
void SetTupleMuc(NTuple::Tuple *tuple)
Definition: G4Svc.h:115
double GetBeamDeltaTime()
Definition: G4Svc.h:81
int GetMdcDedxFlag()
Definition: G4Svc.h:94
void SetTupleEmc1(NTuple::Tuple *tuple)
Definition: G4Svc.h:109
double GetBunchTimeSigma()
Definition: G4Svc.h:83
double GetBeamShiftPy()
Definition: G4Svc.h:77
void SetTupleEmc2(NTuple::Tuple *tuple)
Definition: G4Svc.h:112
double GetBeamStartTime()
Definition: G4Svc.h:80
bool GetSetBeamShift()
Definition: G4Svc.h:91
bool TofRootFlag()
Definition: G4Svc.h:118
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
Definition: G4Svc.cpp:178
double EmcCoherentNoise()
Definition: G4Svc.h:126
void SimulateEvents(int)
Definition: G4Svc.cpp:380
NTuple::Tuple * GetTupleEmc2()
Definition: G4Svc.h:111
int GetMdcDataInput()
Definition: G4Svc.h:93
void SetTupleTof2(NTuple::Tuple *tuple)
Definition: G4Svc.h:103
void SetBeamTime(double value)
Definition: G4Svc.h:86
void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Definition: G4Svc.cpp:222
double GetBeamSizeX()
Definition: G4Svc.h:72
int LogLevel()
Definition: G4Svc.h:135
NTuple::Tuple * GetTupleTof2()
Definition: G4Svc.h:102
int EmcNoiseLevel()
Definition: G4Svc.h:130
void SetTupleTof1(NTuple::Tuple *tuple)
Definition: G4Svc.h:100
bool MucRootFlag()
Definition: G4Svc.h:120
virtual StatusCode finalize()
Definition: G4Svc.cpp:166
bool TofSaturationFlag()
Definition: G4Svc.h:122
double GetBeamPosY()
Definition: G4Svc.h:69
const G4Run * GetCurrentRun() const
Definition: G4Svc.cpp:206
double GetBeamSizeY()
Definition: G4Svc.h:73
NTuple::Tuple * GetTupleMuc()
Definition: G4Svc.h:114
NTuple::Tuple * GetTupleEmc1()
Definition: G4Svc.h:108
void SetUserAction(G4UserRunAction *)
Definition: G4Svc.cpp:238
int EmcTime()
Definition: G4Svc.h:131
NTuple::Tuple * GetTupleTof1()
Definition: G4Svc.h:99
Definition: IG4Svc.h:30
Forward and external declarations.
Definition: CalibDataSvc.h:35