CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
TofCaliSvc Class Reference

#include <TofCaliSvc.h>

+ Inheritance diagram for TofCaliSvc:

Public Member Functions

 TofCaliSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~TofCaliSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
BTofCalBTof (unsigned int id) const
 
BTofCommonCalBTofCommon () const
 
ETofCalETof (unsigned int id) const
 
TofInfoCalTofInfo () const
 
const double BTDelay1 (unsigned int id)
 
const double BTDelay2 (unsigned int id)
 
const double ETDelay (unsigned int id)
 
const double BTCorr1 (double ADC, double zHit, unsigned int id)
 
const double BTCorr2 (double ADC, double zHit, unsigned int id)
 
const double BTCorrOffset1 (double zHit, unsigned int id, double t0)
 
const double BTCorrOffset2 (double zHit, unsigned int id, double t0)
 
const double TOffset ()
 
const double BTime1 (double ADC, double TDC, double zHit, unsigned int id, double t0)
 
const double BTime2 (double ADC, double TDC, double zHit, unsigned int id, double t0)
 
const double ETime (double ADC, double TDC, double rHit, unsigned int id)
 
const double BTimeCounter (double tleft, double tright, double z, unsigned int id)
 
const double BTimeCluster (double tlayer1, double tlayer2, double z1, double z2, unsigned int id1, unsigned int id2)
 
const double BSigma1 (double zHit, unsigned int id)
 
const double BSigma2 (double zHit, unsigned int id)
 
const double BSigmaCounter (double zHit, unsigned int id)
 
const double BSigmaCluster (double zHit1, double zHit2, unsigned int id1, unsigned int id2)
 
const double ESigma (double rHit, unsigned int id)
 
const double BPulseHeight1 (double ADC, double zHit, double sint, unsigned int id)
 
const double BPulseHeight2 (double ADC, double zHit, double sint, unsigned int id)
 
const double BPulseHeight (double ADC1, double ADC2, double zHit, double sint, unsigned int id)
 
const double BPh (double ADC1, double ADC2, double zHit, unsigned int id)
 
const double EPulseHeight (double ADC, double rHit, double cost, unsigned int id)
 
const double EPh (double ADC, double rHit, unsigned int id)
 
const double BVeff (unsigned int id)
 
const double BAtten (unsigned int id)
 
const double BGainForward (unsigned int id)
 
const double BGainBackward (unsigned int id)
 
const double getQ0 (unsigned int id)
 
const double EVeff (unsigned int id)
 
const double EAtten (unsigned int id)
 
const double EGain (unsigned int id)
 
const double ZTDC (double tleft, double tright, unsigned int id)
 
const double ZTDC1 (double tright, unsigned int id, double z)
 
const double ZTDC2 (double tleft, unsigned int id, double z)
 
const double ZADC (double qleft, double qright, unsigned int id)
 
const double ZADC1 (double qright, unsigned int id, double z)
 
const double ZADC2 (double qleft, unsigned int id, double z)
 
const int RunBegin ()
 
const int RunEnd ()
 
const int Version ()
 
const int QCorr ()
 
const int QElec ()
 
const int MisLable ()
 
const int BrEast (unsigned int No)
 
const int BrWest (unsigned int No)
 
const int Endcap (unsigned int No)
 
void Dump ()
 
- Public Member Functions inherited from ITofCaliSvc
virtual BTofCalBTof (unsigned id) const =0
 
virtual BTofCommonCalBTofCommon () const =0
 
virtual ETofCalETof (unsigned id) const =0
 
virtual TofInfoCalTofInfo () const =0
 
virtual const double BTDelay1 (unsigned id)=0
 
virtual const double BTDelay2 (unsigned id)=0
 
virtual const double ETDelay (unsigned id)=0
 
virtual const double BTCorr1 (double ADC, double zHit, unsigned int id)=0
 
virtual const double BTCorr2 (double ADC, double zHit, unsigned int id)=0
 
virtual const double BTCorrOffset1 (double zHit, unsigned int id, double t0)=0
 
virtual const double BTCorrOffset2 (double zHit, unsigned int id, double t0)=0
 
virtual const double TOffset ()=0
 
virtual const double BTime1 (double ADC, double TDC, double zHit, unsigned id, double t0)=0
 
virtual const double BTime2 (double ADC, double TDC, double zHit, unsigned id, double t0)=0
 
virtual const double ETime (double ADC, double TDC, double rHit, unsigned id)=0
 
virtual const double BTimeCounter (double tleft, double tright, double z, unsigned id)=0
 
