13#include "TofCaliSvc/BTofCal.h"
14#include "TofCaliSvc/BTofCommonCal.h"
15#include "TofCaliSvc/ETofCal.h"
16#include "TofCaliSvc/TofInfoCal.h"
17#include "GaudiKernel/Kernel.h"
18#include "GaudiKernel/IInterface.h"
19#include "GaudiKernel/StatusCode.h"
21#include "GaudiKernel/SvcFactory.h"
22#include "GaudiKernel/MsgStream.h"
27#include "GaudiKernel/IIncidentSvc.h"
28#include "GaudiKernel/Incident.h"
29#include "GaudiKernel/IIncidentListener.h"
30#include "GaudiKernel/IDataProviderSvc.h"
31#include "GaudiKernel/Service.h"
32#include "GaudiKernel/MsgStream.h"
33#include "GaudiKernel/SmartDataPtr.h"
37#include "GaudiKernel/DataSvc.h"
45 declareProperty(
"Run",m_run=1);
49 if ( IID_ITofCaliSvc.versionMatch(riid) ) {
52 return Service::queryInterface(riid, ppvInterface) ;
54 return StatusCode::SUCCESS;
58 m_hasbeeninitialized=
false;
60 MsgStream log(
msgSvc(), name());
61 log << MSG::INFO << name() <<
": Start of run initialisation" << endreq;
63 StatusCode sc = Service::initialize();
64 if ( sc.isFailure() )
return sc;
67 sc = service(
"IncidentSvc", incsvc);
70 incsvc -> addListener(
this,
"NewRun", priority);
75 log<<MSG::INFO <<
"setProperties()" << endreq;
76 scc = service(
"CalibDataSvc", m_pCalibDataSvc,
true);
77 if ( !scc.isSuccess() ) {
78 log<<MSG::ERROR<<
"Could not get IDataProviderSvc interface of CalibXmlCnvSvc"<<endreq;
81 log << MSG::DEBUG<<
"Retrieved IDataProviderSvc interface of CalibXmlCnvSvc"<<endreq;
84 scc = setProperties();
90 MsgStream log(
msgSvc(), name());
91 log << MSG::INFO << name() <<
": End of Run" << endreq;
92 return StatusCode::SUCCESS;
96 for(vector<BTofCal*>::iterator it1 = fBTofCal.begin(); it1 != fBTofCal.end(); it1++) {
delete (*it1); }
98 for(vector<ETofCal*>::iterator it2 = fETofCal.begin(); it2 != fETofCal.end(); it2++) {
delete (*it2); }
100 for(vector<BTofCommonCal*>::iterator it3 = fBTofCommonCal.begin(); it3 != fBTofCommonCal.end(); it3++) {
delete (*it3); }
101 fBTofCommonCal.clear();
102 for(vector<TofInfoCal*>::iterator it4 = fTofInfoCal.begin(); it4 != fTofInfoCal.end(); it4++) {
delete (*it4); }
106StatusCode TofCaliSvc::FillfromDatabase(){
108 MsgStream log(
msgSvc(), name());
109 std::string fullPath =
"/Calib/TofCal";
110 log << MSG::INFO<<
" Tof calib fullPath = "<<fullPath<< endreq;
111 SmartDataPtr<CalibData::TofCalibData>
test(m_pCalibDataSvc, fullPath);
113 log << MSG::FATAL <<
"TofCaliSvc could not find TofCalibData in TCDS!!" << endreq;
114 return StatusCode::FAILURE;
117 for(vector<BTofCal*>::iterator it1 = fBTofCal.begin(); it1 != fBTofCal.end(); it1++) {
delete (*it1); }
119 for(vector<ETofCal*>::iterator it2 = fETofCal.begin(); it2 != fETofCal.end(); it2++) {
delete (*it2); }
121 for(vector<BTofCommonCal*>::iterator it3 = fBTofCommonCal.begin(); it3 != fBTofCommonCal.end(); it3++) {
delete (*it3); }
122 fBTofCommonCal.clear();
123 for(vector<TofInfoCal*>::iterator it4 = fTofInfoCal.begin(); it4 != fTofInfoCal.end(); it4++) {
delete (*it4); }
126 for(
int ib=0;ib<176;ib++){
128 for(
int j=0; j<static_cast<int>(
nBarAtten); j++ ) {
131 for(
int j=0; j<static_cast<int>(
nBarSpeed); j++ ) {
134 for(
int j=0; j<static_cast<int>(
nBarPar); j++){
136 btof->
setP2(j,
test->getBTofPright(ib,j));
138 for(
int j=0; j<static_cast<int>(
nBarParOff); j++){
148 for(
int j=0; j<static_cast<int>(
nBarSigma); j++){
152 for(
int j=0; j<static_cast<int>(
nBarSigCnt); j++){
156 fBTofCal.push_back(btof);
159 for(
int ie=0;ie<96;ie++){
161 for(
int j=0; j<static_cast<int>(
nEndAtten); j++ ) {
164 for(
int j=0; j<static_cast<int>(
nEndSpeed); j++ ) {
167 for(
int j=0; j<static_cast<int>(
nEndPar); j++ ) {
170 for(
int j=0; j<static_cast<int>(
nEndSigma); j++ ) {
173 fETofCal.push_back(etof);
177 for(
int i=0; i<static_cast<int>(
nBarOffset); i++) {
180 for(
int i=0; i<static_cast<int>(
nBarSigCor); i++) {
183 fBTofCommonCal.push_back(bcomtof);
192 for(
unsigned int i=0; i<5; i++ ) {
197 fTofInfoCal.push_back(tofinfo);
199 return StatusCode::SUCCESS;
207 tdelay = fBTofCal[id]->getP1(0);
210 MsgStream log(
msgSvc(), name());
211 log<<MSG::ERROR<<
"TofCaliSvc::BTDelay1() -- Wrong TOFID is provided! ID = "<<
id<<endreq;
220 tdelay = fBTofCal[id]->getP2(0);
223 MsgStream log(
msgSvc(), name());
224 log<<MSG::ERROR<<
"TofCaliSvc::BTDelay2() -- Wrong TOFID is provided! ID = "<<
id<<endreq;
233 tdelay = fETofCal[id]->getP(0);
236 MsgStream log(
msgSvc(), name());
237 log<<MSG::ERROR<<
"TofCaliSvc::ETDelay() -- Wrong TOFID is provided! ID = "<<
id<<endreq;
244 MsgStream log(
msgSvc(), name());
247 for(
int i=0; i<static_cast<int>(
nBarPar); i++ ) {
248 p1[i]=fBTofCal[id]->getP1(i);
251 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;
253 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;
260 MsgStream log(
msgSvc(), name());
263 for(
int i=0; i<static_cast<int>(
nBarPar); i++ ) {
264 p2[i]=fBTofCal[id]->getP2(i);
267 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;
269 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;
276 MsgStream log(
msgSvc(), name());
278 int numBunch = fTofInfoCal[0]->getRunEnd();
279 int whichBunch = (
static_cast<int>(t0/(12000./499.8/(numBunch*1.0))+0.1))%numBunch;
282 if( whichBunch==0 ) {
283 for(
int i=0; i<static_cast<int>(
nBarParOff); i++ ) {
284 poff1[i]=fBTofCal[id]->getPOff1_bunch0(i);
287 else if( whichBunch==1 ) {
288 for(
int i=0; i<static_cast<int>(
nBarParOff); i++ ) {
289 poff1[i]=fBTofCal[id]->getPOff1_bunch1(i);
292 else if( whichBunch==2 ) {
293 for(
int i=0; i<static_cast<int>(
nBarParOff); i++ ) {
294 poff1[i]=fBTofCal[id]->getPOff1_bunch2(i);
297 else if( whichBunch==3 ) {
298 for(
int i=0; i<static_cast<int>(
nBarParOff); i++ ) {
299 poff1[i]=fBTofCal[id]->getPOff1_bunch3(i);
303 double tCorrOffset1 = 0.0;
305 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;
308 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;
311 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;
318 MsgStream log(
msgSvc(), name());
320 int numBunch = fTofInfoCal[0]->getRunEnd();
321 int whichBunch = (
static_cast<int>(t0/(12000./499.8/(numBunch*1.0))+0.1))%numBunch;
324 if( whichBunch==0 ) {
325 for(
int i=0; i<static_cast<int>(
nBarParOff); i++ ) {
326 poff2[i]=fBTofCal[id]->getPOff2_bunch0(i);
329 else if( whichBunch==1 ) {
330 for(
int i=0; i<static_cast<int>(
nBarParOff); i++ ) {
331 poff2[i]=fBTofCal[id]->getPOff2_bunch1(i);
334 else if( whichBunch==2 ) {
335 for(
int i=0; i<static_cast<int>(
nBarParOff); i++ ) {
336 poff2[i]=fBTofCal[id]->getPOff2_bunch2(i);
339 else if( whichBunch==3 ) {
340 for(
int i=0; i<static_cast<int>(
nBarParOff); i++ ) {
341 poff2[i]=fBTofCal[id]->getPOff2_bunch3(i);
345 double tCorrOffset2 = 0.0;
347 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;
350 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;
353 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;
360 double toffset = fBTofCommonCal[0]->getOffset(0);
366 MsgStream log(
msgSvc(), name());
368 double tcorr1 =
BTCorr1( ADC, z,
id );
370 double tcorr3 = fBTofCommonCal[0]->getOffset(0);
372 log << MSG::DEBUG <<
"BTime1 id =" <<
id <<
" tcorr=" << tcorr1 <<
" toffset=" << tcorr2 <<
" total offset=" << tcorr3 << endreq;
374 double time = TDC - tcorr1 - tcorr2 - tcorr3;
377 log<<MSG::WARNING<<
"TofCaliSvc::BTime1() -- A minus time is given : "<<
time <<
" [Input] ADC = "<<ADC<<
" TDC = "<<TDC<<
" z = "<<z<<
" ID = "<<
id<<endreq;
384 MsgStream log(
msgSvc(), name());
386 double tcorr1 =
BTCorr2( ADC, z,
id );
388 double tcorr3 = fBTofCommonCal[0]->getOffset(0);
390 log << MSG::DEBUG <<
"BTime2 id =" <<
id <<
" tcorr=" << tcorr1 <<
" toffset=" << tcorr2 <<
" total offset=" << tcorr3 << endreq;
392 double time = TDC - tcorr1 - tcorr2 - tcorr3;
395 log<<MSG::WARNING<<
"TofCaliSvc::BTime2() -- A minus time is given : "<<
time <<
" [Input] ADC = "<<ADC<<
" TDC = "<<TDC<<
" z = "<<z<<
" ID = "<<
id<<endreq;
420 double sigmaCorr = fBTofCommonCal[0]->getSigmaCorr(0);
421 double sigmaCorr2 = sigmaCorr*sigmaCorr;
423 double sigmaLeft =
BSigma1( z,
id );
424 double sigmaLeft2 = sigmaLeft*sigmaLeft;
425 double sigmaRight =
BSigma2( z,
id );
426 double sigmaRight2 = sigmaRight*sigmaRight;
428 double fraction = ( sigmaRight2 - sigmaCorr2 )/( sigmaLeft2 + sigmaRight2 - 2.0*sigmaCorr2);
430 double wt=fraction*tleft + (1.0-fraction)*tright;
432 MsgStream log(
msgSvc(), name());
433 log<<MSG::WARNING<<
"TofCaliSvc::BTimeCounter() -- A minus time is given : "<<wt <<
" [Input] z = "<<z<<
" ID = "<<
id<<endreq;
441 double sigmaCorr = fBTofCommonCal[0]->getSigmaCorr(0);
442 double sigmaCorr2 = sigmaCorr*sigmaCorr;
445 double sigmaInner2 = sigmaInner*sigmaInner;
447 double sigmaOuter2 = sigmaOuter*sigmaOuter;
449 double fraction = ( sigmaOuter2 - sigmaCorr2 )/( sigmaInner2 + sigmaOuter2 - 2.0*sigmaCorr2);
451 double wt=fraction*tlayer1 + (1.0-fraction)*tlayer2;
453 MsgStream log(
msgSvc(), name());
454 log<<MSG::WARNING<<
"TofCaliSvc::BTimeCluster() -- A minus time is given : "<<wt <<
" [Input] z1 = "<<z1<<
" [Input] z2 = "<<z2<<
" ID1 = "<< id1 <<
" ID2=" << id2 << endreq;
461 MsgStream log(
msgSvc(), name());
464 for(
int i=0; i<static_cast<int>(
nBarSigma); i++ ) {
465 fpleft[i]=fBTofCal[id]->getFPLeft(i);
468 log << MSG::DEBUG <<
"BSigma1 id =" <<
id <<
" 1=" << fpleft[0] <<
" 2=" << fpleft[1] <<
" 3=" << fpleft[2] <<
" 4=" << fpleft[3] <<
" 5=" << fpleft[4] << endreq;
470 double sigmaLeft = fpleft[0] + fpleft[1]*z + fpleft[2]*z*z + fpleft[3]*z*z*z + fpleft[4]*z*z*z*z;
477 MsgStream log(
msgSvc(), name());
480 for(
int i=0; i<static_cast<int>(
nBarSigma); i++ ) {
481 fpright[i]=fBTofCal[id]->getFPRight(i);
484 log << MSG::DEBUG <<
"BSigma2 id =" <<
id <<
" 1=" << fpright[0] <<
" 2=" << fpright[1] <<
" 3=" << fpright[2] <<
" 4=" << fpright[3] <<
" 5=" << fpright[4] << endreq;
486 double sigmaRight = fpright[0] + fpright[1]*z + fpright[2]*z*z + fpright[3]*z*z*z + fpright[4]*z*z*z*z;
493 MsgStream log(
msgSvc(), name());
496 for(
int i=0; i<static_cast<int>(
nBarSigCnt); i++ ) {
497 fplayer[i]=fBTofCal[id]->getFPCounter(i);
500 log << MSG::DEBUG <<
"BSigmaCounter id =" <<
id <<
" 1=" << fplayer[0] <<
" 2=" << fplayer[1] <<
" 3=" << fplayer[2] <<
" 4=" << fplayer[3] <<
" 5=" << fplayer[4] << endreq;
502 double sigma = fplayer[0] + fplayer[1]*z + fplayer[2]*z*z + fplayer[3]*z*z*z + fplayer[4]*z*z*z*z;
510 double sigmaInner2 = sigmaInner*sigmaInner;
512 double sigmaOuter2 = sigmaOuter*sigmaOuter;
513 double sigmaCorr = fBTofCommonCal[0]->getSigmaCorr(0);
514 double sigmaCorr2 = sigmaCorr*sigmaCorr;
515 double sigma = (sigmaInner2*sigmaOuter2-sigmaCorr2*sigmaCorr2)/(sigmaInner2+sigmaOuter2-2.0*sigmaCorr2);
522 MsgStream log(
msgSvc(), name());
525 for(
int i=0; i<static_cast<int>(
nEndPar); i++ ) {
526 p[i]=fETofCal[id]->getP(i);
529 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;
531 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);
534 MsgStream log(
msgSvc(), name());
535 log<<MSG::WARNING<<
"TofCaliSvc::ETime() -- A minus time is given : "<<
time <<
" [Input] ADC = "<<ADC<<
" TDC = "<<TDC<<
" r = "<< rHit <<
" ID = "<<
id<<endreq;
543 MsgStream log(
msgSvc(), name());
546 for(
int i=0; i<static_cast<int>(
nEndSigma); i++) {
547 fp[i]=fETofCal[id]->getFPCounter(i);
550 log << MSG::DEBUG <<
"ESigma id =" <<
id <<
" 1=" << fp[0] <<
" 2=" << fp[1] <<
" 3=" << fp[2] << endreq;
552 double sigma = fp[0] + fp[1]*r + fp[2]*r*r;
559 double length = 230.0;
561 double Latten = fBTofCal[id]->getAtten(0);
562 double q0 = ADC*sint*TMath::Exp((0.5*length-zHit)/Latten)/A;
568 double length = 230.0;
570 double Latten = fBTofCal[id]->getAtten(0);
571 double q0 = ADC*sint*TMath::Exp((0.5*length+zHit)/Latten)/A;
577 double length = 230.0;
578 double Latten = fBTofCal[id]->getAtten(0);
579 double gainRatio = fBTofCal[id]->getAtten(1);
580 double A2 = fBTofCal[id]->getAtten(2);
581 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)) );
586const double TofCaliSvc::BPh(
double ADC1,
double ADC2,
double zHit,
unsigned int id ) {
587 double length = 230.0;
588 double Latten = fBTofCal[id]->getAtten(0);
589 double gainRatio = fBTofCal[id]->getAtten(1);
590 double q = ( ADC1*TMath::Exp((0.5*length-zHit)/Latten)+ADC2*TMath::Exp((0.5*length+zHit)/Latten) )/(1.0+TMath::Exp(gainRatio));
596 double length = 44.5;
597 double a0 = fETofCal[id]->getAtten(0);
598 double a1 = fETofCal[id]->getAtten(1);
599 double a2 = fETofCal[id]->getAtten(2);
600 double a3 = fETofCal[id]->getAtten(3);
602 double q0 = ADC*fabs(cost)*TMath::Exp(-(a1*(rHit-length)+a2*(rHit-length)*(rHit-length)))/a3;
609 double length = 44.5;
610 double a0 = fETofCal[id]->getAtten(0);
611 double a1 = fETofCal[id]->getAtten(1);
612 double a2 = fETofCal[id]->getAtten(2);
613 double q0 = ADC*TMath::Exp(-(a0+a1*(rHit-length)+a2*(rHit-length)*(rHit-length)));
619 return fBTofCal[id]->getAtten(3);
625 return fBTofCal[id]->getVeff(0);
627 std::cout<<
"bad id="<<
id<<std::endl;
633 if(
id > 175 )
return -1;
634 return fBTofCal[id]->getAtten(0);
638 if(
id > 175 )
return -1;
639 double gainRatio = fBTofCal[id]->getAtten(1);
640 double A2 = fBTofCal[id]->getAtten(2);
641 double A1 = A2*TMath::Exp(gainRatio);
646 if(
id > 175 )
return -1;
647 return fBTofCal[id]->getAtten(2);
651 if(
id > 175 )
return -1;
652 return fETofCal[id]->getVeff(0);
656 double ztdc = -1000.0;
657 if(
id > 175 )
return ztdc;
658 double veff = fBTofCal[id]->getVeff(0);
659 double delay = fBTofCal[id]->getVeff(1);
660 ztdc = 0.5*veff*(tright-tleft-delay);
665 double tleft = -1000.0;
666 if(
id > 175 )
return tleft;
667 if( tright < -900.0 )
return tleft;
668 double veff = fBTofCal[id]->getVeff(0);
669 double delay = fBTofCal[id]->getVeff(1);
670 tleft = tright-delay-2.0*z/veff;
675 double tright = -1000.0;
676 if(
id > 175 )
return tright;
677 if( tleft < -900.0 )
return tright;
678 double veff = fBTofCal[id]->getVeff(0);
679 double delay = fBTofCal[id]->getVeff(1);
680 tright = tleft+delay+2.0*z/veff;
685 double zadc = -1000.0;
686 if(
id > 175 )
return zadc;
687 if( qright < 1.0e-6 )
return zadc;
688 double ldecay = fBTofCal[id]->getAtten(0);
689 double a1overa2 = fBTofCal[id]->getAtten(1);
690 double q1overq2 = log(qleft/qright);
691 zadc = 0.5*ldecay*( q1overq2 - a1overa2 );
696 double qleft = -1000.0;
697 if(
id > 175 )
return qleft;
698 if( qright < 1.0e-6 )
return qleft;
699 double ldecay = fBTofCal[id]->getAtten(0);
700 double a1overa2 = fBTofCal[id]->getAtten(1);
701 double q1overq2 = 2.0*z/ldecay + a1overa2;
702 qleft = qright*
exp(q1overq2);
707 double qright = -1000.0;
708 if(
id > 175 )
return qright;
709 if( qleft < 1.0e-6 )
return qright;
710 double ldecay = fBTofCal[id]->getAtten(0);
711 double a1overa2 = fBTofCal[id]->getAtten(1);
712 double q1overq2 = 2.0*z/ldecay + a1overa2;
713 qright = qleft*
exp(-q1overq2);
718 if(
id > 95 )
return -1;
719 return fETofCal[id]->getAtten(0);
723 if(
id > 95 )
return -1;
724 return fETofCal[id]->getAtten(1);
728 return fTofInfoCal[0]->getRunBegin();
732 return fTofInfoCal[0]->getRunEnd();
736 return fTofInfoCal[0]->getVersion();
740 return fTofInfoCal[0]->getQCorr();
744 return fTofInfoCal[0]->getQElec();
748 return fTofInfoCal[0]->getMisLable();
752 return fTofInfoCal[0]->getBrEast(im);
756 return fTofInfoCal[0]->getBrWest(im);
760 return fTofInfoCal[0]->getEndcap(im);
772 return fBTofCommonCal[0];
776 return fTofInfoCal[0];
780 std::cout<<
"Now We can get the TOF Calibtration Service"<<std::endl;
781 std::cout<<
"Barrel TOF Counter Number = "<<fBTofCal.size()<<std::endl;
782 std::cout<<
"Endcap TOF Counter Number = "<<fETofCal.size()<<std::endl;
784 cout<<
"The O Barrel TOF PMT1 p1[0] is"<<
" "<<
BTof(0)->
getP1(0)<<endl;
785 cout<<
"The 0 Barrel TOF PMT1 p1[1] is"<<
" "<<
BTof(0)->
getP1(1)<<endl;
786 cout<<
"The 0 Barrel TOF veff is"<<
" "<<
BTof(0)->
getVeff(0)<<endl;
791 MsgStream log( messageService(), name() );
792 log << MSG::DEBUG <<
"handle: " << inc.type() << endreq;
794 if ( inc.type() ==
"NewRun" ){
795 log << MSG::DEBUG <<
"New Run" << endreq;
797 StatusCode sc= FillfromDatabase();
799 m_hasbeeninitialized=
true;
EvtComplex exp(const EvtComplex &c)
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nBarPar
const unsigned int nBarSigma
const unsigned int nEndSigma
const unsigned int nBarSigCor
const unsigned int nEndSpeed
const unsigned int nBarSpeed
const unsigned int nEndAtten
const unsigned int nBarAtten
const unsigned int nBarSigCnt
void setPOff1_bunch0(int idx, double poff1_bunch0)
void setPOff2_bunch1(int idx, double poff2_bunch1)
void setPOff1_bunch2(int idx, double poff1_bunch2)
void setAtten(int idx, double atten)
double getP1(int idx) const
void setFPCounter(int idx, double fp3)
void setPOff1_bunch3(int idx, double poff1_bunch3)
void setP1(int idx, double p1)
void setP2(int idx, double p2)
void setVeff(int idx, double veff)
void setPOff2_bunch2(int idx, double poff2_bunch2)
void setPOff2_bunch3(int idx, double poff2_bunch3)
double getVeff(int idx) const
void setFPRight(int idx, double fp2)
void setFPLeft(int idx, double fp1)
void setPOff2_bunch0(int idx, double poff2_bunch0)
void setPOff1_bunch1(int idx, double poff1_bunch1)
void setSigmaCorr(int idx, double sigmac)
void setOffset(int idx, double offset)
void setVeff(int idx, double veff)
void setP(int i, double p)
void setFPCounter(int idx, double fp)
void setAtten(int idx, double atten)
const double BTimeCounter(double tleft, double tright, double z, unsigned int id)
const double ZADC(double qleft, double qright, unsigned int id)
const double BPulseHeight1(double ADC, double zHit, double sint, unsigned int id)
const double BPh(double ADC1, double ADC2, double zHit, unsigned int id)
const double ZTDC2(double tleft, unsigned int id, double z)
const double BPulseHeight2(double ADC, double zHit, double sint, unsigned int id)
const double EGain(unsigned int id)
const double BTimeCluster(double tlayer1, double tlayer2, double z1, double z2, unsigned int id1, unsigned int id2)
const double EPh(double ADC, double rHit, unsigned int id)
const double ZTDC1(double tright, unsigned int id, double z)
TofInfoCal * TofInfo() const
const double BPulseHeight(double ADC1, double ADC2, double zHit, double sint, unsigned int id)
const int BrEast(unsigned int No)
const double BGainForward(unsigned int id)
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
const double BTCorrOffset2(double zHit, unsigned int id, double t0)
const double BTime2(double ADC, double TDC, double zHit, unsigned int id, double t0)
const double EPulseHeight(double ADC, double rHit, double cost, unsigned int id)
const double BSigma1(double zHit, unsigned int id)
const double BAtten(unsigned int id)
virtual StatusCode finalize()
const double BSigma2(double zHit, unsigned int id)
const double BTime1(double ADC, double TDC, double zHit, unsigned int id, double t0)
BTofCal * BTof(unsigned int id) const
const double ETime(double ADC, double TDC, double rHit, unsigned int id)
const double BTCorrOffset1(double zHit, unsigned int id, double t0)
const double BSigmaCluster(double zHit1, double zHit2, unsigned int id1, unsigned int id2)
const double ZADC1(double qright, unsigned int id, double z)
virtual StatusCode initialize()
const double BGainBackward(unsigned int id)
const double BVeff(unsigned int id)
const double ESigma(double rHit, unsigned int id)
const double ZADC2(double qleft, unsigned int id, double z)
const double getQ0(unsigned int id)
const int BrWest(unsigned int No)
const double ZTDC(double tleft, double tright, unsigned int id)
const double ETDelay(unsigned int id)
const double EVeff(unsigned int id)
const double EAtten(unsigned int id)
const int Endcap(unsigned int No)
const double BTCorr2(double ADC, double zHit, unsigned int id)
BTofCommonCal * BTofCommon() const
const double BTCorr1(double ADC, double zHit, unsigned int id)
void handle(const Incident &)
const double BTDelay1(unsigned int id)
const double BTDelay2(unsigned int id)
TofCaliSvc(const std::string &name, ISvcLocator *svcloc)
ETofCal * ETof(unsigned int id) const
const double BSigmaCounter(double zHit, unsigned int id)
void setVersion(int version)
void setMisLable(int mis)
void setRunBegin(int run1)
void setBrEast(unsigned int i, int id1)
void setBrWest(unsigned int i, int id2)
void setEndcap(unsigned int i, int id3)