/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Simulation/G4Svc/G4Svc-00-01-52/G4Svc/G4Svc.h

Go to the documentation of this file.
00001 #ifndef G4SIM_G4SVC_H
00002 #define G4SIM_G4SVC_H
00003 
00004 #include "GaudiKernel/Service.h"
00005 #include "G4Svc/IG4Svc.h"
00006 #include "GaudiKernel/NTuple.h"
00007 
00008 // G4 includes
00009 #include  "G4UImanager.hh"
00010 
00011 #ifdef G4VIS_USE
00012  #include "G4VisManager.hh"
00013 #endif
00014 
00015 #include <vector>
00016 #include <string>
00017 #include "RealizationSvc/RealizationSvc.h"
00018 #include "RealizationSvc/IRealizationSvc.h"
00019 
00020 // Forward declarations
00021 template <class TYPE> class SvcFactory;
00022 
00023 class G4VUserPhysicsList;
00024 class G4RunManager;
00025 class G4SvcRunManager;
00026 
00027 // ClassName:   G4Svc
00028 // Description: This service provides access to Geant 4
00029 //
00030 
00031 class G4Svc: public Service, virtual public IG4Svc 
00032 {
00033 public:
00034 
00035   virtual StatusCode initialize();
00036   virtual StatusCode finalize();
00037 
00038   // Query the interfaces.
00039   virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface );
00040 
00041   G4RunManager * runMgr();
00042 
00043   // Detector init
00044   void SetUserInitialization(G4VUserDetectorConstruction* userInit);
00045 
00046   // Physics init
00047   void SetUserInitialization(G4VUserPhysicsList* physInit);
00048 
00049   // User Action
00050   void SetUserAction(G4UserRunAction *);
00051   void SetUserAction(G4UserEventAction *);
00052   void SetUserAction(G4VUserPrimaryGeneratorAction*);
00053   void SetUserAction(G4UserStackingAction*);
00054   void SetUserAction(G4UserTrackingAction*);
00055   void SetUserAction(G4UserSteppingAction*);
00056 
00057   // G4Event
00058   const G4Event* GetCurrentEvent() const;
00059   const G4Run*   GetCurrentRun() const;
00060  
00061 #ifdef G4VIS_USE
00062   G4VisManager * visMgr() { return p_visMgr; }
00063 #endif
00064   G4UImanager  * uiMgr();
00065   void  StartUISession();
00066  
00067   //for vertex parameters
00068   double GetBeamPosX() {return m_beamPosX;}
00069   double GetBeamPosY() {return m_beamPosY;}
00070   double GetBeamPosZ() {return m_beamPosZ;}
00071 
00072   double GetBeamSizeX() {return m_beamSizeX;}
00073   double GetBeamSizeY() {return m_beamSizeY;}
00074   double GetBeamSizeZ() {return m_beamSizeZ;}
00075 
00076   double GetBeamShiftPx(){return m_beamShiftPx;}
00077   double GetBeamShiftPy(){return m_beamShiftPy;}
00078   double GetBeamShiftPz(){return m_beamShiftPz;}
00079 
00080   double GetBeamStartTime() {return m_beamStartTime;}
00081   double GetBeamDeltaTime() {return m_beamDeltaTime;}
00082   double GetNBunch() {return m_nBunch;} 
00083   double GetBunchTimeSigma() {return m_bunchTimeSigma;}
00084  
00085   double GetBeamTime() {return m_beamTime;}
00086   void   SetBeamTime(double value) {m_beamTime = value;}
00087    std::string GetMdcNoiseFile(){return m_mdcNoiseFile;}
00088   
00089   double GetBeamAngle() {return m_beamAngle;}
00090   bool   GetBoostLab() {return m_boostLab;}  
00091   bool   GetSetBeamShift() {return m_setBeamShift;} 
00092 
00093   int GetMdcDataInput() { return m_mdcDataInput; }
00094   int GetMdcDedxFlag(){return m_mdcDedxFlag;}
00095 
00096   NTuple::Tuple* GetTupleMdc() {return m_tupleMdc;}
00097   void SetTupleMdc (NTuple::Tuple* tuple) {m_tupleMdc = tuple;}
00098 
00099   NTuple::Tuple* GetTupleTof1() {return m_tupleTof1;}
00100   void SetTupleTof1 (NTuple::Tuple* tuple) {m_tupleTof1 = tuple;}
00101   
00102   NTuple::Tuple* GetTupleTof2() {return m_tupleTof2;}
00103   void SetTupleTof2 (NTuple::Tuple* tuple) {m_tupleTof2 = tuple;}
00104 
00105   NTuple::Tuple* GetTupleTof3() {return m_tupleTof3;}
00106   void SetTupleTof3 (NTuple::Tuple* tuple) {m_tupleTof3 = tuple;}
00107 
00108   NTuple::Tuple* GetTupleEmc1() {return m_tupleEmc1;}
00109   void SetTupleEmc1 (NTuple::Tuple* tuple) {m_tupleEmc1 = tuple;}
00110 
00111   NTuple::Tuple* GetTupleEmc2() {return m_tupleEmc2;}
00112   void SetTupleEmc2 (NTuple::Tuple* tuple) {m_tupleEmc2 = tuple;}
00113 
00114   NTuple::Tuple* GetTupleMuc() {return m_tupleMuc;}
00115   void SetTupleMuc (NTuple::Tuple* tuple) {m_tupleMuc = tuple;}  
00116 
00117   bool MdcRootFlag() {return m_mdcRootFlag;}
00118   bool TofRootFlag() {return m_tofRootFlag;}
00119   bool EmcRootFlag() {return m_emcRootFlag;}
00120   bool MucRootFlag() {return m_mucRootFlag;}  
00121 
00122   bool TofSaturationFlag() {return m_tofSaturationFlag;} // Tof Q Saturation in bhabha events
00123 
00124   bool EmcLightOutput() {return m_emcLightOutput;}
00125   double EmcIncoherentNoise() {return m_emcIncoherentNoise;}
00126   double EmcCoherentNoise() {return m_emcCoherentNoise;}
00127   double EmcNoiseMean() {return m_emcNoiseMean;}
00128   double EmcNoiseSigma() {return m_emcNoiseSigma;}
00129   double EmcNoiseThreshold() {return m_emcNoiseThreshold;}
00130   int EmcNoiseLevel() {return m_emcNoiseLevel;}
00131   int EmcTime() {return m_emcTime;}
00132   int EmcElecSaturation(){return m_emcELecSaturation;}
00133 
00134 
00135   int MucNoiseMode() {return m_mucNoiseMode;}
00136 
00137   int LogLevel() {return m_logLevel;}
00138 
00139 protected:
00140 
00141   G4Svc( const std::string& name, ISvcLocator* svc );
00142   
00143   // Destructor.
00144   virtual ~G4Svc();
00145 
00146 public:
00147 
00148   void G4Init();
00149   
00150   // Run initialization, termination and single event generation for G4SimAlg
00151   void RunInitialize();
00152   void RunTerminate();
00153   void SimulateEvents(int);
00154   
00155 private:
00156 
00157   // Allow SvcFactory to instantiate the service.
00158   friend class SvcFactory<G4Svc>;
00159 
00160   G4SvcRunManager *p_runMgr;
00161   G4UImanager  *p_uiMgr;
00162   
00163   //std::string m_PhysicsList;
00164   //double m_PhysicsCut;
00165 
00166   // Visualization
00167   bool m_vis;
00168   //std::string m_visType;
00169   
00170   // Initialization macro file
00171   
00172   std::string m_macroName;
00173   std::string m_mdcNoiseFile; 
00174 
00175 #ifdef G4VIS_USE
00176   G4VisManager *p_visMgr;
00177 #endif
00178 
00179   // Save Hits and Tracks in StoreGate
00180   //bool m_saveHits;
00181   //bool m_saveTracks;
00182   int m_logLevel;
00183 
00184   // Verbosity
00185   int m_runVerb;
00186   int m_eventVerb;
00187   int m_trackVerb;
00188 
00189   bool _init;
00190   
00191   bool m_interactiveG4;
00192   
00193   bool m_besGenAction;
00194 
00195   int m_runID;
00196   
00197   int m_mdcDataInput;  
00198   int m_mdcDedxFlag;
00199 
00200   //vertex parameters
00201   double m_beamPosX;
00202   double m_beamPosY;
00203   double m_beamPosZ;
00204 
00205   double m_beamSizeX;
00206   double m_beamSizeY;
00207   double m_beamSizeZ;
00208 
00209   double m_beamStartTime;
00210   double m_beamDeltaTime;
00211   double m_nBunch;
00212   
00213   double m_bunchTimeSigma;
00214   double m_beamTime;  
00215 
00216   double m_beamShiftPx;
00217   double m_beamShiftPy;
00218   double m_beamShiftPz;
00219 
00220   bool   m_boostLab;
00221   bool   m_setBeamShift;
00222   double m_beamAngle;
00223 
00224   // MC Monitor
00225   NTuple::Tuple* m_tupleMdc;
00226   bool m_mdcRootFlag;
00227 
00228   NTuple::Tuple* m_tupleTof1;
00229   NTuple::Tuple* m_tupleTof2;
00230   NTuple::Tuple* m_tupleTof3;
00231   bool m_tofRootFlag;
00232   bool m_tofSaturationFlag;
00233   
00234   NTuple::Tuple* m_tupleEmc1; //digi level
00235   NTuple::Tuple* m_tupleEmc2; //event level
00236   bool m_emcRootFlag;
00237 
00238   // Emc Crystal Light Output
00239   bool m_emcLightOutput;
00240   // Incoherent Noise
00241   double  m_emcIncoherentNoise;
00242   // Coherent Noise
00243   double  m_emcCoherentNoise;
00244   // Noise for fast simulation
00245   double  m_emcNoiseMean;
00246   double  m_emcNoiseSigma;
00247   // Only energy above noise threshold will be recorded
00248   double  m_emcNoiseThreshold;
00249   // Noise Level:
00250   // 0: No noise, 1: Only singal crystals have noise,
00251   // 2: Only 5x5 matrix has noise, 3: All noise.
00252   int m_emcNoiseLevel;
00253   // Time
00254   int m_emcTime;
00255   //MC electronics saturation of crystal:
00256   //0:using Bhabha calibration constants;
00257   //1:using EmaxData from data;
00258   int m_emcELecSaturation;
00259 
00260   // Muc noise mode
00261   int m_mucNoiseMode;   
00262 
00263   NTuple::Tuple* m_tupleMuc;
00264   bool m_mucRootFlag;
00265 
00266   RealizationSvc* m_RealizationSvc;
00267 };
00268 
00269 #endif

Generated on Tue Nov 29 23:14:33 2016 for BOSS_7.0.2 by  doxygen 1.4.7