virtual const double BTimeCluster (double tlayer1, double tlayer2, double z1, double z2, unsigned id1, unsigned int id2)=0
 
virtual const double BSigma1 (double zHit, unsigned id)=0
 
virtual const double BSigma2 (double zHit, unsigned id)=0
 
virtual const double BSigmaCounter (double zHit, unsigned id)=0
 
virtual const double BSigmaCluster (double zHit1, double zHit2, unsigned id1, unsigned id2)=0
 
virtual const double ESigma (double rHit, unsigned id)=0
 
virtual const double BPulseHeight1 (double ADC, double zHit, double sint, unsigned int id)=0
 
virtual const double BPulseHeight2 (double ADC, double zHit, double sint, unsigned int id)=0
 
virtual const double BPulseHeight (double ADC1, double ADC2, double zHit, double sint, unsigned int id)=0
 
virtual const double BPh (double ADC1, double ADC2, double zHit, unsigned int id)=0
 
virtual const double EPulseHeight (double ADC, double rHit, double cost, unsigned int id)=0
 
virtual const double EPh (double ADC, double rHit, unsigned int id)=0
 
virtual const double BVeff (unsigned id)=0
 
virtual const double BAtten (unsigned id)=0
 
virtual const double BGainForward (unsigned id)=0
 
virtual const double BGainBackward (unsigned id)=0
 
virtual const double getQ0 (unsigned id)=0
 
virtual const double EVeff (unsigned id)=0
 
virtual const double EAtten (unsigned id)=0
 
virtual const double EGain (unsigned id)=0
 
virtual const double ZTDC (double tleft, double tright, unsigned id)=0
 
virtual const double ZTDC1 (double tright, unsigned id, double z)=0
 
virtual const double ZTDC2 (double tleft, unsigned id, double z)=0
 
virtual const double ZADC (double qleft, double qright, unsigned id)=0
 
virtual const double ZADC1 (double qright, unsigned id, double z)=0
 
virtual const double ZADC2 (double qleft, unsigned id, double z)=0
 
virtual const int RunBegin ()=0
 
virtual const int RunEnd ()=0
 
virtual const int Version ()=0
 
virtual const int QCorr ()=0
 
virtual const int QElec ()=0
 
virtual const int MisLable ()=0
 
virtual const int BrEast (unsigned int No)=0
 
virtual const int BrWest (unsigned int No)=0
 
virtual const int Endcap (unsigned int No)=0
 
virtual void Dump ()=0
 

Additional Inherited Members

- Static Public Member Functions inherited from ITofCaliSvc
static const InterfaceID & interfaceID ()
 

Detailed Description

Definition at line 24 of file TofCaliSvc.h.

Constructor & Destructor Documentation

◆ TofCaliSvc()

TofCaliSvc::TofCaliSvc ( const std::string &  name,
ISvcLocator *  svcloc 
)

Definition at line 44 of file TofCaliSvc.cxx.

44 : Service(name, svcloc) {
45 declareProperty("Run",m_run=1);
46}

◆ ~TofCaliSvc()

TofCaliSvc::~TofCaliSvc ( )

Definition at line 95 of file TofCaliSvc.cxx.

95 {
96 for(vector<BTofCal*>::iterator it1 = fBTofCal.begin(); it1 != fBTofCal.end(); it1++) { delete (*it1); }
97 fBTofCal.clear();
98 for(vector<ETofCal*>::iterator it2 = fETofCal.begin(); it2 != fETofCal.end(); it2++) { delete (*it2); }
99 fETofCal.clear();
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); }
103 fTofInfoCal.clear();
104 return;
105}

Member Function Documentation

◆ BAtten()

const double TofCaliSvc::BAtten ( unsigned int  id)

Definition at line 632 of file TofCaliSvc.cxx.

632 {
633 if( id > 175 ) return -1;
634 return fBTofCal[id]->getAtten(0);
635}

◆ BGainBackward()

const double TofCaliSvc::BGainBackward ( unsigned int  id)

Definition at line 645 of file TofCaliSvc.cxx.

645 {
646 if( id > 175 ) return -1;
647 return fBTofCal[id]->getAtten(2);
648}

◆ BGainForward()

const double TofCaliSvc::BGainForward ( unsigned int  id)

Definition at line 637 of file TofCaliSvc.cxx.

637 {
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);
642 return A1;
643}

◆ BPh()

const double TofCaliSvc::BPh ( double  ADC1,
double  ADC2,
double  zHit,
unsigned int  id 
)
virtual

