BOSS 7.1.0
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 initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
StatusCode chooseConstants (int run, int number)
 
BTofCalBTof (unsigned int id) const
 
BTofCommonCalBTofCommon () const
 
ETofCalETof (unsigned int id) const
 
EtfCalEtfTof (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 EtfTime (double ADC1, double ADC2, double TDC1, double TDC2, unsigned int id, unsigned int strip, double t0)
 
const double EtfTime1 (double ADC, double TDC, double zHit, unsigned int id, unsigned int strip, double t0)
 
const double EtfTime2 (double ADC, double TDC, double zHit, unsigned int id, unsigned int strip, double t0)
 
const double EtfTimeMC (double ADC1, double ADC2, double TDC1, double TDC2, unsigned int id, unsigned int strip, double t0)
 
const double EtfTimeMC1 (double ADC, double TDC, double zHit, unsigned int id, unsigned int strip, double t0)
 
const double EtfTimeMC2 (double ADC, double TDC, double zHit, unsigned int id, unsigned int strip, double t0)
 
const double EtfTime (double tleft, double tright)
 
const double EtfBunchP (int index)
 
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 EtfVeff (unsigned int id, unsigned int strip)
 
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 double EtfZTDC (double tleft, double tright, unsigned int id, unsigned int strip)
 
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)
 
const int Etf (unsigned int No)
 
const int RunFrom ()
 
const int RunTo ()
 
const int EventFrom ()
 
const int EventTo ()
 
void Dump ()
 

Detailed Description

Definition at line 27 of file TofCaliSvc.h.

Constructor & Destructor Documentation

◆ TofCaliSvc()

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

Definition at line 47 of file TofCaliSvc.cxx.

47 : base_class(name, svcloc)
48//TofCaliSvc::TofCaliSvc( const std::string& name, ISvcLocator* svcloc ) : Service(name, svcloc) {
49{ declareProperty("Run",m_run=1);
50 m_sequence = 0;
51}

◆ ~TofCaliSvc()

TofCaliSvc::~TofCaliSvc ( )

Definition at line 101 of file TofCaliSvc.cxx.

101 {
102 for(vector<BTofCal*>::iterator it1 = fBTofCal.begin(); it1 != fBTofCal.end(); it1++) { delete (*it1); }
103 fBTofCal.clear();
104 for(vector<ETofCal*>::iterator it2 = fETofCal.begin(); it2 != fETofCal.end(); it2++) { delete (*it2); }
105 fETofCal.clear();
106
107 if( fEtfCal.size()!=0 ) {
108 for(vector<EtfCal*>::iterator it5 = fEtfCal.begin(); it5 != fEtfCal.end(); it5++) { delete (*it5); }
109 fEtfCal.clear();
110 }
111 if( fEtfBunchCal.size()!=0 ) {
112 for(vector<EtfBunchCal*>::iterator it6 = fEtfBunchCal.begin(); it6 != fEtfBunchCal.end(); it6++) { delete (*it6); }
113 fEtfBunchCal.clear();
114 }
115 for(vector<BTofCommonCal*>::iterator it3 = fBTofCommonCal.begin(); it3 != fBTofCommonCal.end(); it3++) { delete (*it3); }
116 fBTofCommonCal.clear();
117 for(vector<TofInfoCal*>::iterator it4 = fTofInfoCal.begin(); it4 != fTofInfoCal.end(); it4++) { delete (*it4); }
118 fTofInfoCal.clear();
119 return;
120}

Member Function Documentation

◆ BAtten()

const double TofCaliSvc::BAtten ( unsigned int  id)

Definition at line 944 of file TofCaliSvc.cxx.

944 {
945 if( id > 175 ) return -1;
946 return fBTofCal[176*m_sequence+id]->getAtten(0);
947}

◆ BGainBackward()

const double TofCaliSvc::BGainBackward ( unsigned int  id)

Definition at line 957 of file TofCaliSvc.cxx.

957 {
958 if( id > 175 ) return -1;
959 return fBTofCal[176*m_sequence+id]->getAtten(2);
960}

◆ BGainForward()

const double TofCaliSvc::BGainForward ( unsigned int  id)

Definition at line 949 of file TofCaliSvc.cxx.

949 {
950 if( id > 175 ) return -1;
951 double gainRatio = fBTofCal[176*m_sequence+id]->getAtten(1);
952 double A2 = fBTofCal[176*m_sequence+id]->getAtten(2);
953 double A1 = A2*TMath::Exp(gainRatio);
954 return A1;
955}

◆ BPh()

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

Definition at line 898 of file TofCaliSvc.cxx.

898 {
899 double length = 230.0;
900 double Latten = fBTofCal[176*m_sequence+id]->getAtten(0);
901 double gainRatio = fBTofCal[176*m_sequence+id]->getAtten(1);
902 double q = ( ADC1*TMath::Exp((0.5*length-zHit)/Latten)+ADC2*TMath::Exp((0.5*length+zHit)/Latten) )/(1.0+TMath::Exp(gainRatio));
903 return q;
904}
****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 
)

Definition at line 888 of file TofCaliSvc.cxx.

888 {
889 double length = 230.0;
890 double Latten = fBTofCal[176*m_sequence+id]->getAtten(0);
891 double gainRatio = fBTofCal[176*m_sequence+id]->getAtten(1);
892 double A2 = fBTofCal[176*m_sequence+id]->getAtten(2);
893 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)) );
894 return q;
895}

◆ BPulseHeight1()

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

Definition at line 870 of file TofCaliSvc.cxx.

870 {
871 double length = 230.0;
872 double A = 1.0;
873 double Latten = fBTofCal[176*m_sequence+id]->getAtten(0);
874 double q0 = ADC*sint*TMath::Exp((0.5*length-zHit)/Latten)/A;
875 return q0;
876}

