00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TofCaliSvc/TofCaliSvc.h"
00013 #include "TofCaliSvc/BTofCal.h"
00014 #include "TofCaliSvc/BTofCommonCal.h"
00015 #include "TofCaliSvc/ETofCal.h"
00016 #include "TofCaliSvc/EtfCal.h"
00017 #include "TofCaliSvc/EtfBunchCal.h"
00018 #include "TofCaliSvc/TofInfoCal.h"
00019 #include "GaudiKernel/Kernel.h"
00020 #include "GaudiKernel/IInterface.h"
00021 #include "GaudiKernel/StatusCode.h"
00022 #include "GaudiKernel/SvcFactory.h"
00023 #include "GaudiKernel/MsgStream.h"
00024 #include "TMath.h"
00025 #include <math.h>
00026 #include <iostream>
00027 #include <fstream>
00028 #include "GaudiKernel/IIncidentSvc.h"
00029 #include "GaudiKernel/Incident.h"
00030 #include "GaudiKernel/IIncidentListener.h"
00031 #include "GaudiKernel/IDataProviderSvc.h"
00032 #include "GaudiKernel/Service.h"
00033 #include "GaudiKernel/MsgStream.h"
00034 #include "GaudiKernel/SmartDataPtr.h"
00035 #include "CalibData/Tof/TofCalibData.h"
00036 #include "CalibData/Tof/bTofCalibBase.h"
00037 #include "CalibData/CalibModel.h"
00038 #include "GaudiKernel/DataSvc.h"
00039
00040 using namespace std;
00041
00042
00043
00044
00045 TofCaliSvc::TofCaliSvc( const std::string& name, ISvcLocator* svcloc ) : Service(name, svcloc) {
00046 declareProperty("Run",m_run=1);
00047 }
00048
00049 StatusCode TofCaliSvc::queryInterface (const InterfaceID& riid, void** ppvInterface ) {
00050 if ( IID_ITofCaliSvc.versionMatch(riid) ) {
00051 *ppvInterface = static_cast<ITofCaliSvc*> (this);
00052 } else {
00053 return Service::queryInterface(riid, ppvInterface) ;
00054 }
00055 return StatusCode::SUCCESS;
00056 }
00057
00058 StatusCode TofCaliSvc::initialize ( ) {
00059 m_hasbeeninitialized=false;
00060
00061 MsgStream log(msgSvc(), name());
00062 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
00063
00064 StatusCode sc = Service::initialize();
00065 if ( sc.isFailure() ) return sc;
00066
00067 IIncidentSvc* incsvc;
00068 sc = service("IncidentSvc", incsvc);
00069 int priority = 100;
00070 if( sc.isSuccess() ){
00071 incsvc -> addListener(this, "NewRun", priority);
00072 }
00073
00074 StatusCode scc;
00075
00076 log<<MSG::INFO << "setProperties()" << endreq;
00077 scc = service("CalibDataSvc", m_pCalibDataSvc, true);
00078 if ( !scc.isSuccess() ) {
00079 log<<MSG::ERROR<<"Could not get IDataProviderSvc interface of CalibXmlCnvSvc"<<endreq;
00080 return scc;
00081 } else {
00082 log << MSG::DEBUG<< "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc"<<endreq;
00083 }
00084
00085 scc = setProperties();
00086
00087 return sc;
00088 }
00089
00090 StatusCode TofCaliSvc::finalize ( ) {
00091 MsgStream log(msgSvc(), name());
00092 log << MSG::INFO << name() << ": End of Run" << endreq;
00093 return StatusCode::SUCCESS;
00094 }
00095
00096 TofCaliSvc::~TofCaliSvc(){
00097 for(vector<BTofCal*>::iterator it1 = fBTofCal.begin(); it1 != fBTofCal.end(); it1++) { delete (*it1); }
00098 fBTofCal.clear();
00099 for(vector<ETofCal*>::iterator it2 = fETofCal.begin(); it2 != fETofCal.end(); it2++) { delete (*it2); }
00100 fETofCal.clear();
00101
00102 if( fEtfCal.size()!=0 ) {
00103 for(vector<EtfCal*>::iterator it5 = fEtfCal.begin(); it5 != fEtfCal.end(); it5++) { delete (*it5); }
00104 fEtfCal.clear();
00105 }
00106 if( fEtfBunchCal.size()!=0 ) {
00107 for(vector<EtfBunchCal*>::iterator it6 = fEtfBunchCal.begin(); it6 != fEtfBunchCal.end(); it6++) { delete (*it6); }
00108 fEtfBunchCal.clear();
00109 }
00110 for(vector<BTofCommonCal*>::iterator it3 = fBTofCommonCal.begin(); it3 != fBTofCommonCal.end(); it3++) { delete (*it3); }
00111 fBTofCommonCal.clear();
00112 for(vector<TofInfoCal*>::iterator it4 = fTofInfoCal.begin(); it4 != fTofInfoCal.end(); it4++) { delete (*it4); }
00113 fTofInfoCal.clear();
00114 return;
00115 }
00116
00117 StatusCode TofCaliSvc::FillfromDatabase(){
00118
00119 MsgStream log(msgSvc(), name());
00120 std::string fullPath = "/Calib/TofCal";
00121 log << MSG::INFO<<" Tof calib fullPath = "<<fullPath<< endreq;
00122 SmartDataPtr<CalibData::TofCalibData> test(m_pCalibDataSvc, fullPath);
00123 if(!test){
00124 log << MSG::FATAL << "TofCaliSvc could not find TofCalibData in TCDS!!" << endreq;
00125 return StatusCode::FAILURE;
00126 }
00127
00128 for(vector<BTofCal*>::iterator it1 = fBTofCal.begin(); it1 != fBTofCal.end(); it1++) { delete (*it1); }
00129 fBTofCal.clear();
00130 for(vector<ETofCal*>::iterator it2 = fETofCal.begin(); it2 != fETofCal.end(); it2++) { delete (*it2); }
00131 fETofCal.clear();
00132 if( fEtfCal.size()!=0 ) {
00133 for(vector<EtfCal*>::iterator it5 = fEtfCal.begin(); it5 != fEtfCal.end(); it5++) { delete (*it5); }
00134 fEtfCal.clear();
00135 }
00136 if( fEtfBunchCal.size()!=0 ) {
00137 for(vector<EtfBunchCal*>::iterator it6 = fEtfBunchCal.begin(); it6 != fEtfBunchCal.end(); it6++) { delete (*it6); }
00138 fEtfBunchCal.clear();
00139 }
00140 for(vector<BTofCommonCal*>::iterator it3 = fBTofCommonCal.begin(); it3 != fBTofCommonCal.end(); it3++) { delete (*it3); }
00141 fBTofCommonCal.clear();
00142 for(vector<TofInfoCal*>::iterator it4 = fTofInfoCal.begin(); it4 != fTofInfoCal.end(); it4++) { delete (*it4); }
00143 fTofInfoCal.clear();
00144
00145 for(int ib=0;ib<176;ib++){
00146 BTofCal* btof = new BTofCal;
00147 for( int j=0; j<static_cast<int>(nBarAtten); j++ ) {
00148 btof->setAtten(j,test->getBTofAtten(ib,j));
00149 }
00150 for( int j=0; j<static_cast<int>(nBarSpeed); j++ ) {
00151 btof->setVeff(j,test->getBTofSpeed(ib,j));
00152 }
00153 for( int j=0; j<static_cast<int>(nBarPar); j++){
00154 btof->setP1(j,test->getBTofPleft(ib,j));
00155 btof->setP2(j,test->getBTofPright(ib,j));
00156 }
00157 for( int j=0; j<static_cast<int>(nBarParOff); j++){
00158 btof->setPOff1_bunch0(j,test->getBTofPoffleft_bunch0(ib,j));
00159 btof->setPOff2_bunch0(j,test->getBTofPoffright_bunch0(ib,j));
00160 btof->setPOff1_bunch1(j,test->getBTofPoffleft_bunch1(ib,j));
00161 btof->setPOff2_bunch1(j,test->getBTofPoffright_bunch1(ib,j));
00162 btof->setPOff1_bunch2(j,test->getBTofPoffleft_bunch2(ib,j));
00163 btof->setPOff2_bunch2(j,test->getBTofPoffright_bunch2(ib,j));
00164 btof->setPOff1_bunch3(j,test->getBTofPoffleft_bunch3(ib,j));
00165 btof->setPOff2_bunch3(j,test->getBTofPoffright_bunch3(ib,j));
00166 }
00167 for( int j=0; j<static_cast<int>(nBarSigma); j++){
00168 btof->setFPLeft(j,test->getBTofFleft(ib,j));
00169 btof->setFPRight(j,test->getBTofFright(ib,j));
00170 }
00171 for( int j=0; j<static_cast<int>(nBarSigCnt); j++){
00172 btof->setFPCounter(j,test->getBTofFcounter(ib,j));
00173 }
00174
00175 fBTofCal.push_back(btof);
00176 }
00177
00178 for(int ie=0;ie<96;ie++){
00179 ETofCal* etof= new ETofCal;
00180 for( int j=0; j<static_cast<int>(nEndAtten); j++ ) {
00181 etof->setAtten(j,test->getETofAtten(ie,j));
00182 }
00183 for( int j=0; j<static_cast<int>(nEndSpeed); j++ ) {
00184 etof->setVeff(j,test->getETofSpeed(ie,j));
00185 }
00186 for( int j=0; j<static_cast<int>(nEndPar); j++ ) {
00187 etof->setP(j,test->getETofP(ie,j));
00188 }
00189 for( int j=0; j<static_cast<int>(nEndSigma); j++ ) {
00190 etof->setFPCounter(j,test->getETofFP(ie,j));
00191 }
00192 fETofCal.push_back(etof);
00193 }
00194
00195 for(int ietf=0;ietf<72;ietf++) {
00196 for(int jetf=0;jetf<12;jetf++) {
00197 EtfCal* etf= new EtfCal;
00198 for( int k=0; k<static_cast<int>(nEtfSpeed); k++ ) {
00199 etf->setVeff(k,test->getEtfSpeed(ietf,jetf,k));
00200 }
00201 for( int k=0; k<static_cast<int>(nEtfPar); k++ ) {
00202 etf->setP( k,test->getEtfPcombine(ietf,jetf,k));
00203 etf->setP1(k,test->getEtfPleft(ietf,jetf,k));
00204 etf->setP2(k,test->getEtfPright(ietf,jetf,k));
00205 }
00206 fEtfCal.push_back(etf);
00207 }
00208 }
00209
00210 EtfBunchCal* etfbunch= new EtfBunchCal;
00211 for( int k=0; k<static_cast<int>(nEtfBunch); k++ ) {
00212 etfbunch->setBunchP(k,test->getEtfPBunch(k));
00213 }
00214 fEtfBunchCal.push_back(etfbunch);
00215
00216 BTofCommonCal* bcomtof = new BTofCommonCal;
00217 for(int i=0; i<static_cast<int>(nBarOffset); i++) {
00218 bcomtof->setOffset( i, test->getBTofOffset(i) );
00219 }
00220 for(int i=0; i<static_cast<int>(nBarSigCor); i++) {
00221 bcomtof->setSigmaCorr( i, test->getBTofSigmaCorr(i) );
00222 }
00223 fBTofCommonCal.push_back(bcomtof);
00224
00225 TofInfoCal* tofinfo = new TofInfoCal;
00226 tofinfo->setRunBegin( test->getRunBegin() );
00227 tofinfo->setRunEnd( test->getRunEnd() );
00228 tofinfo->setVersion( test->getVersion() );
00229 tofinfo->setQCorr( test->getQCorr() );
00230 tofinfo->setQElec( test->getQElec() );
00231 tofinfo->setMisLable( test->getMisLable() );
00232 for( unsigned int i=0; i<5; i++ ) {
00233 tofinfo->setBrEast( i, test->getBrEast(i) );
00234 tofinfo->setBrWest( i, test->getBrWest(i) );
00235 if( (test->getVersion())<=8 ) {
00236 tofinfo->setEndcap( i, test->getEndcap(i) );
00237 }
00238 else {
00239 tofinfo->setEtf( i, test->getEndcap(i) );
00240 }
00241 }
00242 fTofInfoCal.push_back(tofinfo);
00243
00244 return StatusCode::SUCCESS;
00245 }
00246
00247
00248 const double TofCaliSvc::BTDelay1(unsigned id) {
00249 double tdelay = 0.0;
00250 if( id < 176 ) {
00251 tdelay = fBTofCal[id]->getP1(0);
00252 }
00253 else {
00254 MsgStream log(msgSvc(), name());
00255 log<<MSG::ERROR<<"TofCaliSvc::BTDelay1() -- Wrong TOFID is provided! ID = "<<id<<endreq;
00256 }
00257 return tdelay;
00258 }
00259
00260
00261 const double TofCaliSvc::BTDelay2(unsigned id) {
00262 double tdelay = 0.0;
00263 if( id < 176 ) {
00264 tdelay = fBTofCal[id]->getP2(0);
00265 }
00266 else {
00267 MsgStream log(msgSvc(), name());
00268 log<<MSG::ERROR<<"TofCaliSvc::BTDelay2() -- Wrong TOFID is provided! ID = "<<id<<endreq;
00269 }
00270 return tdelay;
00271 }
00272
00273
00274 const double TofCaliSvc::ETDelay(unsigned id) {
00275 double tdelay = 0.0;
00276 if( id < 96 ) {
00277 tdelay = fETofCal[id]->getP(0);
00278 }
00279 else {
00280 MsgStream log(msgSvc(), name());
00281 log<<MSG::ERROR<<"TofCaliSvc::ETDelay() -- Wrong TOFID is provided! ID = "<<id<<endreq;
00282 }
00283 return tdelay;
00284 }
00285
00286
00287 const double TofCaliSvc::BTCorr1(double ADC,double z,unsigned id){
00288 MsgStream log(msgSvc(), name());
00289
00290 double p1[nBarPar];
00291 for( int i=0; i<static_cast<int>(nBarPar); i++ ) {
00292 p1[i]=fBTofCal[id]->getP1(i);
00293 }
00294
00295 log << MSG::DEBUG << "BTCorr1 id =" << id << " 1=" << p1[0] << " 2=" << p1[1] << " 3=" << p1[2] << " 4=" << p1[3] << " 5=" << p1[4] << " 6=" << p1[5] << " 7=" << p1[6] << " 8=" << p1[7] << " 9=" << p1[8] << endreq;
00296
00297 double tcorr1 = p1[0] + p1[1]/TMath::Sqrt(ADC) + p1[2]*z/TMath::Sqrt(ADC) + p1[3]/ADC + p1[4]*z + p1[5]*z*z + p1[6]*z*z*z;
00298
00299 return tcorr1;
00300 }
00301
00302
00303 const double TofCaliSvc::BTCorr2(double ADC,double z,unsigned id){
00304 MsgStream log(msgSvc(), name());
00305
00306 double p2[nBarPar];
00307 for( int i=0; i<static_cast<int>(nBarPar); i++ ) {
00308 p2[i]=fBTofCal[id]->getP2(i);
00309 }
00310
00311 log << MSG::DEBUG << "BTCorr2 id =" << id << " 1=" << p2[0] << " 2=" << p2[1] << " 3=" << p2[2] << " 4=" << p2[3] << " 5=" << p2[4] << " 6=" << p2[5] << " 7=" << p2[6] << " 8=" << p2[7] << " 9=" << p2[8] << endreq;
00312
00313 double tcorr2 = p2[0] + p2[1]/TMath::Sqrt(ADC) + p2[2]*z/TMath::Sqrt(ADC) + p2[3]/ADC + p2[4]*z + p2[5]*z*z + p2[6]*z*z*z;
00314
00315 return tcorr2;
00316 }
00317
00318
00319 const double TofCaliSvc::BTCorrOffset1(double z,unsigned id,double t0){
00320 MsgStream log(msgSvc(), name());
00321
00322 int numBunch = fTofInfoCal[0]->getRunEnd();
00323 int whichBunch = (static_cast<int>(t0/(12000./499.8/(numBunch*1.0))+0.1))%numBunch;
00324
00325 double poff1[nBarParOff];
00326 if( whichBunch==0 ) {
00327 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
00328 poff1[i]=fBTofCal[id]->getPOff1_bunch0(i);
00329 }
00330 }
00331 else if( whichBunch==1 ) {
00332 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
00333 poff1[i]=fBTofCal[id]->getPOff1_bunch1(i);
00334 }
00335 }
00336 else if( whichBunch==2 ) {
00337 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
00338 poff1[i]=fBTofCal[id]->getPOff1_bunch2(i);
00339 }
00340 }
00341 else if( whichBunch==3 ) {
00342 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
00343 poff1[i]=fBTofCal[id]->getPOff1_bunch3(i);
00344 }
00345 }
00346
00347 double tCorrOffset1 = 0.0;
00348 if( z>=0.0 ) {
00349 tCorrOffset1 = poff1[0] + poff1[1]*z + poff1[2]*z*z + poff1[3]*z*z*z + poff1[4]*z*z*z*z + poff1[5]*z*z*z*z*z + poff1[6]*z*z*z*z*z*z;
00350 }
00351 else {
00352 tCorrOffset1 = poff1[10] + poff1[11]*z + poff1[12]*z*z + poff1[13]*z*z*z + poff1[14]*z*z*z*z + poff1[15]*z*z*z*z*z + poff1[16]*z*z*z*z*z*z;
00353 }
00354
00355 log << MSG::DEBUG << "BTCorrOff1 id =" << id << " bunch number=" << whichBunch << " TCorrOffset1=" << tCorrOffset1 << " 1=" << poff1[0] << " 2=" << poff1[1] << " 3=" << poff1[2] << " 4=" << poff1[3] << " 5=" << poff1[4] << " 6=" << poff1[5] << " 7=" << poff1[6] << " 8=" << poff1[7] << " 9=" << poff1[8] << endreq;
00356
00357 return tCorrOffset1;
00358 }
00359
00360
00361 const double TofCaliSvc::BTCorrOffset2(double z,unsigned id,double t0){
00362 MsgStream log(msgSvc(), name());
00363
00364 int numBunch = fTofInfoCal[0]->getRunEnd();
00365 int whichBunch = (static_cast<int>(t0/(12000./499.8/(numBunch*1.0))+0.1))%numBunch;
00366
00367 double poff2[nBarParOff];
00368 if( whichBunch==0 ) {
00369 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
00370 poff2[i]=fBTofCal[id]->getPOff2_bunch0(i);
00371 }
00372 }
00373 else if( whichBunch==1 ) {
00374 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
00375 poff2[i]=fBTofCal[id]->getPOff2_bunch1(i);
00376 }
00377 }
00378 else if( whichBunch==2 ) {
00379 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
00380 poff2[i]=fBTofCal[id]->getPOff2_bunch2(i);
00381 }
00382 }
00383 else if( whichBunch==3 ) {
00384 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
00385 poff2[i]=fBTofCal[id]->getPOff2_bunch3(i);
00386 }
00387 }
00388
00389 double tCorrOffset2 = 0.0;
00390 if( z>=0.0 ) {
00391 tCorrOffset2 = poff2[0] + poff2[1]*z + poff2[2]*z*z + poff2[3]*z*z*z + poff2[4]*z*z*z*z + poff2[5]*z*z*z*z*z + poff2[6]*z*z*z*z*z*z;
00392 }
00393 else {
00394 tCorrOffset2 = poff2[10] + poff2[11]*z + poff2[12]*z*z + poff2[13]*z*z*z + poff2[14]*z*z*z*z + poff2[15]*z*z*z*z*z + poff2[16]*z*z*z*z*z*z;
00395 }
00396
00397 log << MSG::DEBUG << "BTCorrOff2 id =" << id << " bunch number=" << whichBunch << " TCorrOffset2=" << tCorrOffset2 << " 1=" << poff2[0] << " 2=" << poff2[1] << " 3=" << poff2[2] << " 4=" << poff2[3] << " 5=" << poff2[4] << " 6=" << poff2[5] << " 7=" << poff2[6] << " 8=" << poff2[7] << " 9=" << poff2[8] << endreq;
00398
00399 return tCorrOffset2;
00400 }
00401
00402
00403 const double TofCaliSvc::TOffset() {
00404 double toffset = fBTofCommonCal[0]->getOffset(0);
00405 return toffset;
00406 }
00407
00408
00409 const double TofCaliSvc::BTime1(double ADC,double TDC,double z,unsigned id,double t0){
00410 MsgStream log(msgSvc(), name());
00411
00412 double tcorr1 = BTCorr1( ADC, z, id );
00413 double tcorr2 = BTCorrOffset1( z, id, t0);
00414 double tcorr3 = fBTofCommonCal[0]->getOffset(0);
00415
00416 log << MSG::DEBUG << "BTime1 id =" << id << " tcorr=" << tcorr1 << " toffset=" << tcorr2 << " total offset=" << tcorr3 << endreq;
00417
00418 double time = TDC - tcorr1 - tcorr2 - tcorr3;
00419
00420 if(time<0.) {
00421 log<<MSG::WARNING<<"TofCaliSvc::BTime1() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" z = "<<z<<" ID = "<<id<<endreq;
00422 }
00423 return time;
00424 }
00425
00426
00427 const double TofCaliSvc::BTime2(double ADC,double TDC,double z,unsigned id, double t0){
00428 MsgStream log(msgSvc(), name());
00429
00430 double tcorr1 = BTCorr2( ADC, z, id );
00431 double tcorr2 = BTCorrOffset2( z, id ,t0);
00432 double tcorr3 = fBTofCommonCal[0]->getOffset(0);
00433
00434 log << MSG::DEBUG << "BTime2 id =" << id << " tcorr=" << tcorr1 << " toffset=" << tcorr2 << " total offset=" << tcorr3 << endreq;
00435
00436 double time = TDC - tcorr1 - tcorr2 - tcorr3;
00437
00438 if(time<0.) {
00439 log<<MSG::WARNING<<"TofCaliSvc::BTime2() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" z = "<<z<<" ID = "<<id<<endreq;
00440 }
00441 return time;
00442 }
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462 const double TofCaliSvc::BTimeCounter(double tleft,double tright,double z,unsigned id){
00463
00464 double sigmaCorr = fBTofCommonCal[0]->getSigmaCorr(0);
00465 double sigmaCorr2 = sigmaCorr*sigmaCorr;
00466
00467 double sigmaLeft = BSigma1( z, id );
00468 double sigmaLeft2 = sigmaLeft*sigmaLeft;
00469 double sigmaRight = BSigma2( z, id );
00470 double sigmaRight2 = sigmaRight*sigmaRight;
00471
00472 double fraction = ( sigmaRight2 - sigmaCorr2 )/( sigmaLeft2 + sigmaRight2 - 2.0*sigmaCorr2);
00473
00474 double wt=fraction*tleft + (1.0-fraction)*tright;
00475 if(wt<0.) {
00476 MsgStream log(msgSvc(), name());
00477 log<<MSG::WARNING<<"TofCaliSvc::BTimeCounter() -- A minus time is given : "<<wt <<" [Input] z = "<<z<<" ID = "<<id<<endreq;
00478 }
00479
00480 return wt;
00481 }
00482
00483 const double TofCaliSvc::BTimeCluster(double tlayer1,double tlayer2,double z1,double z2,unsigned id1, unsigned id2){
00484
00485 double sigmaCorr = fBTofCommonCal[0]->getSigmaCorr(0);
00486 double sigmaCorr2 = sigmaCorr*sigmaCorr;
00487
00488 double sigmaInner = BSigmaCounter( z1, id1 );
00489 double sigmaInner2 = sigmaInner*sigmaInner;
00490 double sigmaOuter = BSigmaCounter( z2, id2 );
00491 double sigmaOuter2 = sigmaOuter*sigmaOuter;
00492
00493 double fraction = ( sigmaOuter2 - sigmaCorr2 )/( sigmaInner2 + sigmaOuter2 - 2.0*sigmaCorr2);
00494
00495 double wt=fraction*tlayer1 + (1.0-fraction)*tlayer2;
00496 if(wt<0.) {
00497 MsgStream log(msgSvc(), name());
00498 log<<MSG::WARNING<<"TofCaliSvc::BTimeCluster() -- A minus time is given : "<<wt <<" [Input] z1 = "<<z1<<" [Input] z2 = "<<z2<<" ID1 = "<< id1 << " ID2=" << id2 << endreq;
00499 }
00500 return wt;
00501 }
00502
00503
00504 const double TofCaliSvc::BSigma1(double z, unsigned id) {
00505 MsgStream log(msgSvc(), name());
00506
00507 double fpleft[nBarSigma];
00508 for( int i=0; i<static_cast<int>(nBarSigma); i++ ) {
00509 fpleft[i]=fBTofCal[id]->getFPLeft(i);
00510 }
00511
00512 log << MSG::DEBUG << "BSigma1 id =" << id << " 1=" << fpleft[0] << " 2=" << fpleft[1] << " 3=" << fpleft[2] << " 4=" << fpleft[3] << " 5=" << fpleft[4] << endreq;
00513
00514 double sigmaLeft = fpleft[0] + fpleft[1]*z + fpleft[2]*z*z + fpleft[3]*z*z*z + fpleft[4]*z*z*z*z;
00515
00516 return sigmaLeft;
00517 }
00518
00519
00520 const double TofCaliSvc::BSigma2(double z, unsigned id) {
00521 MsgStream log(msgSvc(), name());
00522
00523 double fpright[nBarSigma];
00524 for( int i=0; i<static_cast<int>(nBarSigma); i++ ) {
00525 fpright[i]=fBTofCal[id]->getFPRight(i);
00526 }
00527
00528 log << MSG::DEBUG << "BSigma2 id =" << id << " 1=" << fpright[0] << " 2=" << fpright[1] << " 3=" << fpright[2] << " 4=" << fpright[3] << " 5=" << fpright[4] << endreq;
00529
00530 double sigmaRight = fpright[0] + fpright[1]*z + fpright[2]*z*z + fpright[3]*z*z*z + fpright[4]*z*z*z*z;
00531
00532 return sigmaRight;
00533 }
00534
00535
00536 const double TofCaliSvc::BSigmaCounter(double z, unsigned id) {
00537 MsgStream log(msgSvc(), name());
00538
00539 double fplayer[nBarSigCnt];
00540 for( int i=0; i<static_cast<int>(nBarSigCnt); i++ ) {
00541 fplayer[i]=fBTofCal[id]->getFPCounter(i);
00542 }
00543
00544 log << MSG::DEBUG << "BSigmaCounter id =" << id << " 1=" << fplayer[0] << " 2=" << fplayer[1] << " 3=" << fplayer[2] << " 4=" << fplayer[3] << " 5=" << fplayer[4] << endreq;
00545
00546 double sigma = fplayer[0] + fplayer[1]*z + fplayer[2]*z*z + fplayer[3]*z*z*z + fplayer[4]*z*z*z*z;
00547
00548 return sigma;
00549 }
00550
00551
00552 const double TofCaliSvc::BSigmaCluster(double z1, double z2, unsigned id1, unsigned id2) {
00553 double sigmaInner = BSigmaCounter(z1, id1);
00554 double sigmaInner2 = sigmaInner*sigmaInner;
00555 double sigmaOuter = BSigmaCounter(z2, id2);
00556 double sigmaOuter2 = sigmaOuter*sigmaOuter;
00557 double sigmaCorr = fBTofCommonCal[0]->getSigmaCorr(0);
00558 double sigmaCorr2 = sigmaCorr*sigmaCorr;
00559 double sigma = (sigmaInner2*sigmaOuter2-sigmaCorr2*sigmaCorr2)/(sigmaInner2+sigmaOuter2-2.0*sigmaCorr2);
00560 sigma = sqrt(sigma);
00561 return sigma;
00562 }
00563
00564
00565 const double TofCaliSvc::ETime(double ADC,double TDC,double rHit,unsigned id){
00566 MsgStream log(msgSvc(), name());
00567
00568 double p[nEndPar];
00569 for( int i=0; i<static_cast<int>(nEndPar); i++ ) {
00570 p[i]=fETofCal[id]->getP(i);
00571 }
00572
00573 log << MSG::DEBUG << "ETime id =" << id << " 1=" << p[0] << " 2=" << p[1] << " 3=" << p[2] << " 4=" << p[3] << " 5=" << p[4] << " 6=" << p[5] << " 7=" << p[6] << endreq;
00574
00575 double time=TDC-(p[0]+p[1]/TMath::Sqrt(ADC)+p[2]/ADC+p[3]*ADC+p[4]*rHit+p[5]*rHit*rHit+p[6]*rHit*rHit*rHit);
00576
00577 if(time<0.) {
00578 MsgStream log(msgSvc(), name());
00579 log<<MSG::WARNING<<"TofCaliSvc::ETime() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" r = "<< rHit <<" ID = "<<id<<endreq;
00580 }
00581
00582 return time;
00583 }
00584
00585
00586 const double TofCaliSvc::ESigma(double r, unsigned id) {
00587 MsgStream log(msgSvc(), name());
00588
00589 double fp[nEndSigma];
00590 for( int i=0; i<static_cast<int>(nEndSigma); i++) {
00591 fp[i]=fETofCal[id]->getFPCounter(i);
00592 }
00593
00594 log << MSG::DEBUG << "ESigma id =" << id << " 1=" << fp[0] << " 2=" << fp[1] << " 3=" << fp[2] << endreq;
00595
00596 double sigma = fp[0] + fp[1]*r + fp[2]*r*r;
00597
00598 return sigma;
00599 }
00600
00601
00602 const double TofCaliSvc::EtfTime(double ADC1,double ADC2,double TDC1,double TDC2,unsigned id,unsigned int strip,double t0){
00603 MsgStream log(msgSvc(), name());
00604
00605 double q = (ADC1+ADC2)/2.0;
00606 double t = (TDC1+TDC2)/2.0;
00607
00608 double p[nEtfPar];
00609 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
00610 p[i]=fEtfCal[12*id+strip]->getP(i);
00611 }
00612
00613 double tcorr = p[0]
00614 + p[1]/TMath::Sqrt(q)
00615 + p[2]/q
00616 + p[3]*q
00617 + p[4]*q*q
00618 + p[5]*q*q*q
00619 + p[6]*q*q*q*q;
00620 double time = t - tcorr;
00621
00622 int ibunch = static_cast<int>(t0/(8.0*12000./499.8/8./4. )+0.1)%4;
00623 double pbunch = EtfBunchP(ibunch);
00624
00625 time = time - pbunch;
00626
00627 log << MSG::DEBUG << "EtfTime module =" << id << " strip=" << strip << " 1=" << p[0] << " 2=" << p[1] << " 3=" << p[2] << " 4=" << p[3] << " 5=" << p[4] << " 6=" << p[5] << " 7=" << p[6] << " 8=" << p[7] << " 9=" << p[8] << " tcorr=" << tcorr << " t0=" << t0 << " pbunch=" << pbunch << " time=" << time << endreq;
00628
00629 return time;
00630 }
00631
00632
00633 const double TofCaliSvc::EtfTime1(double ADC,double TDC,double z,unsigned id,unsigned int strip,double t0){
00634 MsgStream log(msgSvc(), name());
00635
00636 double p1[nEtfPar];
00637 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
00638 p1[i]=fEtfCal[12*id+strip]->getP1(i);
00639 }
00640
00641 double tcorr1 = p1[0]
00642 + p1[1]/TMath::Sqrt(ADC)
00643 + p1[2]*ADC
00644 + p1[3]*ADC*ADC
00645 + p1[4]*ADC*ADC*ADC
00646 + p1[5]*ADC*ADC*ADC*ADC
00647 + p1[6]*z/TMath::Sqrt(ADC)
00648 + p1[7]/ADC
00649 + p1[8]*z/ADC
00650 + p1[9]*z*ADC
00651 + p1[10]*z
00652 + p1[11]*z*z
00653 + p1[12]*z*z*z;
00654 double time1 = TDC - tcorr1;
00655
00656 int ibunch = static_cast<int>(t0/(8.0*12000./499.8/8./4. )+0.1)%4;
00657 double pbunch = EtfBunchP(ibunch);
00658
00659 time1 = time1 - pbunch;
00660
00661 log << MSG::DEBUG << "EtfTime1 module =" << id << " strip=" << strip << " 1=" << p1[0] << " 2=" << p1[1] << " 3=" << p1[2] << " 4=" << p1[3] << " 5=" << p1[4] << " 6=" << p1[5] << " 7=" << p1[6] << " 8=" << p1[7] << " 9=" << p1[8] << " tcorr=" << tcorr1 << " t0=" << t0 << " pbunch=" << pbunch << " time1=" << time1 << endreq;
00662
00663 return time1;
00664 }
00665
00666
00667 const double TofCaliSvc::EtfTime2(double ADC,double TDC,double z,unsigned id,unsigned int strip,double t0){
00668 MsgStream log(msgSvc(), name());
00669
00670 double p2[nEtfPar];
00671 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
00672 p2[i]=fEtfCal[12*id+strip]->getP2(i);
00673 }
00674
00675 double tcorr2 = p2[0]
00676 + p2[1]/TMath::Sqrt(ADC)
00677 + p2[2]*ADC
00678 + p2[3]*ADC*ADC
00679 + p2[4]*ADC*ADC*ADC
00680 + p2[5]*ADC*ADC*ADC*ADC
00681 + p2[6]*z/TMath::Sqrt(ADC)
00682 + p2[7]/ADC
00683 + p2[8]*z/ADC
00684 + p2[9]*z*ADC
00685 + p2[10]*z
00686 + p2[11]*z*z
00687 + p2[12]*z*z*z;
00688 double time2 = TDC - tcorr2;
00689
00690 int ibunch = static_cast<int>(t0/(8.0*12000./499.8/8./4. )+0.1)%4;
00691 double pbunch = EtfBunchP(ibunch);
00692
00693 time2 = time2 - pbunch;
00694
00695 log << MSG::DEBUG << "EtfTime2 module =" << id << " strip=" << strip << " 1=" << p2[0] << " 2=" << p2[1] << " 3=" << p2[2] << " 4=" << p2[3] << " 5=" << p2[4] << " 6=" << p2[5] << " 7=" << p2[6] << " 8=" << p2[7] << " 9=" << p2[8] << " tcorr=" << tcorr2 << " t0=" << t0 << " pbunch=" << pbunch << " time2=" << time2 << endreq;
00696
00697 return time2;
00698 }
00699
00700
00701 const double TofCaliSvc::EtfTimeMC(double ADC1,double ADC2,double TDC1,double TDC2,unsigned id,unsigned int strip,double t0){
00702 MsgStream log(msgSvc(), name());
00703
00704 double q = (ADC1+ADC2)/2.0;
00705 double t = (TDC1+TDC2)/2.0;
00706
00707 double p[nEtfPar];
00708 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
00709 p[i]=fEtfCal[12*id+strip]->getP(i);
00710 }
00711
00712 double tcorr = p[0] + p[1]/TMath::Sqrt(q);
00713 double time = t - tcorr;
00714
00715 log << MSG::DEBUG << "EtfTime module =" << id << " strip=" << strip << " 1=" << p[0] << " 2=" << p[1] << " tcorr=" << tcorr << " t0=" << t0 << " time=" << time << endreq;
00716
00717 return time;
00718 }
00719
00720
00721 const double TofCaliSvc::EtfTimeMC1(double ADC,double TDC,double z,unsigned id,unsigned int strip,double t0){
00722 MsgStream log(msgSvc(), name());
00723
00724 double p1[nEtfPar];
00725 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
00726 p1[i]=fEtfCal[12*id+strip]->getP1(i);
00727 }
00728
00729 double tcorr1 = p1[0] + p1[1]/TMath::Sqrt(ADC) + p1[2]*z;
00730 double time1 = TDC - tcorr1;
00731
00732 log << MSG::DEBUG << "EtfTime1 module =" << id << " strip=" << strip << " 1=" << p1[0] << " 2=" << p1[1] << " 3=" << p1[2] << " tcorr=" << tcorr1 << " t0=" << t0 << " time1=" << time1 << endreq;
00733
00734 return time1;
00735 }
00736
00737
00738 const double TofCaliSvc::EtfTimeMC2(double ADC,double TDC,double z,unsigned id,unsigned int strip,double t0){
00739 MsgStream log(msgSvc(), name());
00740
00741 double p2[nEtfPar];
00742 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
00743 p2[i]=fEtfCal[12*id+strip]->getP2(i);
00744 }
00745
00746 double tcorr2 = p2[0] + p2[1]/TMath::Sqrt(ADC) + p2[2]*z;
00747 double time2 = TDC - tcorr2;
00748
00749 log << MSG::DEBUG << "EtfTime2 module =" << id << " strip=" << strip << " 1=" << p2[0] << " 2=" << p2[1] << " 3=" << p2[2] << " tcorr=" << tcorr2 << " t0=" << t0 << " time2=" << time2 << endreq;
00750
00751 return time2;
00752 }
00753
00754
00755 const double TofCaliSvc::EtfTime(double tleft,double tright){
00756 MsgStream log(msgSvc(), name());
00757
00758 double time = (tleft+tright)/2.0;
00759 log << MSG::DEBUG << "EtfTime tleft=" << tleft << " tright=" << tright << " time=" << time << endreq;
00760
00761 return time;
00762 }
00763
00764
00765 const double TofCaliSvc::EtfBunchP(int index){
00766 MsgStream log(msgSvc(), name());
00767
00768 double pbunch = 0.0;
00769 if( fEtfBunchCal.size()>0 && index>=0 && index<4 ) {
00770 pbunch=fEtfBunchCal[0]->getBunchP(index);
00771 }
00772
00773 return pbunch;
00774 }
00775
00776
00777 const double TofCaliSvc::BPulseHeight1( double ADC, double zHit, double sint, unsigned int id ) {
00778 double length = 230.0;
00779 double A = 1.0;
00780 double Latten = fBTofCal[id]->getAtten(0);
00781 double q0 = ADC*sint*TMath::Exp((0.5*length-zHit)/Latten)/A;
00782 return q0;
00783 }
00784
00785
00786 const double TofCaliSvc::BPulseHeight2( double ADC, double zHit, double sint, unsigned int id ) {
00787 double length = 230.0;
00788 double A = 1.0;
00789 double Latten = fBTofCal[id]->getAtten(0);
00790 double q0 = ADC*sint*TMath::Exp((0.5*length+zHit)/Latten)/A;
00791 return q0;
00792 }
00793
00794
00795 const double TofCaliSvc::BPulseHeight( double ADC1, double ADC2, double zHit, double sint, unsigned int id ) {
00796 double length = 230.0;
00797 double Latten = fBTofCal[id]->getAtten(0);
00798 double gainRatio = fBTofCal[id]->getAtten(1);
00799 double A2 = fBTofCal[id]->getAtten(2);
00800 double q = ( ADC1*sint*TMath::Exp((0.5*length-zHit)/Latten)+ADC2*sint*TMath::Exp((0.5*length+zHit)/Latten) )/( A2*(1.0+TMath::Exp(gainRatio)) );
00801 return q;
00802 }
00803
00804
00805 const double TofCaliSvc::BPh( double ADC1, double ADC2, double zHit, unsigned int id ) {
00806 double length = 230.0;
00807 double Latten = fBTofCal[id]->getAtten(0);
00808 double gainRatio = fBTofCal[id]->getAtten(1);
00809 double q = ( ADC1*TMath::Exp((0.5*length-zHit)/Latten)+ADC2*TMath::Exp((0.5*length+zHit)/Latten) )/(1.0+TMath::Exp(gainRatio));
00810 return q;
00811 }
00812
00813
00814 const double TofCaliSvc::EPulseHeight( double ADC, double rHit, double cost, unsigned int id ) {
00815 double length = 44.5;
00816 double a0 = fETofCal[id]->getAtten(0);
00817 double a1 = fETofCal[id]->getAtten(1);
00818 double a2 = fETofCal[id]->getAtten(2);
00819 double a3 = fETofCal[id]->getAtten(3);
00820
00821 double q0 = ADC*fabs(cost)*TMath::Exp(-(a1*(rHit-length)+a2*(rHit-length)*(rHit-length)))/a3;
00822
00823 return q0;
00824 }
00825
00826
00827 const double TofCaliSvc::EPh( double ADC, double rHit, unsigned int id ) {
00828 double length = 44.5;
00829 double a0 = fETofCal[id]->getAtten(0);
00830 double a1 = fETofCal[id]->getAtten(1);
00831 double a2 = fETofCal[id]->getAtten(2);
00832 double q0 = ADC*TMath::Exp(-(a0+a1*(rHit-length)+a2*(rHit-length)*(rHit-length)));
00833 return q0;
00834 }
00835
00836
00837 const double TofCaliSvc::getQ0(unsigned id){
00838 return fBTofCal[id]->getAtten(3);
00839 }
00840
00841
00842 const double TofCaliSvc::BVeff(unsigned id){
00843 if(id<176){
00844 return fBTofCal[id]->getVeff(0);
00845 }else{
00846 std::cout<<"bad id="<<id<<std::endl;
00847 return 0.;}
00848 }
00849
00850
00851 const double TofCaliSvc::BAtten(unsigned id){
00852 if( id > 175 ) return -1;
00853 return fBTofCal[id]->getAtten(0);
00854 }
00855
00856 const double TofCaliSvc::BGainForward(unsigned id){
00857 if( id > 175 ) return -1;
00858 double gainRatio = fBTofCal[id]->getAtten(1);
00859 double A2 = fBTofCal[id]->getAtten(2);
00860 double A1 = A2*TMath::Exp(gainRatio);
00861 return A1;
00862 }
00863
00864 const double TofCaliSvc::BGainBackward(unsigned id){
00865 if( id > 175 ) return -1;
00866 return fBTofCal[id]->getAtten(2);
00867 }
00868
00869 const double TofCaliSvc::EVeff(unsigned id){
00870 if( id > 175 ) return -1;
00871 return fETofCal[id]->getVeff(0);
00872 }
00873
00874 const double TofCaliSvc::EtfVeff(unsigned int id, unsigned int strip){
00875 if(id<72 && strip<12){
00876 return fEtfCal[12*id+strip]->getVeff(0);
00877 }else{
00878 std::cout<<"bad id="<<id<<" strip="<<strip<<std::endl;
00879 return 0.;
00880 }
00881 }
00882
00883
00884 const double TofCaliSvc::ZTDC(double tleft, double tright, unsigned id) {
00885 double ztdc = -1000.0;
00886 if( id > 175 ) return ztdc;
00887 double veff = fBTofCal[id]->getVeff(0);
00888 double delay = fBTofCal[id]->getVeff(1);
00889 ztdc = 0.5*veff*(tright-tleft-delay);
00890 return ztdc;
00891 }
00892
00893 const double TofCaliSvc::ZTDC1(double tright, unsigned id, double z) {
00894 double tleft = -1000.0;
00895 if( id > 175 ) return tleft;
00896 if( tright < -900.0 ) return tleft;
00897 double veff = fBTofCal[id]->getVeff(0);
00898 double delay = fBTofCal[id]->getVeff(1);
00899 tleft = tright-delay-2.0*z/veff;
00900 return tleft;
00901 }
00902
00903 const double TofCaliSvc::ZTDC2(double tleft, unsigned id, double z) {
00904 double tright = -1000.0;
00905 if( id > 175 ) return tright;
00906 if( tleft < -900.0 ) return tright;
00907 double veff = fBTofCal[id]->getVeff(0);
00908 double delay = fBTofCal[id]->getVeff(1);
00909 tright = tleft+delay+2.0*z/veff;
00910 return tright;
00911 }
00912
00913 const double TofCaliSvc::ZADC(double qleft, double qright, unsigned id) {
00914 double zadc = -1000.0;
00915 if( id > 175 ) return zadc;
00916 if( qright < 1.0e-6 ) return zadc;
00917 double ldecay = fBTofCal[id]->getAtten(0);
00918 double a1overa2 = fBTofCal[id]->getAtten(1);
00919 double q1overq2 = log(qleft/qright);
00920 zadc = 0.5*ldecay*( q1overq2 - a1overa2 );
00921 return zadc;
00922 }
00923
00924 const double TofCaliSvc::ZADC1(double qright, unsigned id, double z) {
00925 double qleft = -1000.0;
00926 if( id > 175 ) return qleft;
00927 if( qright < 1.0e-6 ) return qleft;
00928 double ldecay = fBTofCal[id]->getAtten(0);
00929 double a1overa2 = fBTofCal[id]->getAtten(1);
00930 double q1overq2 = 2.0*z/ldecay + a1overa2;
00931 qleft = qright*exp(q1overq2);
00932 return qleft;
00933 }
00934
00935 const double TofCaliSvc::ZADC2(double qleft, unsigned id, double z) {
00936 double qright = -1000.0;
00937 if( id > 175 ) return qright;
00938 if( qleft < 1.0e-6 ) return qright;
00939 double ldecay = fBTofCal[id]->getAtten(0);
00940 double a1overa2 = fBTofCal[id]->getAtten(1);
00941 double q1overq2 = 2.0*z/ldecay + a1overa2;
00942 qright = qleft*exp(-q1overq2);
00943 return qright;
00944 }
00945
00946 const double TofCaliSvc::EtfZTDC(double tleft, double tright, unsigned id, unsigned int strip) {
00947 double ztdc = -1000.0;
00948 if( id>71 || strip>11 ) return ztdc;
00949 double delay = fEtfCal[12*id+strip]->getVeff(0);
00950 double veff = fEtfCal[12*id+strip]->getVeff(1);
00951 ztdc = (tright-tleft-delay)/veff;
00952 return ztdc;
00953 }
00954
00955
00956 const double TofCaliSvc::EAtten(unsigned id){
00957 if( id > 95 ) return -1;
00958 return fETofCal[id]->getAtten(0);
00959 }
00960
00961 const double TofCaliSvc::EGain(unsigned id){
00962 if( id > 95 ) return -1;
00963 return fETofCal[id]->getAtten(1);
00964 }
00965
00966 const int TofCaliSvc::RunBegin() {
00967 return fTofInfoCal[0]->getRunBegin();
00968 }
00969
00970 const int TofCaliSvc::RunEnd() {
00971 return fTofInfoCal[0]->getRunEnd();
00972 }
00973
00974 const int TofCaliSvc::Version() {
00975 return fTofInfoCal[0]->getVersion();
00976 }
00977
00978 const int TofCaliSvc::QCorr() {
00979 return fTofInfoCal[0]->getQCorr();
00980 }
00981
00982 const int TofCaliSvc::QElec() {
00983 return fTofInfoCal[0]->getQElec();
00984 }
00985
00986 const int TofCaliSvc::MisLable() {
00987 return fTofInfoCal[0]->getMisLable();
00988 }
00989
00990 const int TofCaliSvc::BrEast(unsigned int im) {
00991 return fTofInfoCal[0]->getBrEast(im);
00992 }
00993
00994 const int TofCaliSvc::BrWest(unsigned int im) {
00995 return fTofInfoCal[0]->getBrWest(im);
00996 }
00997
00998 const int TofCaliSvc::Endcap(unsigned int im) {
00999 return fTofInfoCal[0]->getEndcap(im);
01000 }
01001
01002 const int TofCaliSvc::Etf(unsigned int im) {
01003 return fTofInfoCal[0]->getEndcap(im);
01004 }
01005
01006 BTofCal* TofCaliSvc::BTof(unsigned id) const{
01007 return fBTofCal[id];
01008 }
01009
01010 ETofCal* TofCaliSvc::ETof(unsigned id) const{
01011 return fETofCal[id];
01012 }
01013
01014 EtfCal* TofCaliSvc::EtfTof(unsigned id) const{
01015 return fEtfCal[id];
01016 }
01017
01018 BTofCommonCal* TofCaliSvc::BTofCommon() const{
01019 return fBTofCommonCal[0];
01020 }
01021
01022 TofInfoCal* TofCaliSvc::TofInfo() const{
01023 return fTofInfoCal[0];
01024 }
01025
01026 void TofCaliSvc::Dump(){
01027 std::cout<<"Now We can get the TOF Calibtration Service"<<std::endl;
01028 std::cout<<"Barrel TOF Counter Number = "<<fBTofCal.size()<<std::endl;
01029 std::cout<<"Endcap TOF Counter Number = "<<fETofCal.size()<<std::endl;
01030
01031 cout<<"The O Barrel TOF PMT1 p1[0] is"<<" "<<BTof(0)->getP1(0)<<endl;
01032 cout<<"The 0 Barrel TOF PMT1 p1[1] is"<<" "<<BTof(0)->getP1(1)<<endl;
01033 cout<<"The 0 Barrel TOF veff is"<<" "<<BTof(0)->getVeff(0)<<endl;
01034
01035 }
01036
01037 void TofCaliSvc::handle(const Incident& inc){
01038 MsgStream log( messageService(), name() );
01039 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
01040
01041 if ( inc.type() == "NewRun" ){
01042 log << MSG::DEBUG << "New Run" << endreq;
01043
01044 StatusCode sc= FillfromDatabase();
01045 if(sc.isSuccess()){
01046 m_hasbeeninitialized=true;
01047 }
01048
01049 }
01050 }