Implements ITofCaliSvc.

Definition at line 586 of file TofCaliSvc.cxx.

586 {
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));
591 return q;
592}
double length
****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
Definition: KKsem.h:33

◆ BPulseHeight()

const double TofCaliSvc::BPulseHeight ( double  ADC1,
double  ADC2,
double  zHit,
double  sint,
unsigned int  id 
)
virtual

Implements ITofCaliSvc.

Definition at line 576 of file TofCaliSvc.cxx.

576 {
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)) );
582 return q;
583}

◆ BPulseHeight1()

const double TofCaliSvc::BPulseHeight1 ( double  ADC,
double  zHit,
double  sint,
unsigned int  id 
)
virtual

Implements ITofCaliSvc.

Definition at line 558 of file TofCaliSvc.cxx.

558 {
559 double length = 230.0;
560 double A = 1.0;
561 double Latten = fBTofCal[id]->getAtten(0);
562 double q0 = ADC*sint*TMath::Exp((0.5*length-zHit)/Latten)/A;
563 return q0;
564}

◆ BPulseHeight2()

const double TofCaliSvc::BPulseHeight2 ( double  ADC,
double  zHit,
double  sint,
unsigned int  id 
)
virtual

Implements ITofCaliSvc.

Definition at line 567 of file TofCaliSvc.cxx.

567 {
568 double length = 230.0;
569 double A = 1.0;
570 double Latten = fBTofCal[id]->getAtten(0);
571 double q0 = ADC*sint*TMath::Exp((0.5*length+zHit)/Latten)/A;
572 return q0;
573}

◆ BrEast()

const int TofCaliSvc::BrEast ( unsigned int  No)
virtual

Implements ITofCaliSvc.

Definition at line 751 of file TofCaliSvc.cxx.

751 {
752 return fTofInfoCal[0]->getBrEast(im);
753}

◆ BrWest()

const int TofCaliSvc::BrWest ( unsigned int  No)
virtual

Implements ITofCaliSvc.

Definition at line 755 of file TofCaliSvc.cxx.

755 {
756 return fTofInfoCal[0]->getBrWest(im);
757}

◆ BSigma1()

const double TofCaliSvc::BSigma1 ( double  zHit,
unsigned int  id 
)

Definition at line 460 of file TofCaliSvc.cxx.

460 {
461 MsgStream log(msgSvc(), name());
462
463 double fpleft[nBarSigma];
464 for( int i=0; i<static_cast<int>(nBarSigma); i++ ) {
465 fpleft[i]=fBTofCal[id]->getFPLeft(i);
466 }
467
468 log << MSG::DEBUG << "BSigma1 id =" << id << " 1=" << fpleft[0] << " 2=" << fpleft[1] << " 3=" << fpleft[2] << " 4=" << fpleft[3] << " 5=" << fpleft[4] << endreq;
469
470 double sigmaLeft = fpleft[0] + fpleft[1]*z + fpleft[2]*z*z + fpleft[3]*z*z*z + fpleft[4]*z*z*z*z;
471
472 return sigmaLeft;
473}
const unsigned int nBarSigma
IMessageSvc * msgSvc()

Referenced by BTimeCounter().

◆ BSigma2()

const double TofCaliSvc::BSigma2 ( double  zHit,
unsigned int  id 
)

Definition at line 476 of file TofCaliSvc.cxx.

476 {
477 MsgStream log(msgSvc(), name());
478
479 double fpright[nBarSigma];
480 for( int i=0; i<static_cast<int>(nBarSigma); i++ ) {
481 fpright[i]=fBTofCal[id]->getFPRight(i);
482 }
483
484 log << MSG::DEBUG << "BSigma2 id =" << id << " 1=" << fpright[0] << " 2=" << fpright[1] << " 3=" << fpright[2] << " 4=" << fpright[3] << " 5=" << fpright[4] << endreq;
485
486 double sigmaRight = fpright[0] + fpright[1]*z + fpright[2]*z*z + fpright[3]*z*z*z + fpright[4]*z*z*z*z;
487
488 return sigmaRight;
489}

Referenced by BTimeCounter().

◆ BSigmaCluster()

const double TofCaliSvc::BSigmaCluster ( double  zHit1,
double  zHit2,
unsigned int  id1,
unsigned int  id2 
)

Definition at line 508 of file TofCaliSvc.cxx.