◆ BPulseHeight2()

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

Definition at line 879 of file TofCaliSvc.cxx.

879 {
880 double length = 230.0;
881 double A = 1.0;
882 double Latten = fBTofCal[176*m_sequence+id]->getAtten(0);
883 double q0 = ADC*sint*TMath::Exp((0.5*length+zHit)/Latten)/A;
884 return q0;
885}

◆ BrEast()

const int TofCaliSvc::BrEast ( unsigned int  No)

Definition at line 1083 of file TofCaliSvc.cxx.

1083 {
1084 return fTofInfoCal[m_sequence]->getBrEast(im);
1085}

◆ BrWest()

const int TofCaliSvc::BrWest ( unsigned int  No)

Definition at line 1087 of file TofCaliSvc.cxx.

1087 {
1088 return fTofInfoCal[m_sequence]->getBrWest(im);
1089}

◆ BSigma1()

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

Definition at line 594 of file TofCaliSvc.cxx.

594 {
595 MsgStream log(msgSvc(), name());
596
597 double fpleft[nBarSigma];
598 for( int i=0; i<static_cast<int>(nBarSigma); i++ ) {
599 fpleft[i]=fBTofCal[176*m_sequence+id]->getFPLeft(i);
600 }
601
602 log << MSG::DEBUG << "BSigma1 id =" << id << " 1=" << fpleft[0] << " 2=" << fpleft[1] << " 3=" << fpleft[2] << " 4=" << fpleft[3] << " 5=" << fpleft[4] << endreq;
603
604 double sigmaLeft = fpleft[0] + fpleft[1]*z + fpleft[2]*z*z + fpleft[3]*z*z*z + fpleft[4]*z*z*z*z;
605
606 return sigmaLeft;
607}
const unsigned int nBarSigma
IMessageSvc * msgSvc()

Referenced by BTimeCounter().

◆ BSigma2()

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

Definition at line 610 of file TofCaliSvc.cxx.

610 {
611 MsgStream log(msgSvc(), name());
612
613 double fpright[nBarSigma];
614 for( int i=0; i<static_cast<int>(nBarSigma); i++ ) {
615 fpright[i]=fBTofCal[176*m_sequence+id]->getFPRight(i);
616 }
617
618 log << MSG::DEBUG << "BSigma2 id =" << id << " 1=" << fpright[0] << " 2=" << fpright[1] << " 3=" << fpright[2] << " 4=" << fpright[3] << " 5=" << fpright[4] << endreq;
619
620 double sigmaRight = fpright[0] + fpright[1]*z + fpright[2]*z*z + fpright[3]*z*z*z + fpright[4]*z*z*z*z;
621
622 return sigmaRight;
623}

Referenced by BTimeCounter().

◆ BSigmaCluster()

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

Definition at line 642 of file TofCaliSvc.cxx.

642 {
643 double sigmaInner = BSigmaCounter(z1, id1);
644 double sigmaInner2 = sigmaInner*sigmaInner;
645 double sigmaOuter = BSigmaCounter(z2, id2);
646 double sigmaOuter2 = sigmaOuter*sigmaOuter;
647 double sigmaCorr = fBTofCommonCal[m_sequence]->getSigmaCorr(0);
648 double sigmaCorr2 = sigmaCorr*sigmaCorr;
649 double sigma = (sigmaInner2*sigmaOuter2-sigmaCorr2*sigmaCorr2)/(sigmaInner2+sigmaOuter2-2.0*sigmaCorr2);
650 sigma = sqrt(sigma);
651 return sigma;
652}
TTree * sigma
const double BSigmaCounter(double zHit, unsigned int id)
Definition: TofCaliSvc.cxx:626

◆ BSigmaCounter()

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

Definition at line 626 of file TofCaliSvc.cxx.

626 {
627 MsgStream log(msgSvc(), name());
628
629 double fplayer[nBarSigCnt];
630 for( int i=0; i<static_cast<int>(nBarSigCnt); i++ ) {
631 fplayer[i]=fBTofCal[176*m_sequence+id]->getFPCounter(i);
632 }
633
634 log << MSG::DEBUG << "BSigmaCounter id =" << id << " 1=" << fplayer[0] << " 2=" << fplayer[1] << " 3=" << fplayer[2] << " 4=" << fplayer[3] << " 5=" << fplayer[4] << endreq;
635
636 double sigma = fplayer[0] + fplayer[1]*z + fplayer[2]*z*z + fplayer[3]*z*z*z + fplayer[4]*z*z*z*z;
637
638 return sigma;
639}
const unsigned int nBarSigCnt

Referenced by BSigmaCluster(), and BTimeCluster().

◆ BTCorr1()

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

Definition at line 377 of file TofCaliSvc.cxx.

377 {
378 MsgStream log(msgSvc(), name());
379
380 double p1[nBarPar];
381 for( int i=0; i<static_cast<int>(nBarPar); i++ ) {
382 p1[i]=fBTofCal[176*m_sequence+id]->getP1(i);
383 }
384
385 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;
386
387 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;
388
389 return tcorr1;
390}
const unsigned int nBarPar

Referenced by BTime1().

◆ BTCorr2()

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

Definition at line 393 of file TofCaliSvc.cxx.

393 {
394 MsgStream log(msgSvc(), name());
395
396 double p2[nBarPar];
397 for( int i=0; i<static_cast<int>(nBarPar); i++ ) {
398 p2[i]=fBTofCal[176*m_sequence+id]->getP2(i);
399 }
400
401 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;
402
403 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;
404
405 return tcorr2;
406}
double * p2
Definition: qcdloop1.h:76

