00001 #ifndef REALIZATIONSVC_H 00002 #define REALIZATIONSVC_H 00003 00004 #include "GaudiKernel/IInterface.h" 00005 #include "GaudiKernel/IIncidentListener.h" 00006 #include "GaudiKernel/Kernel.h" 00007 #include "GaudiKernel/Service.h" 00008 #include "GaudiKernel/SmartDataPtr.h" 00009 #include "GaudiKernel/DataSvc.h" 00010 #include <vector> 00011 #include "RealizationSvc/IRealizationSvc.h" 00012 #include "RealizationSvc/ConnectionProvider.h" 00013 00014 class IDataProviderSvc; 00015 00016 class RealizationSvc: public Service, virtual public IRealizationSvc, 00017 virtual public IIncidentListener{ 00018 00019 public: 00020 RealizationSvc( const std::string& name, ISvcLocator* svcloc ); 00021 ~RealizationSvc(){}; 00022 virtual StatusCode initialize(); 00023 virtual StatusCode finalize(); 00024 virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); 00025 00026 // Incident handler 00027 void handle(const Incident&); 00028 00029 // interface 00030 void readDB(int runNo); 00031 void updateRealData(); 00032 00033 //set or get initial event ID 00034 int getInitEvtID() { return m_initEvtID; } 00035 void setInitEvtID(int i) { m_initEvtID = i; } 00036 00037 void setLuminosity(float i) { m_lumi = i; } 00038 float getLuminosity() { return m_lumi; } 00039 float getLuminosity(int runNo); 00040 00041 void setBunchPosX(double i) { m_bunch_x = i; } 00042 void setBunchPosY(double i) { m_bunch_y = i; } 00043 void setBunchPosZ(double i) { m_bunch_z = i; } 00044 void setBunchSizeX(double i) { m_sigma_x = i; } 00045 void setBunchSizeY(double i) { m_sigma_y = i; } 00046 void setBunchSizeZ(double i) { m_sigma_z = i; } 00047 double getBunchPosX() { return m_bunch_x; } 00048 double getBunchPosY() { return m_bunch_y; } 00049 double getBunchPosZ() { return m_bunch_z; } 00050 double getBunchSizeX() { return m_sigma_x; } 00051 double getBunchSizeY() { return m_sigma_y; } 00052 double getBunchSizeZ() { return m_sigma_z; } 00053 00054 inline double getTrgGain(int cry_id) { return m_trgGain[cry_id]; } 00055 00056 //set event number in a run 00057 void setRunEvtNum(int i) { m_RunEvtNum = i; } 00058 //set event number in a random trigger file 00059 //void setRanTrgEvtNum(std::vector<int> i) { m_RanTrgEvtNum = i; } 00060 00061 //get event number in a run 00062 int getRunEvtNum() { return m_RunEvtNum; } 00063 //get event number in a random trigger file 00064 //std::vector<int> getRanTrgEvtNum() { return m_RanTrgEvtNum; } 00065 00066 // std::vector<int> getRunEvtNum(std::vector<int> inrunList, int EvtMax); 00067 00068 // trigger table 00069 void setTrgTable(std::vector<uint32_t> i) { m_trgTable = i; } 00070 std::vector<uint32_t> getTrgTable() { return m_trgTable; } 00071 00072 // trigger config infor. 00073 int getEtotDataSteps() { return m_EtotDataSteps; } 00074 int getVthBEtotH() { return m_VthBEtotH; } 00075 int getVthEEtotH() { return m_VthEEtotH; } 00076 int getVthEtotL() { return m_VthEtotL; } 00077 int getVthEtotM() { return m_VthEtotM; } 00078 int getVthBLZ() { return m_VthBLZ; } 00079 int getVthDiffB() { return m_VthDiffB; } 00080 int getVthDiffE() { return m_VthDiffE; } 00081 int getVthBalBLK() { return m_VthBalBLK; } 00082 int getVthBalEEMC() { return m_VthBalEEMC; } 00083 int getVthDiffMin() { return m_VthDiffMin; } 00084 00085 void setBgFileName(std::vector<std::string> i) { m_bgfilename = i; } 00086 std::vector<std::string> getBgFileName() { return m_bgfilename; } 00087 std::vector<std::string> getBgFileName(std::string query); 00088 00089 //luminosity curve parameters 00090 float getRunTotalTime() { return m_runTotalTime; } 00091 float getTauValue() { return m_tauValue; } 00092 00093 //run infor. 00094 std::vector<double> getRunInfo() {return m_runInfo; } 00095 00096 //TFEE 00097 std::vector<std::string> getTofThreshold() { return m_tfee; } 00098 00099 //related run id 00100 std::vector<int> getRunList() { return m_runIdList; } 00101 int getRunId() { return m_runID; } 00102 void setRunId(int i) { m_runID = i; } 00103 00104 bool UseDBFlag() { return m_useDB; } 00105 00106 bool ifReadBunch() { return m_ifReadBunch; } 00107 bool ifReadTrg() { return m_ifReadTrg; } 00108 bool ifReadRandTrg() { return m_ifReadRandTrg; } 00109 bool ifReadTFEE() { return m_ifReadTFEE; } 00110 00111 private: 00112 int m_CaliConst; 00113 00114 std::string m_bossRelease; 00115 std::string m_SftVer; 00116 std::string m_ParVer; 00117 00118 float m_lumi; 00119 double m_bunch_x; 00120 double m_bunch_y; 00121 double m_bunch_z; 00122 00123 double m_sigma_x; 00124 double m_sigma_y; 00125 double m_sigma_z; 00126 00127 int m_initEvtID; 00128 00129 int m_RunEvtNum; 00130 //std::vector<int> m_RanTrgEvtNum; 00131 00132 //run id list property 00133 std::vector<int> m_runNoList; 00134 std::vector<int> m_runIdList; 00135 int m_runID; 00136 00137 bool m_useDB; 00138 00139 //luminosity curve parameters 00140 float m_runTotalTime; 00141 float m_tauValue; 00142 00143 bool m_ifReadBunch; 00144 bool m_ifReadTrg; 00145 bool m_ifReadRandTrg; 00146 bool m_ifReadTFEE; 00147 bool m_ifReadRunInfo; 00148 00149 std::vector<uint32_t> m_trgTable; 00150 IDataProviderSvc* m_eventSvc; 00151 00152 //background 00153 std::vector<std::string> m_bgfilename; 00154 //TFEE 00155 std::vector<std::string> m_tfee; 00156 00157 //run infor. 00158 std::vector<double> m_runInfo; 00159 00160 double m_trgGain[6240]; 00161 00162 //trigger config infor. 00163 int m_EtotDataSteps; 00164 int m_VthBEtotH; 00165 int m_VthEEtotH; 00166 int m_VthEtotL; 00167 int m_VthEtotM; 00168 int m_VthBLZ; 00169 int m_VthDiffB; 00170 int m_VthDiffE; 00171 int m_VthBalBLK; 00172 int m_VthBalEEMC; 00173 int m_VthDiffMin; 00174 00175 RealDBUtil::ConnectionProvider* m_connect; 00176 }; 00177 00178 #endif