508 {
509 double sigmaInner = BSigmaCounter(z1, id1);
510 double sigmaInner2 = sigmaInner*sigmaInner;
511 double sigmaOuter = BSigmaCounter(z2, id2);
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);
516 sigma = sqrt(sigma);
517 return sigma;
518}
const double BSigmaCounter(double zHit, unsigned int id)
Definition: TofCaliSvc.cxx:492

◆ BSigmaCounter()

const double TofCaliSvc::BSigmaCounter ( double  zHit,
unsigned int  id 
)

Definition at line 492 of file TofCaliSvc.cxx.

492 {
493 MsgStream log(msgSvc(), name());
494
495 double fplayer[nBarSigCnt];
496 for( int i=0; i<static_cast<int>(nBarSigCnt); i++ ) {
497 fplayer[i]=fBTofCal[id]->getFPCounter(i);
498 }
499
500 log << MSG::DEBUG << "BSigmaCounter id =" << id << " 1=" << fplayer[0] << " 2=" << fplayer[1] << " 3=" << fplayer[2] << " 4=" << fplayer[3] << " 5=" << fplayer[4] << endreq;
501
502 double sigma = fplayer[0] + fplayer[1]*z + fplayer[2]*z*z + fplayer[3]*z*z*z + fplayer[4]*z*z*z*z;
503
504 return sigma;
505}
const unsigned int nBarSigCnt

Referenced by BSigmaCluster(), and BTimeCluster().

◆ BTCorr1()

const double TofCaliSvc::BTCorr1 ( double  ADC,
double  zHit,
unsigned int  id 
)
virtual

Implements ITofCaliSvc.

Definition at line 243 of file TofCaliSvc.cxx.

243 {
244 MsgStream log(msgSvc(), name());
245
246 double p1[nBarPar];
247 for( int i=0; i<static_cast<int>(nBarPar); i++ ) {
248 p1[i]=fBTofCal[id]->getP1(i);
249 }
250
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;
252
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;
254
255 return tcorr1;
256}
const unsigned int nBarPar

Referenced by BTime1().

◆ BTCorr2()

const double TofCaliSvc::BTCorr2 ( double  ADC,
double  zHit,
unsigned int  id 
)
virtual

Implements ITofCaliSvc.

Definition at line 259 of file TofCaliSvc.cxx.

259 {
260 MsgStream log(msgSvc(), name());
261
262 double p2[nBarPar];
263 for( int i=0; i<static_cast<int>(nBarPar); i++ ) {
264 p2[i]=fBTofCal[id]->getP2(i);
265 }
266
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;
268
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;
270
271 return tcorr2;
272}

Referenced by BTime2().

◆ BTCorrOffset1()

const double TofCaliSvc::BTCorrOffset1 ( double  zHit,
unsigned int  id,
double  t0 
)
virtual

Implements ITofCaliSvc.

Definition at line 275 of file TofCaliSvc.cxx.

275 {
276 MsgStream log(msgSvc(), name());
277
278 int numBunch = fTofInfoCal[0]->getRunEnd();
279 int whichBunch = (static_cast<int>(t0/(12000./499.8/(numBunch*1.0))+0.1))%numBunch;
280
281 double poff1[nBarParOff];
282 if( whichBunch==0 ) {
283 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
284 poff1[i]=fBTofCal[id]->getPOff1_bunch0(i);
285 }
286 }
287 else if( whichBunch==1 ) {
288 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
289 poff1[i]=fBTofCal[id]->getPOff1_bunch1(i);
290 }
291 }
292 else if( whichBunch==2 ) {
293 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
294 poff1[i]=fBTofCal[id]->getPOff1_bunch2(i);
295 }
296 }
297 else if( whichBunch==3 ) {
298 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
299 poff1[i]=fBTofCal[id]->getPOff1_bunch3(i);
300 }
301 }
302
303 double tCorrOffset1 = 0.0;
304 if( z>=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;
306 }
307 else {
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;
309 }
310
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;
312
313 return tCorrOffset1;
314}
const unsigned int nBarParOff

Referenced by BTime1().

◆ BTCorrOffset2()

const double TofCaliSvc::BTCorrOffset2 ( double  zHit,
unsigned int  id,
double  t0 
)
virtual

Implements ITofCaliSvc.

Definition at line 317 of file TofCaliSvc.cxx.