Referenced by BTime2().

◆ BTCorrOffset1()

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

Definition at line 409 of file TofCaliSvc.cxx.

409 {
410 MsgStream log(msgSvc(), name());
411
412 int numBunch = fTofInfoCal[m_sequence]->getRunEnd();
413 int whichBunch = (static_cast<int>(t0/(12000./499.8/(numBunch*1.0))+0.1))%numBunch;
414
415 double poff1[nBarParOff];
416 if( whichBunch==0 ) {
417 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
418 poff1[i]=fBTofCal[176*m_sequence+id]->getPOff1_bunch0(i);
419 }
420 }
421 else if( whichBunch==1 ) {
422 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
423 poff1[i]=fBTofCal[176*m_sequence+id]->getPOff1_bunch1(i);
424 }
425 }
426 else if( whichBunch==2 ) {
427 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
428 poff1[i]=fBTofCal[176*m_sequence+id]->getPOff1_bunch2(i);
429 }
430 }
431 else if( whichBunch==3 ) {
432 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
433 poff1[i]=fBTofCal[176*m_sequence+id]->getPOff1_bunch3(i);
434 }
435 }
436
437 double tCorrOffset1 = 0.0;
438 if( z>=0.0 ) {
439 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;
440 }
441 else {
442 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;
443 }
444
445 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;
446
447 return tCorrOffset1;
448}
const unsigned int nBarParOff

Referenced by BTime1().

◆ BTCorrOffset2()

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

Definition at line 451 of file TofCaliSvc.cxx.

451 {
452 MsgStream log(msgSvc(), name());
453
454 int numBunch = fTofInfoCal[m_sequence]->getRunEnd();
455 int whichBunch = (static_cast<int>(t0/(12000./499.8/(numBunch*1.0))+0.1))%numBunch;
456
457 double poff2[nBarParOff];
458 if( whichBunch==0 ) {
459 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
460 poff2[i]=fBTofCal[176*m_sequence+id]->getPOff2_bunch0(i);
461 }
462 }
463 else if( whichBunch==1 ) {
464 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
465 poff2[i]=fBTofCal[176*m_sequence+id]->getPOff2_bunch1(i);
466 }
467 }
468 else if( whichBunch==2 ) {
469 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
470 poff2[i]=fBTofCal[176*m_sequence+id]->getPOff2_bunch2(i);
471 }
472 }
473 else if( whichBunch==3 ) {
474 for( int i=0; i<static_cast<int>(nBarParOff); i++ ) {
475 poff2[i]=fBTofCal[176*m_sequence+id]->getPOff2_bunch3(i);
476 }
477 }
478
479 double tCorrOffset2 = 0.0;
480 if( z>=0.0 ) {
481 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;
482 }
483 else {
484 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;
485 }
486
487 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;
488
489 return tCorrOffset2;
490}

Referenced by BTime2().

◆ BTDelay1()

const double TofCaliSvc::BTDelay1 ( unsigned int  id)

Definition at line 338 of file TofCaliSvc.cxx.

338 {
339 double tdelay = 0.0;
340 if( id < 176 ) {
341 tdelay = fBTofCal[176*m_sequence+id]->getP1(0);
342 }
343 else {
344 MsgStream log(msgSvc(), name());
345 log<<MSG::ERROR<<"TofCaliSvc::BTDelay1() -- Wrong TOFID is provided! ID = "<<id<<endreq;
346 }
347 return tdelay;
348}

◆ BTDelay2()

const double TofCaliSvc::BTDelay2 ( unsigned int  id)

Definition at line 351 of file TofCaliSvc.cxx.

351 {
352 double tdelay = 0.0;
353 if( id < 176 ) {
354 tdelay = fBTofCal[176*m_sequence+id]->getP2(0);
355 }
356 else {
357 MsgStream log(msgSvc(), name());
358 log<<MSG::ERROR<<"TofCaliSvc::BTDelay2() -- Wrong TOFID is provided! ID = "<<id<<endreq;
359 }
360 return tdelay;
361}

◆ BTime1()

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

Definition at line 499 of file TofCaliSvc.cxx.

499 {
500 MsgStream log(msgSvc(), name());
501
502 double tcorr1 = BTCorr1( ADC, z, id );
503 double tcorr2 = BTCorrOffset1( z, id, t0);
504 double tcorr3 = fBTofCommonCal[m_sequence]->getOffset(0);
505
506 log << MSG::DEBUG << "BTime1 id =" << id << " tcorr=" << tcorr1 << " toffset=" << tcorr2 << " total offset=" << tcorr3 << endreq;
507
508 double time = TDC - tcorr1 - tcorr2 - tcorr3;
509
510 if(time<0.) {
511 log<<MSG::WARNING<<"TofCaliSvc::BTime1() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" z = "<<z<<" ID = "<<id<<endreq;
512 }
513 return time;
514}
Double_t time
const double BTCorrOffset1(double zHit, unsigned int id, double t0)
Definition: TofCaliSvc.cxx:409
const double BTCorr1(double ADC, double zHit, unsigned int id)
Definition: TofCaliSvc.cxx:377

◆ BTime2()

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

Definition at line 517 of file TofCaliSvc.cxx.

