#include <DedxCurSvc.h>
Inheritance diagram for DedxCurSvc:
Public Member Functions | |
DedxCurSvc (const std::string &name, ISvcLocator *svcloc) | |
DedxCurSvc (const std::string &name, ISvcLocator *svcloc) | |
virtual StatusCode | finalize () |
virtual StatusCode | finalize () |
const double | getCurve (int i) |
const double | getCurve (int i) |
const int | getCurveSize () |
const int | getCurveSize () |
void | getDedxCurveInfo () |
void | getDedxCurveInfo () |
const double | getSigma (int i) |
const double | getSigma (int i) |
const int | getSigmaSize () |
const int | getSigmaSize () |
void | handle (const Incident &) |
void | handle (const Incident &) |
virtual StatusCode | initialize () |
virtual StatusCode | initialize () |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown) |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown) |
~DedxCurSvc () | |
~DedxCurSvc () | |
Static Public Member Functions | |
const InterfaceID & | interfaceID () |
const InterfaceID & | interfaceID () |
Private Attributes | |
MYSQL * | conn |
MYSQL * | conn |
std::string | m_calParVer |
double | m_curve [50] |
int | m_curve_size |
IDatabaseSvc * | m_dbsvc |
IDatabaseSvc * | m_dbsvc |
IDataProviderSvc * | m_eventSvc |
IDataProviderSvc * | m_eventSvc |
std::string | m_host |
int | m_runNo |
std::string | m_sftver |
double | m_sigma [50] |
int | m_sigma_size |
|
00031 : Service(name, svcloc) { 00032 declareProperty("BossVer",m_sftver="default"); 00033 declareProperty("ParVer",m_calParVer="default"); 00034 declareProperty("Host",m_host="bes3db2.ihep.ac.cn"); 00035 }
|
|
00093 { 00094 }
|
|
|
|
|
|
|
|
00086 { 00087 MsgStream log(msgSvc(), name()); 00088 log << MSG::INFO << name() << ": End of Run" << endreq; 00089 return StatusCode::SUCCESS; 00090 }
|
|
Implements IDedxCurSvc. 00031 {return m_curve[i];}
|
|
Implements IDedxCurSvc. 00031 {return m_curve[i];}
|
|
Implements IDedxCurSvc. 00033 {return m_curve_size;}
|
|
Implements IDedxCurSvc. 00033 {return m_curve_size;}
|
|
|
|
00113 { 00114 MsgStream log(messageService(), name()); 00115 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader"); 00116 int run = eventHeader->runNumber(); 00117 if(run<0){ 00118 log << MSG::INFO << "This data is the MC sample with the Run Number: " << run << endreq; 00119 //run=-run; 00120 } 00121 // unsigned long *lengths; 00122 MYSQL_RES *res_set; 00123 MYSQL_ROW row; 00124 char stmt1[400]; 00125 00126 if(m_sftver=="default") m_sftver = getenv("BES_RELEASE"); 00127 const char* SftVer = m_sftver.c_str(); 00128 00129 if(m_calParVer!="default"){ 00130 const char* calpar = m_calParVer.c_str(); 00131 sprintf(stmt1,"select DedxCurvePar,DedxSigmaPar from DedxCurvePar where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and DedxCurveParVer = %s and Status='OK'",SftVer,run,run,calpar); 00132 } 00133 if(m_calParVer=="default"){ 00134 sprintf(stmt1,"select DedxCurvePar,DedxSigmaPar from DedxCurvePar where SftVer = '%s' and RunFrom <= %d and RunTo >= %d and Status='OK' order by DedxCurveParVer desc",SftVer,run,run); 00135 } 00136 00137 DatabaseRecordVector res; 00138 int row_no = m_dbsvc->query("offlinedb", stmt1, res); 00139 if(row_no==0){ 00140 log << MSG::FATAL << "can not find result for DedxCurSvc" << endreq; 00141 exit(1); 00142 } 00143 00144 DatabaseRecord* records = res[0]; 00145 TBuffer *buf1 = new TBuffer(TBuffer::kRead); 00146 buf1->SetBuffer((*records)["DedxCurvePar"],327680,kFALSE); 00147 TBuffer *buf2 = new TBuffer(TBuffer::kRead); 00148 buf2->SetBuffer((*records)["DedxSigmaPar"],327680,kFALSE); 00149 00150 00151 TTree* curvetree = new TTree(); 00152 curvetree->Streamer(*buf1); 00153 00154 TTree* sigmatree = new TTree(); 00155 sigmatree->Streamer(*buf2); 00156 00157 double curve[50]; 00158 double sigma[50]; 00159 int SigmaSize; 00160 int CurveSize; 00161 curvetree -> SetBranchAddress("curve", curve); 00162 curvetree -> SetBranchAddress("CurveSize", &CurveSize); 00163 sigmatree -> SetBranchAddress("sigma", sigma); 00164 sigmatree -> SetBranchAddress("SigmaSize", &SigmaSize); 00165 00166 Int_t nentries_curve = (Int_t)curvetree ->GetEntries(); 00167 Int_t nentries_sigma = (Int_t)sigmatree ->GetEntries(); 00168 curvetree -> GetEntry(0); 00169 if(CurveSize>50){ 00170 log << MSG::ERROR<<"CurveSize larger than designed number"<<endreq; 00171 exit(1);} 00172 for(int i=0; i<CurveSize;i++){ 00173 m_curve[i]=curve[i]; 00174 } 00175 00176 sigmatree-> GetEntry(0); 00177 if(SigmaSize>50){ 00178 log << MSG::ERROR<<"SigmaSize larger than designed number"<<endreq; 00179 exit(1);} 00180 for(int i=0; i<SigmaSize;i++){ 00181 m_sigma[i]=sigma[i];} 00182 m_curve_size=CurveSize; 00183 m_sigma_size=SigmaSize; 00184 return; 00185 }
|
|
Implements IDedxCurSvc. 00032 {return m_sigma[i];}
|
|
Implements IDedxCurSvc. 00032 {return m_sigma[i];}
|
|
Implements IDedxCurSvc. 00034 {return m_sigma_size;}
|
|
Implements IDedxCurSvc. 00034 {return m_sigma_size;}
|
|
|
|
00098 { 00099 MsgStream log( messageService(), name() ); 00100 log << MSG::DEBUG << "handle: " << inc.type() << endreq; 00101 00102 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader"); 00103 int run = eventHeader->runNumber(); 00104 // if( run<0 || run>11000 ) return; 00105 00106 if ( inc.type() == "NewRun" ){ 00107 log << MSG::DEBUG << "New Run:" << run << endreq; 00108 getDedxCurveInfo(); 00109 } 00110 }
|
|
|
|
00049 { 00050 00051 MsgStream log(msgSvc(), name()); 00052 log << MSG::INFO << name() << ": Start of run initialisation" << endreq; 00053 00054 StatusCode sc = Service::initialize(); 00055 if ( sc.isFailure() ) return sc; 00056 00057 IIncidentSvc* incsvc; 00058 sc = service("IncidentSvc", incsvc); 00059 int priority = 100; 00060 if( sc.isSuccess() ){ 00061 incsvc -> addListener(this, "NewRun", priority); 00062 } 00063 00064 00065 sc = serviceLocator()->service("DatabaseSvc",m_dbsvc,true); 00066 if (sc .isFailure() ) { 00067 log << MSG::ERROR << "Unable to find DatabaseSvc " << endreq; 00068 return sc; 00069 } 00070 00071 00072 sc = serviceLocator()->service("EventDataSvc", m_eventSvc, true); 00073 if (sc .isFailure() ) { 00074 log << MSG::ERROR << "Unable to find EventDataSvc " << endreq; 00075 return sc; 00076 } 00077 00078 StatusCode scc; 00079 log<<MSG::INFO << "setProperties()" << endreq; 00080 scc = setProperties(); 00081 m_runNo=0; 00082 return sc; 00083 }
|
|
00011 { return IID_IDedxCurSvc; }
|
|
00011 { return IID_IDedxCurSvc; }
|
|
|
|
00038 { 00039 00040 if ( IID_IDedxCurSvc.versionMatch(riid) ) { 00041 *ppvInterface = static_cast<IDedxCurSvc*> (this); 00042 } else { 00043 return Service::queryInterface(riid, ppvInterface) ; 00044 } 00045 return StatusCode::SUCCESS; 00046 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|