317 {
318 MsgStream log(msgSvc(), name());
319
320 int numBunch = fTofInfoCal[0]->getRunEnd();
321 int whichBunch = (static_cast<int>(t0/(12000./499.8/(numBunch*1.0))+0.1))%numBunch;
322
323 double poff2[nBarParOff];
324 if( whichBunch==0 ) {
325 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
326 poff2[i]=fBTofCal[id]->getPOff2_bunch0(i);
327 }
328 }
329 else if( whichBunch==1 ) {
330 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
331 poff2[i]=fBTofCal[id]->getPOff2_bunch1(i);
332 }
333 }
334 else if( whichBunch==2 ) {
335 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
336 poff2[i]=fBTofCal[id]->getPOff2_bunch2(i);
337 }
338 }
339 else if( whichBunch==3 ) {
340 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
341 poff2[i]=fBTofCal[id]->getPOff2_bunch3(i);
342 }
343 }
344
345 double tCorrOffset2 = 0.0;
346 if( z>=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;
348 }
349 else {
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;
351 }
352
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;
354
355 return tCorrOffset2;
356}

Referenced by BTime2().

◆ BTDelay1()

const double TofCaliSvc::BTDelay1 ( unsigned int  id)

Definition at line 204 of file TofCaliSvc.cxx.

204 {
205 double tdelay = 0.0;
206 if( id < 176 ) {
207 tdelay = fBTofCal[id]->getP1(0);
208 }
209 else {
210 MsgStream log(msgSvc(), name());
211 log<<MSG::ERROR<<"TofCaliSvc::BTDelay1() -- Wrong TOFID is provided! ID = "<<id<<endreq;
212 }
213 return tdelay;
214}

◆ BTDelay2()

const double TofCaliSvc::BTDelay2 ( unsigned int  id)

Definition at line 217 of file TofCaliSvc.cxx.

217 {
218 double tdelay = 0.0;
219 if( id < 176 ) {
220 tdelay = fBTofCal[id]->getP2(0);
221 }
222 else {
223 MsgStream log(msgSvc(), name());
224 log<<MSG::ERROR<<"TofCaliSvc::BTDelay2() -- Wrong TOFID is provided! ID = "<<id<<endreq;
225 }
226 return tdelay;
227}

◆ BTime1()

const double TofCaliSvc::BTime1 ( double  ADC,
double  TDC,
double  zHit,
unsigned int  id,
double  t0 
)

Definition at line 365 of file TofCaliSvc.cxx.

365 {
366 MsgStream log(msgSvc(), name());
367
368 double tcorr1 = BTCorr1( ADC, z, id );
369 double tcorr2 = BTCorrOffset1( z, id, t0);
370 double tcorr3 = fBTofCommonCal[0]->getOffset(0);
371
372 log << MSG::DEBUG << "BTime1 id =" << id << " tcorr=" << tcorr1 << " toffset=" << tcorr2 << " total offset=" << tcorr3 << endreq;
373
374 double time = TDC - tcorr1 - tcorr2 - tcorr3;
375
376 if(time<0.) {
377 log<<MSG::WARNING<<"TofCaliSvc::BTime1() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" z = "<<z<<" ID = "<<id<<endreq;
378 }
379 return time;
380}
Double_t time
const double BTCorrOffset1(double zHit, unsigned int id, double t0)
Definition: TofCaliSvc.cxx:275
const double BTCorr1(double ADC, double zHit, unsigned int id)
Definition: TofCaliSvc.cxx:243

◆ BTime2()

const double TofCaliSvc::BTime2 ( double  ADC,
double  TDC,
double  zHit,
unsigned int  id,
double  t0 
)

Definition at line 383 of file TofCaliSvc.cxx.

383 {
384 MsgStream log(msgSvc(), name());
385
386 double tcorr1 = BTCorr2( ADC, z, id );
387 double tcorr2 = BTCorrOffset2( z, id ,t0);
388 double tcorr3 = fBTofCommonCal[0]->getOffset(0);
389
390 log << MSG::DEBUG << "BTime2 id =" << id << " tcorr=" << tcorr1 << " toffset=" << tcorr2 << " total offset=" << tcorr3 << endreq;
391
392 double time = TDC - tcorr1 - tcorr2 - tcorr3;
393
394 if(time<0.) {
395 log<<MSG::WARNING<<"TofCaliSvc::BTime2() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" z = "<<z<<" ID = "<<id<<endreq;
396 }
397 return time;
398}
const double BTCorrOffset2(double zHit, unsigned int id, double t0)
Definition: TofCaliSvc.cxx:317
const double BTCorr2(double ADC, double zHit, unsigned int id)
Definition: TofCaliSvc.cxx:259

◆ BTimeCluster()