517 {
518 MsgStream log(msgSvc(), name());
519
520 double tcorr1 = BTCorr2( ADC, z, id );
521 double tcorr2 = BTCorrOffset2( z, id ,t0);
522 double tcorr3 = fBTofCommonCal[m_sequence]->getOffset(0);
523
524 log << MSG::DEBUG << "BTime2 id =" << id << " tcorr=" << tcorr1 << " toffset=" << tcorr2 << " total offset=" << tcorr3 << endreq;
525
526 double time = TDC - tcorr1 - tcorr2 - tcorr3;
527
528 if(time<0.) {
529 log<<MSG::WARNING<<"TofCaliSvc::BTime2() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" z = "<<z<<" ID = "<<id<<endreq;
530 }
531 return time;
532}
const double BTCorrOffset2(double zHit, unsigned int id, double t0)
Definition: TofCaliSvc.cxx:451
const double BTCorr2(double ADC, double zHit, unsigned int id)
Definition: TofCaliSvc.cxx:393

◆ BTimeCluster()

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

Definition at line 573 of file TofCaliSvc.cxx.

573 {
574
575 double sigmaCorr = fBTofCommonCal[m_sequence]->getSigmaCorr(0);
576 double sigmaCorr2 = sigmaCorr*sigmaCorr;
577
578 double sigmaInner = BSigmaCounter( z1, id1 );
579 double sigmaInner2 = sigmaInner*sigmaInner;
580 double sigmaOuter = BSigmaCounter( z2, id2 );
581 double sigmaOuter2 = sigmaOuter*sigmaOuter;
582
583 double fraction = ( sigmaOuter2 - sigmaCorr2 )/( sigmaInner2 + sigmaOuter2 - 2.0*sigmaCorr2);
584
585 double wt=fraction*tlayer1 + (1.0-fraction)*tlayer2;
586 if(wt<0.) {
587 MsgStream log(msgSvc(), name());
588 log<<MSG::WARNING<<"TofCaliSvc::BTimeCluster() -- A minus time is given : "<<wt <<" [Input] z1 = "<<z1<<" [Input] z2 = "<<z2<<" ID1 = "<< id1 << " ID2=" << id2 << endreq;
589 }
590 return wt;
591}

◆ BTimeCounter()

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

Definition at line 552 of file TofCaliSvc.cxx.

552 {
553
554 double sigmaCorr = fBTofCommonCal[m_sequence]->getSigmaCorr(0);
555 double sigmaCorr2 = sigmaCorr*sigmaCorr;
556
557 double sigmaLeft = BSigma1( z, id );
558 double sigmaLeft2 = sigmaLeft*sigmaLeft;
559 double sigmaRight = BSigma2( z, id );
560 double sigmaRight2 = sigmaRight*sigmaRight;
561
562 double fraction = ( sigmaRight2 - sigmaCorr2 )/( sigmaLeft2 + sigmaRight2 - 2.0*sigmaCorr2);
563
564 double wt=fraction*tleft + (1.0-fraction)*tright;
565 if(wt<0.) {
566 MsgStream log(msgSvc(), name());
567 log<<MSG::WARNING<<"TofCaliSvc::BTimeCounter() -- A minus time is given : "<<wt <<" [Input] z = "<<z<<" ID = "<<id<<endreq;
568 }
569
570 return wt;
571}
const double BSigma1(double zHit, unsigned int id)
Definition: TofCaliSvc.cxx:594
const double BSigma2(double zHit, unsigned int id)
Definition: TofCaliSvc.cxx:610

◆ BTof()

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

Definition at line 1099 of file TofCaliSvc.cxx.

1099 {
1100 return fBTofCal[176*m_sequence+id];
1101}

Referenced by Dump().

◆ BTofCommon()

BTofCommonCal * TofCaliSvc::BTofCommon ( ) const

Definition at line 1111 of file TofCaliSvc.cxx.

1111 {
1112 return fBTofCommonCal[m_sequence];
1113}

◆ BVeff()

const double TofCaliSvc::BVeff ( unsigned int  id)

Definition at line 935 of file TofCaliSvc.cxx.

935 {
936 if(id<176){
937 return fBTofCal[176*m_sequence+id]->getVeff(0);
938 }else{
939 std::cout<<"bad id="<<id<<std::endl;
940 return 0.;}
941}

◆ chooseConstants()

StatusCode TofCaliSvc::chooseConstants ( int  run,
int  number 
)

Definition at line 273 of file TofCaliSvc.cxx.

273 {
274
275 MsgStream log(msgSvc(), name());
276
277 m_sequence = 0;
278 bool filled = false;
279 unsigned int inumber = 0;
280
281 std::vector<TofInfoCal*>::iterator it = fTofInfoCal.begin();
282 if( (*it)->getRunFrom() == -1 ) {
283 if( fTofInfoCal.size() == 1 ) {
284 log << MSG::INFO << "TofCaliSvc::chooseConstants() -- Run From is equal to -1! The ONLY TOF calibration constants are used!" << endreq;
285 return StatusCode::SUCCESS;
286 }
287 else {
288 log << MSG::ERROR << "TofCaliSvc::chooseConstants() -- Run From is equal to -1! The NUMBER of calibration constants are NOT equal to 1!" << endreq;
289 return StatusCode::FAILURE;
290 }
291 }
292
293 for( ; it!= fTofInfoCal.end(); it++, inumber++ ) {
294 if( ( (*it)->getRunTo() != -1 ) && ( (*it)->getRunTo() < (*it)->getRunFrom() ) ) {
295 log << MSG::ERROR << "TofCaliSvc::chooseConstants() -- The " << inumber << "th calibration constatns is ABNORMAL! Run From is LARGER than RUN To!" << endreq;
296 return StatusCode::FAILURE;
297 }
298 if( ( (*it)->getRunFrom() == (*it)->getRunTo() ) && ( (*it)->getEventFrom() != -1 ) && ( (*it)->getEventTo() != -1 ) && ( (*it)->getEventFrom() > (*it)->getEventTo() ) ) {
299 log << MSG::ERROR << "TofCaliSvc::chooseConstants() -- The " << inumber << "th calibration constatns is ABNORMAL! Event From is LARGER than Event To!" << endreq;
300 return StatusCode::FAILURE;
301 }
302 }
303
304 it = fTofInfoCal.begin();
305 inumber = 0;
306 for( ; it!= fTofInfoCal.end(); it++, inumber++ ) {
307 int runFrom = (*it)->getRunFrom();
308 int runTo = (*it)->getRunTo();
309 int eventFrom = (*it)->getEventFrom();
310 int eventTo = (*it)->getEventTo();
311 if( ( run == runFrom ) && ( ( eventFrom == -1 ) || ( event >= eventFrom ) ) ) {
312 if( ( run < runTo ) || ( ( run == runTo ) && ( ( eventTo == -1 ) || ( event <= eventTo ) ) ) ) {
313 filled = true;
314 break;
315 }
316 }
317 if( run > runFrom ) {
318 if( ( run < runTo ) || ( ( run == runTo ) && ( ( eventTo == -1 ) || ( event <= eventTo ) ) ) ) {
319 filled = true;
320 break;
321 }
322 }
323 }
324
325 if( filled ) {
326 m_sequence = inumber;
327 return StatusCode::SUCCESS;
328 }
329 else {
330 log << MSG::ERROR << "TofCaliSvc::chooseConstants() -- The event with run number " << run << " and event number " << event << " is NOT suitable for this group of calibration constants" << endreq;
331 return StatusCode::FAILURE;
332 }
333
334 return StatusCode::SUCCESS;
335}