const double TofCaliSvc::BTimeCluster ( double  tlayer1,
double  tlayer2,
double  z1,
double  z2,
unsigned int  id1,
unsigned int  id2 
)

Definition at line 439 of file TofCaliSvc.cxx.

439 {
440
441 double sigmaCorr = fBTofCommonCal[0]->getSigmaCorr(0);
442 double sigmaCorr2 = sigmaCorr*sigmaCorr;
443
444 double sigmaInner = BSigmaCounter( z1, id1 );
445 double sigmaInner2 = sigmaInner*sigmaInner;
446 double sigmaOuter = BSigmaCounter( z2, id2 );
447 double sigmaOuter2 = sigmaOuter*sigmaOuter;
448
449 double fraction = ( sigmaOuter2 - sigmaCorr2 )/( sigmaInner2 + sigmaOuter2 - 2.0*sigmaCorr2);
450
451 double wt=fraction*tlayer1 + (1.0-fraction)*tlayer2;
452 if(wt<0.) {
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;
455 }
456 return wt;
457}

◆ BTimeCounter()

const double TofCaliSvc::BTimeCounter ( double  tleft,
double  tright,
double  z,
unsigned int  id 
)

Definition at line 418 of file TofCaliSvc.cxx.

418 {
419
420 double sigmaCorr = fBTofCommonCal[0]->getSigmaCorr(0);
421 double sigmaCorr2 = sigmaCorr*sigmaCorr;
422
423 double sigmaLeft = BSigma1( z, id );
424 double sigmaLeft2 = sigmaLeft*sigmaLeft;
425 double sigmaRight = BSigma2( z, id );
426 double sigmaRight2 = sigmaRight*sigmaRight;
427
428 double fraction = ( sigmaRight2 - sigmaCorr2 )/( sigmaLeft2 + sigmaRight2 - 2.0*sigmaCorr2);
429
430 double wt=fraction*tleft + (1.0-fraction)*tright;
431 if(wt<0.) {
432 MsgStream log(msgSvc(), name());
433 log<<MSG::WARNING<<"TofCaliSvc::BTimeCounter() -- A minus time is given : "<<wt <<" [Input] z = "<<z<<" ID = "<<id<<endreq;
434 }
435
436 return wt;
437}
const double BSigma1(double zHit, unsigned int id)
Definition: TofCaliSvc.cxx:460
const double BSigma2(double zHit, unsigned int id)
Definition: TofCaliSvc.cxx:476

◆ BTof()

BTofCal * TofCaliSvc::BTof ( unsigned int  id) const

Definition at line 763 of file TofCaliSvc.cxx.

763 {
764 return fBTofCal[id];
765}

Referenced by Dump().

◆ BTofCommon()

BTofCommonCal * TofCaliSvc::BTofCommon ( ) const
virtual

Implements ITofCaliSvc.

Definition at line 771 of file TofCaliSvc.cxx.

771 {
772 return fBTofCommonCal[0];
773}

◆ BVeff()

const double TofCaliSvc::BVeff ( unsigned int  id)

Definition at line 623 of file TofCaliSvc.cxx.

623 {
624 if(id<176){
625 return fBTofCal[id]->getVeff(0);
626 }else{
627 std::cout<<"bad id="<<id<<std::endl;
628 return 0.;}
629}

◆ Dump()

void TofCaliSvc::Dump ( )
virtual

Implements ITofCaliSvc.

Definition at line 779 of file TofCaliSvc.cxx.

779 {
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;
783
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;
787 // cout<<"The 22rd Endcap TOF PMT veff is"<<" "<<ETof(22)->getVeff()<<endl;
788}
BTofCal * BTof(unsigned int id) const
Definition: TofCaliSvc.cxx:763

Referenced by main().

◆ EAtten()

const double TofCaliSvc::EAtten ( unsigned int  id)

Definition at line 717 of file TofCaliSvc.cxx.

717 {
718 if( id > 95 ) return -1;
719 return fETofCal[id]->getAtten(0);
720}

◆ EGain()

const double TofCaliSvc::EGain ( unsigned int  id)

Definition at line 722 of file TofCaliSvc.cxx.

722 {
723 if( id > 95 ) return -1;
724 return fETofCal[id]->getAtten(1);
725}

◆ Endcap()

const int TofCaliSvc::Endcap ( unsigned int  No)
virtual

Implements ITofCaliSvc.

Definition at line 759 of file TofCaliSvc.cxx.

759 {
760 return fTofInfoCal[0]->getEndcap(im);
761}