◆ Dump()

void TofCaliSvc::Dump ( )

Definition at line 1119 of file TofCaliSvc.cxx.

1119 {
1120 std::cout<<"Now We can get the TOF Calibtration Service"<<std::endl;
1121 std::cout<<"Barrel TOF Counter Number = "<<fBTofCal.size()<<std::endl;
1122 std::cout<<"Endcap TOF Counter Number = "<<fETofCal.size()<<std::endl;
1123
1124 cout<<"The O Barrel TOF PMT1 p1[0] is"<<" "<<BTof(0)->getP1(0)<<endl;
1125 cout<<"The 0 Barrel TOF PMT1 p1[1] is"<<" "<<BTof(0)->getP1(1)<<endl;
1126 cout<<"The 0 Barrel TOF veff is"<<" "<<BTof(0)->getVeff(0)<<endl;
1127 // cout<<"The 22rd Endcap TOF PMT veff is"<<" "<<ETof(22)->getVeff()<<endl;
1128}
BTofCal * BTof(unsigned int id) const

Referenced by main().

◆ EAtten()

const double TofCaliSvc::EAtten ( unsigned int  id)

Definition at line 1049 of file TofCaliSvc.cxx.

1049 {
1050 if( id > 95 ) return -1;
1051 return fETofCal[96*m_sequence+id]->getAtten(0);
1052}

◆ EGain()

const double TofCaliSvc::EGain ( unsigned int  id)

Definition at line 1054 of file TofCaliSvc.cxx.

1054 {
1055 if( id > 95 ) return -1;
1056 return fETofCal[96*m_sequence+id]->getAtten(1);
1057}

◆ Endcap()

const int TofCaliSvc::Endcap ( unsigned int  No)

Definition at line 1091 of file TofCaliSvc.cxx.

1091 {
1092 return fTofInfoCal[m_sequence]->getEndcap(im);
1093}

◆ EPh()

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

Definition at line 920 of file TofCaliSvc.cxx.

920 {
921 double length = 44.5;
922 double a0 = fETofCal[96*m_sequence+id]->getAtten(0);
923 double a1 = fETofCal[96*m_sequence+id]->getAtten(1);
924 double a2 = fETofCal[96*m_sequence+id]->getAtten(2);
925 double q0 = ADC*TMath::Exp(-(a0+a1*(rHit-length)+a2*(rHit-length)*(rHit-length)));
926 return q0;
927}

◆ EPulseHeight()

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

Definition at line 907 of file TofCaliSvc.cxx.

907 {
908 double length = 44.5;
909 double a0 = fETofCal[96*m_sequence+id]->getAtten(0);
910 double a1 = fETofCal[96*m_sequence+id]->getAtten(1);
911 double a2 = fETofCal[96*m_sequence+id]->getAtten(2);
912 double a3 = fETofCal[96*m_sequence+id]->getAtten(3);
913
914 double q0 = ADC*fabs(cost)*TMath::Exp(-(a1*(rHit-length)+a2*(rHit-length)*(rHit-length)))/a3;
915
916 return q0;
917}

◆ ESigma()

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

Definition at line 676 of file TofCaliSvc.cxx.

676 {
677 MsgStream log(msgSvc(), name());
678
679 double fp[nEndSigma];
680 for( int i=0; i<static_cast<int>(nEndSigma); i++) {
681 fp[i]=fETofCal[96*m_sequence+id]->getFPCounter(i);
682 }
683
684 log << MSG::DEBUG << "ESigma id =" << id << " 1=" << fp[0] << " 2=" << fp[1] << " 3=" << fp[2] << endreq;
685
686 double sigma = fp[0] + fp[1]*r + fp[2]*r*r;
687
688 return sigma;
689}
const unsigned int nEndSigma

◆ ETDelay()

const double TofCaliSvc::ETDelay ( unsigned int  id)

Definition at line 364 of file TofCaliSvc.cxx.

364 {
365 double tdelay = 0.0;
366 if( id < 96 ) {
367 tdelay = fETofCal[96*m_sequence+id]->getP(0);
368 }
369 else {
370 MsgStream log(msgSvc(), name());
371 log<<MSG::ERROR<<"TofCaliSvc::ETDelay() -- Wrong TOFID is provided! ID = "<<id<<endreq;
372 }
373 return tdelay;
374}

◆ Etf()

const int TofCaliSvc::Etf ( unsigned int  No)

Definition at line 1095 of file TofCaliSvc.cxx.

1095 {
1096 return fTofInfoCal[m_sequence]->getEndcap(im);
1097}

◆ EtfBunchP()

const double TofCaliSvc::EtfBunchP ( int  index)

Definition at line 858 of file TofCaliSvc.cxx.

858 {
859 MsgStream log(msgSvc(), name());
860
861 double pbunch = 0.0;
862 if( fEtfBunchCal.size()>0 && index>=0 && index<4 ) {
863 pbunch=fEtfBunchCal[m_sequence]->getBunchP(index);
864 }
865
866 return pbunch;
867}

Referenced by EtfTime1(), and EtfTime2().

◆ EtfTime() [1/2]

const double TofCaliSvc::EtfTime ( double  ADC1,
double  ADC2,
double  TDC1,
double  TDC2,
unsigned int  id,
unsigned int  strip,
double  t0 
)

◆ EtfTime() [2/2]

const double TofCaliSvc::EtfTime ( double  tleft,
double  tright 
)

Definition at line 848 of file TofCaliSvc.cxx.

848 {
849 MsgStream log(msgSvc(), name());
850
851 double time = (tleft+tright)/2.0;
852 log << MSG::DEBUG << "EtfTime tleft=" << tleft << " tright=" << tright << " time=" << time << endreq;
853
854 return time;
855}

◆ EtfTime1()

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

Definition at line 724 of file TofCaliSvc.cxx.

724 {
725 MsgStream log(msgSvc(), name());
726
727 double p1[nEtfPar];
728 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
729 p1[i]=fEtfCal[72*12*m_sequence+12*id+strip]->getP1(i);
730 }
731
732 double tcorr1 = p1[0]
733 + p1[1]/TMath::Sqrt(ADC)
734 + p1[2]*ADC
735 + p1[3]*ADC*ADC
736 + p1[4]*ADC*ADC*ADC
737 + p1[5]*ADC*ADC*ADC*ADC
738 + p1[6]*z/TMath::Sqrt(ADC)
739 + p1[7]/ADC
740 + p1[8]*z/ADC
741 + p1[9]*z*ADC
742 + p1[10]*z
743 + p1[11]*z*z
744 + p1[12]*z*z*z;
745 double time1 = TDC - tcorr1;
746
747 int numBunch = fTofInfoCal[m_sequence]->getRunEnd();
748 int ibunch = (static_cast<int>(t0/(12000./499.8/(numBunch*1.0))+0.1))%numBunch;
749 double pbunch = EtfBunchP(ibunch);
750
751 time1 = time1 - pbunch;
752
753 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;
754
755 return time1;
756}
const unsigned int nEtfPar
const double EtfBunchP(int index)
Definition: TofCaliSvc.cxx:858

◆ EtfTime2()

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

Definition at line 759 of file TofCaliSvc.cxx.

759 {
760 MsgStream log(msgSvc(), name());
761
762 double p2[nEtfPar];
763 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
764 p2[i]=fEtfCal[72*12*m_sequence+12*id+strip]->getP2(i);
765 }
766
767 double tcorr2 = p2[0]
768 + p2[1]/TMath::Sqrt(ADC)
769 + p2[2]*ADC
770 + p2[3]*ADC*ADC
771 + p2[4]*ADC*ADC*ADC
772 + p2[5]*ADC*ADC*ADC*ADC
773 + p2[6]*z/TMath::Sqrt(ADC)
774 + p2[7]/ADC
775 + p2[8]*z/ADC
776 + p2[9]*z*ADC
777 + p2[10]*z
778 + p2[11]*z*z
779 + p2[12]*z*z*z;
780 double time2 = TDC - tcorr2;
781
782 int numBunch = fTofInfoCal[m_sequence]->getRunEnd();
783 int ibunch = (static_cast<int>(t0/(12000./499.8/(numBunch*1.0))+0.1))%numBunch;
784 double pbunch = EtfBunchP(ibunch);
785
786 time2 = time2 - pbunch;
787
788 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;
789
790 return time2;
791}

◆ EtfTimeMC()

const double TofCaliSvc::EtfTimeMC ( double  ADC1,
double  ADC2,
double  TDC1,
double  TDC2,
unsigned int  id,
unsigned int  strip,
double  t0 
)

Definition at line 794 of file TofCaliSvc.cxx.

794 {
795 MsgStream log(msgSvc(), name());
796
797 double q = (ADC1+ADC2)/2.0;
798 double t = (TDC1+TDC2)/2.0;
799
800 double p[nEtfPar];
801 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
802 p[i]=fEtfCal[72*12*m_sequence+12*id+strip]->getP(i);
803 }
804
805 double tcorr = p[0] + p[1]/TMath::Sqrt(q);
806 double time = t - tcorr;
807
808 log << MSG::DEBUG << "EtfTime module =" << id << " strip=" << strip << " 1=" << p[0] << " 2=" << p[1] << " tcorr=" << tcorr << " t0=" << t0 << " time=" << time << endreq;
809
810 return time;
811}
TTree * t
Definition: binning.cxx:23

◆ EtfTimeMC1()

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

Definition at line 814 of file TofCaliSvc.cxx.