◆ EPh()

const double TofCaliSvc::EPh ( double  ADC,
double  rHit,
unsigned int  id 
)
virtual

Implements ITofCaliSvc.

Definition at line 608 of file TofCaliSvc.cxx.

608 {
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)));
614 return q0;
615}

◆ EPulseHeight()

const double TofCaliSvc::EPulseHeight ( double  ADC,
double  rHit,
double  cost,
unsigned int  id 
)
virtual

Implements ITofCaliSvc.

Definition at line 595 of file TofCaliSvc.cxx.

595 {
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);
601
602 double q0 = ADC*fabs(cost)*TMath::Exp(-(a1*(rHit-length)+a2*(rHit-length)*(rHit-length)))/a3;
603
604 return q0;
605}

◆ ESigma()

const double TofCaliSvc::ESigma ( double  rHit,
unsigned int  id 
)

Definition at line 542 of file TofCaliSvc.cxx.

542 {
543 MsgStream log(msgSvc(), name());
544
545 double fp[nEndSigma];
546 for( int i=0; i<static_cast<int>(nEndSigma); i++) {
547 fp[i]=fETofCal[id]->getFPCounter(i);
548 }
549
550 log << MSG::DEBUG << "ESigma id =" << id << " 1=" << fp[0] << " 2=" << fp[1] << " 3=" << fp[2] << endreq;
551
552 double sigma = fp[0] + fp[1]*r + fp[2]*r*r;
553
554 return sigma;
555}
const unsigned int nEndSigma

◆ ETDelay()

const double TofCaliSvc::ETDelay ( unsigned int  id)

Definition at line 230 of file TofCaliSvc.cxx.

230 {
231 double tdelay = 0.0;
232 if( id < 96 ) {
233 tdelay = fETofCal[id]->getP(0);
234 }
235 else {
236 MsgStream log(msgSvc(), name());
237 log<<MSG::ERROR<<"TofCaliSvc::ETDelay() -- Wrong TOFID is provided! ID = "<<id<<endreq;
238 }
239 return tdelay;
240}

◆ ETime()

const double TofCaliSvc::ETime ( double  ADC,
double  TDC,
double  rHit,
unsigned int  id 
)

Definition at line 521 of file TofCaliSvc.cxx.

521 {
522 MsgStream log(msgSvc(), name());
523
524 double p[nEndPar];
525 for( int i=0; i<static_cast<int>(nEndPar); i++ ) {
526 p[i]=fETofCal[id]->getP(i);
527 }
528
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;
530
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);
532
533 if(time<0.) {
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;
536 }
537
538 return time;
539}
const unsigned int nEndPar

◆ ETof()

ETofCal * TofCaliSvc::ETof ( unsigned int  id) const

Definition at line 767 of file TofCaliSvc.cxx.

767 {
768 return fETofCal[id];
769}

◆ EVeff()

const double TofCaliSvc::EVeff ( unsigned int  id)

Definition at line 650 of file TofCaliSvc.cxx.

650 {
651 if( id > 175 ) return -1;
652 return fETofCal[id]->getVeff(0);
653}

◆ finalize()

StatusCode TofCaliSvc::finalize ( )
virtual

Definition at line 89 of file TofCaliSvc.cxx.

89 {
90 MsgStream log(msgSvc(), name());
91 log << MSG::INFO << name() << ": End of Run" << endreq;
92 return StatusCode::SUCCESS;
93}

◆ getQ0()

const double TofCaliSvc::getQ0 ( unsigned int  id)

Definition at line 618 of file TofCaliSvc.cxx.

618 {
619 return fBTofCal[id]->getAtten(3);
620}

◆ handle()

void TofCaliSvc::handle ( const Incident &  inc)

Definition at line 790 of file TofCaliSvc.cxx.

790 {
791 MsgStream log( messageService(), name() );
792 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
793
794 if ( inc.type() == "NewRun" ){
795 log << MSG::DEBUG << "New Run" << endreq;
796 // if(!m_hasbeeninitialized){
797 StatusCode sc= FillfromDatabase();
798 if(sc.isSuccess()){
799 m_hasbeeninitialized=true;
800 }
801 // }
802 }
803}

◆ initialize()

StatusCode TofCaliSvc::initialize ( )
virtual

Definition at line 57 of file TofCaliSvc.cxx.