814 {
815 MsgStream log(msgSvc(), name());
816
817 double p1[nEtfPar];
818 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
819 p1[i]=fEtfCal[72*12*m_sequence+12*id+strip]->getP1(i);
820 }
821
822 double tcorr1 = p1[0] + p1[1]/TMath::Sqrt(ADC) + p1[2]*z;
823 double time1 = TDC - tcorr1;
824
825 log << MSG::DEBUG << "EtfTime1 module =" << id << " strip=" << strip << " 1=" << p1[0] << " 2=" << p1[1] << " 3=" << p1[2] << " tcorr=" << tcorr1 << " t0=" << t0 << " time1=" << time1 << endreq;
826
827 return time1;
828}

◆ EtfTimeMC2()

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

Definition at line 831 of file TofCaliSvc.cxx.

831 {
832 MsgStream log(msgSvc(), name());
833
834 double p2[nEtfPar];
835 for( int i=0; i<static_cast<int>(nEtfPar); i++ ) {
836 p2[i]=fEtfCal[72*12*m_sequence+12*id+strip]->getP2(i);
837 }
838
839 double tcorr2 = p2[0] + p2[1]/TMath::Sqrt(ADC) + p2[2]*z;
840 double time2 = TDC - tcorr2;
841
842 log << MSG::DEBUG << "EtfTime2 module =" << id << " strip=" << strip << " 1=" << p2[0] << " 2=" << p2[1] << " 3=" << p2[2] << " tcorr=" << tcorr2 << " t0=" << t0 << " time2=" << time2 << endreq;
843
844 return time2;
845}

◆ EtfTof()

EtfCal * TofCaliSvc::EtfTof ( unsigned int  id) const

Definition at line 1107 of file TofCaliSvc.cxx.

1107 {
1108 return fEtfCal[72*12*m_sequence+id];
1109}

◆ EtfVeff()

const double TofCaliSvc::EtfVeff ( unsigned int  id,
unsigned int  strip 
)

Definition at line 967 of file TofCaliSvc.cxx.

967 {
968 if(id<72 && strip<12){
969 return fEtfCal[72*12*m_sequence+12*id+strip]->getVeff(0);
970 }else{
971 std::cout<<"bad id="<<id<<" strip="<<strip<<std::endl;
972 return 0.;
973 }
974}

◆ EtfZTDC()

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

Definition at line 1039 of file TofCaliSvc.cxx.

1039 {
1040 double ztdc = -1000.0;
1041 if( id>71 || strip>11 ) return ztdc;
1042 double delay = fEtfCal[72*12*m_sequence+12*id+strip]->getVeff(0);
1043 double veff = fEtfCal[72*12*m_sequence+12*id+strip]->getVeff(1);
1044 ztdc = (tright-tleft-delay)/veff;
1045 return ztdc;
1046}

◆ ETime()

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

Definition at line 655 of file TofCaliSvc.cxx.

655 {
656 MsgStream log(msgSvc(), name());
657
658 double p[nEndPar];
659 for( int i=0; i<static_cast<int>(nEndPar); i++ ) {
660 p[i]=fETofCal[96*m_sequence+id]->getP(i);
661 }
662
663 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;
664
665 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);
666
667 if(time<0.) {
668 MsgStream log(msgSvc(), name());
669 log<<MSG::WARNING<<"TofCaliSvc::ETime() -- A minus time is given : "<< time <<" [Input] ADC = "<<ADC<<" TDC = "<<TDC<<" r = "<< rHit <<" ID = "<<id<<endreq;
670 }
671
672 return time;
673}
const unsigned int nEndPar

◆ ETof()

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

Definition at line 1103 of file TofCaliSvc.cxx.

1103 {
1104 return fETofCal[96*m_sequence+id];
1105}

◆ EVeff()

const double TofCaliSvc::EVeff ( unsigned int  id)

Definition at line 962 of file TofCaliSvc.cxx.

962 {
963 if( id > 175 ) return -1;
964 return fETofCal[96*m_sequence+id]->getVeff(0);
965}

◆ EventFrom()

const int TofCaliSvc::EventFrom ( )

◆ EventTo()

const int TofCaliSvc::EventTo ( )

◆ finalize()

StatusCode TofCaliSvc::finalize ( )
virtual

Definition at line 95 of file TofCaliSvc.cxx.

95 {
96 MsgStream log(msgSvc(), name());
97 log << MSG::INFO << name() << ": End of Run" << endreq;
98 return StatusCode::SUCCESS;
99}

◆ getQ0()

const double TofCaliSvc::getQ0 ( unsigned int  id)

Definition at line 930 of file TofCaliSvc.cxx.

930 {
931 return fBTofCal[176*m_sequence+id]->getAtten(3);
932}

◆ handle()

void TofCaliSvc::handle ( const Incident &  inc)

Definition at line 1130 of file TofCaliSvc.cxx.

1130 {
1131 MsgStream log( messageService(), name() );
1132 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
1133
1134 if ( inc.type() == "NewRun" ){
1135 log << MSG::DEBUG << "New Run" << endreq;
1136 // if(!m_hasbeeninitialized){
1137
1138 StatusCode sc= FillfromDatabase();
1139 if(sc.isSuccess()){
1140 m_hasbeeninitialized=true;
1141 }
1142 // }
1143 }
1144}

◆ initialize()

StatusCode TofCaliSvc::initialize ( )
virtual

Definition at line 62 of file TofCaliSvc.cxx.

62 {
63 m_hasbeeninitialized=false;
64 m_sequence = 0;
65
66 MsgStream log(msgSvc(), name());
67 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
68
69 StatusCode sc = Service::initialize();
70 if ( sc.isFailure() ) return sc;
71
72 IIncidentSvc* incsvc;
73 sc = service("IncidentSvc", incsvc);
74 int priority = 100;
75 if( sc.isSuccess() ){
76 incsvc -> addListener(this, "NewRun", priority);
77 }
78
79 StatusCode scc;
80
81 log<<MSG::INFO << "setProperties()" << endreq;
82 scc = service("CalibDataSvc", m_pCalibDataSvc, true);
83 if ( !scc.isSuccess() ) {
84 log<<MSG::ERROR<<"Could not get IDataProviderSvc interface of CalibXmlCnvSvc"<<endreq;
85 return scc;
86 } else {
87 log << MSG::DEBUG<< "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc"<<endreq;
88 }
89 // Get properties from the JobOptionsSvc
90 scc = setProperties();
91
92 return sc;
93}

Referenced by main().

◆ MisLable()

const int TofCaliSvc::MisLable ( )

Definition at line 1079 of file TofCaliSvc.cxx.

1079 {
1080 return fTofInfoCal[m_sequence]->getMisLable();
1081}

◆ QCorr()

const int TofCaliSvc::QCorr ( )

Definition at line 1071 of file TofCaliSvc.cxx.

1071 {
1072 return fTofInfoCal[m_sequence]->getQCorr();
1073}

◆ QElec()

const int TofCaliSvc::QElec ( )

Definition at line 1075 of file TofCaliSvc.cxx.

1075 {
1076 return fTofInfoCal[m_sequence]->getQElec();
1077}

◆ RunBegin()

const int TofCaliSvc::RunBegin ( )

Definition at line 1059 of file TofCaliSvc.cxx.

1059 {
1060 return fTofInfoCal[m_sequence]->getRunBegin();
1061}

◆ RunEnd()

const int TofCaliSvc::RunEnd ( )

Definition at line 1063 of file TofCaliSvc.cxx.

1063 {
1064 return fTofInfoCal[m_sequence]->getRunEnd();
1065}

◆ RunFrom()

const int TofCaliSvc::RunFrom ( )

◆ RunTo()

const int TofCaliSvc::RunTo ( )

◆ TOffset()

const double TofCaliSvc::TOffset ( )

Definition at line 493 of file TofCaliSvc.cxx.

493 {
494 double toffset = fBTofCommonCal[m_sequence]->getOffset(0);
495 return toffset;
496}

◆ TofInfo()

TofInfoCal * TofCaliSvc::TofInfo ( ) const

Definition at line 1115 of file TofCaliSvc.cxx.

1115 {
1116 return fTofInfoCal[m_sequence];
1117}

◆ Version()

const int TofCaliSvc::Version ( )

Definition at line 1067 of file TofCaliSvc.cxx.

1067 {
1068 return fTofInfoCal[m_sequence]->getVersion();
1069}

◆ ZADC()

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

Definition at line 1006 of file TofCaliSvc.cxx.

1006 {
1007 double zadc = -1000.0;
1008 if( id > 175 ) return zadc;
1009 if( qright < 1.0e-6 ) return zadc;
1010 double ldecay = fBTofCal[176*m_sequence+id]->getAtten(0);
1011 double a1overa2 = fBTofCal[176*m_sequence+id]->getAtten(1);
1012 double q1overq2 = log(qleft/qright);
1013 zadc = 0.5*ldecay*( q1overq2 - a1overa2 );
1014 return zadc;
1015}

◆ ZADC1()

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

Definition at line 1017 of file TofCaliSvc.cxx.

1017 {
1018 double qleft = -1000.0;
1019 if( id > 175 ) return qleft;
1020 if( qright < 1.0e-6 ) return qleft;
1021 double ldecay = fBTofCal[176*m_sequence+id]->getAtten(0);
1022 double a1overa2 = fBTofCal[176*m_sequence+id]->getAtten(1);
1023 double q1overq2 = 2.0*z/ldecay + a1overa2;
1024 qleft = qright*exp(q1overq2);
1025 return qleft;
1026}
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252

◆ ZADC2()

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

Definition at line 1028 of file TofCaliSvc.cxx.

1028 {
1029 double qright = -1000.0;
1030 if( id > 175 ) return qright;
1031 if( qleft < 1.0e-6 ) return qright;
1032 double ldecay = fBTofCal[176*m_sequence+id]->getAtten(0);
1033 double a1overa2 = fBTofCal[176*m_sequence+id]->getAtten(1);
1034 double q1overq2 = 2.0*z/ldecay + a1overa2;
1035 qright = qleft*exp(-q1overq2);
1036 return qright;
1037}

◆ ZTDC()

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

Definition at line 977 of file TofCaliSvc.cxx.

977 {
978 double ztdc = -1000.0;
979 if( id > 175 ) return ztdc;
980 double veff = fBTofCal[176*m_sequence+id]->getVeff(0);
981 double delay = fBTofCal[176*m_sequence+id]->getVeff(1);
982 ztdc = 0.5*veff*(tright-tleft-delay);
983 return ztdc;
984}

◆ ZTDC1()

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

Definition at line 986 of file TofCaliSvc.cxx.

986 {
987 double tleft = -1000.0;
988 if( id > 175 ) return tleft;
989 if( tright < -900.0 ) return tleft;
990 double veff = fBTofCal[176*m_sequence+id]->getVeff(0);
991 double delay = fBTofCal[176*m_sequence+id]->getVeff(1);
992 tleft = tright-delay-2.0*z/veff;
993 return tleft;
994}

◆ ZTDC2()

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

Definition at line 996 of file TofCaliSvc.cxx.

996 {
997 double tright = -1000.0;
998 if( id > 175 ) return tright;
999 if( tleft < -900.0 ) return tright;
1000 double veff = fBTofCal[176*m_sequence+id]->getVeff(0);
1001 double delay = fBTofCal[176*m_sequence+id]->getVeff(1);
1002 tright = tleft+delay+2.0*z/veff;
1003 return tright;
1004}

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