57 {
58 m_hasbeeninitialized=false;
59
60 MsgStream log(msgSvc(), name());
61 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
62
63 StatusCode sc = Service::initialize();
64 if ( sc.isFailure() ) return sc;
65
66 IIncidentSvc* incsvc;
67 sc = service("IncidentSvc", incsvc);
68 int priority = 100;
69 if( sc.isSuccess() ){
70 incsvc -> addListener(this, "NewRun", priority);
71 }
72
73 StatusCode scc;
74
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;
79 return scc;
80 } else {
81 log << MSG::DEBUG<< "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc"<<endreq;
82 }
83 // Get properties from the JobOptionsSvc
84 scc = setProperties();
85
86 return sc;
87}

Referenced by main().

◆ MisLable()

const int TofCaliSvc::MisLable ( )
virtual

Implements ITofCaliSvc.

Definition at line 747 of file TofCaliSvc.cxx.

747 {
748 return fTofInfoCal[0]->getMisLable();
749}

◆ QCorr()

const int TofCaliSvc::QCorr ( )
virtual

Implements ITofCaliSvc.

Definition at line 739 of file TofCaliSvc.cxx.

739 {
740 return fTofInfoCal[0]->getQCorr();
741}

◆ QElec()

const int TofCaliSvc::QElec ( )
virtual

Implements ITofCaliSvc.

Definition at line 743 of file TofCaliSvc.cxx.

743 {
744 return fTofInfoCal[0]->getQElec();
745}

◆ queryInterface()

StatusCode TofCaliSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvUnknown 
)
virtual

Definition at line 48 of file TofCaliSvc.cxx.

48 {
49 if ( IID_ITofCaliSvc.versionMatch(riid) ) {
50 *ppvInterface = static_cast<ITofCaliSvc*> (this);
51 } else {
52 return Service::queryInterface(riid, ppvInterface) ;
53 }
54 return StatusCode::SUCCESS;
55}

◆ RunBegin()

const int TofCaliSvc::RunBegin ( )
virtual

Implements ITofCaliSvc.

Definition at line 727 of file TofCaliSvc.cxx.

727 {
728 return fTofInfoCal[0]->getRunBegin();
729}

◆ RunEnd()

const int TofCaliSvc::RunEnd ( )
virtual

Implements ITofCaliSvc.

Definition at line 731 of file TofCaliSvc.cxx.

731 {
732 return fTofInfoCal[0]->getRunEnd();
733}

◆ TOffset()

const double TofCaliSvc::TOffset ( )
virtual

Implements ITofCaliSvc.

Definition at line 359 of file TofCaliSvc.cxx.

359 {
360 double toffset = fBTofCommonCal[0]->getOffset(0);
361 return toffset;
362}

◆ TofInfo()

TofInfoCal * TofCaliSvc::TofInfo ( ) const
virtual

Implements ITofCaliSvc.

Definition at line 775 of file TofCaliSvc.cxx.

775 {
776 return fTofInfoCal[0];
777}

◆ Version()

const int TofCaliSvc::Version ( )
virtual

Implements ITofCaliSvc.

Definition at line 735 of file TofCaliSvc.cxx.

735 {
736 return fTofInfoCal[0]->getVersion();
737}

◆ ZADC()

const double TofCaliSvc::ZADC ( double  qleft,
double  qright,
unsigned int  id 
)

Definition at line 684 of file TofCaliSvc.cxx.

684 {
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 );
692 return zadc;
693}

◆ ZADC1()

const double TofCaliSvc::ZADC1 ( double  qright,
unsigned int  id,
double  z 
)

Definition at line 695 of file TofCaliSvc.cxx.

695 {
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);
703 return qleft;
704}
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252

◆ ZADC2()

const double TofCaliSvc::ZADC2 ( double  qleft,
unsigned int  id,
double  z 
)

Definition at line 706 of file TofCaliSvc.cxx.

706 {
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);
714 return qright;
715}

◆ ZTDC()

const double TofCaliSvc::ZTDC ( double  tleft,
double  tright,
unsigned int  id 
)

Definition at line 655 of file TofCaliSvc.cxx.

655 {
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);
661 return ztdc;
662}

◆ ZTDC1()

const double TofCaliSvc::ZTDC1 ( double  tright,
unsigned int  id,
double  z 
)

Definition at line 664 of file TofCaliSvc.cxx.

664 {
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;
671 return tleft;
672}

◆ ZTDC2()

const double TofCaliSvc::ZTDC2 ( double  tleft,
unsigned int  id,
double  z 
)

Definition at line 674 of file TofCaliSvc.cxx.

674 {
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;
681 return tright;
682}

The documentation for this class was generated from the following files: