BOSS 7.0.8
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 &)
 
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 ()
 
- Public Member Functions inherited from ITofCaliSvc
virtual StatusCode chooseConstants (int run, int event)=0
 
virtual BTofCalBTof (unsigned id) const =0
 
virtual BTofCommonCalBTofCommon () const =0
 
virtual ETofCalETof (unsigned id) const =0
 
virtual EtfCalEtfTof (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 EtfTime (double ADC1, double ADC2, double TDC1, double TDC2, unsigned int id, unsigned int strip, double t0)=0
 
virtual const double EtfTime1 (double ADC, double TDC, double zHit, unsigned id, unsigned strip, double t0)=0
 
virtual const double EtfTime2 (double ADC, double TDC, double zHit, unsigned id, unsigned strip, double t0)=0
 
virtual const double EtfTimeMC (double ADC1, double ADC2, double TDC1, double TDC2, unsigned int id, unsigned int strip, double t0)=0
 
virtual const double EtfTimeMC1 (double ADC, double TDC, double zHit, unsigned id, unsigned strip, double t0)=0
 
virtual const double EtfTimeMC2 (double ADC, double TDC, double zHit, unsigned id, unsigned strip, double t0)=0
 
virtual const double EtfTime (double tleft, double tright)=0
 
virtual const double EtfBunchP (int index)=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 EtfVeff (unsigned int id, unsigned int strip)=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 double EtfZTDC (double tleft, double tright, unsigned int id, unsigned int strip)=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 const int Etf (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 26 of file TofCaliSvc.h.

Constructor & Destructor Documentation

◆ TofCaliSvc()

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

Definition at line 45 of file TofCaliSvc.cxx.

45 : Service(name, svcloc) {
46 declareProperty("Run",m_run=1);
47 m_sequence = 0;
48}

◆ ~TofCaliSvc()

TofCaliSvc::~TofCaliSvc ( )

Definition at line 98 of file TofCaliSvc.cxx.

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

Member Function Documentation

◆ BAtten()

const double TofCaliSvc::BAtten ( unsigned int  id)

Definition at line 941 of file TofCaliSvc.cxx.

941 {
942 if( id > 175 ) return -1;
943 return fBTofCal[176*m_sequence+id]->getAtten(0);
944}

◆ BGainBackward()

const double TofCaliSvc::BGainBackward ( unsigned int  id)

Definition at line 954 of file TofCaliSvc.cxx.

954 {
955 if( id > 175 ) return -1;
956 return fBTofCal[176*m_sequence+id]->getAtten(2);
957}

◆ BGainForward()

const double TofCaliSvc::BGainForward ( unsigned int  id)

Definition at line 946 of file TofCaliSvc.cxx.

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

◆ BPh()

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

Implements ITofCaliSvc.

Definition at line 895 of file TofCaliSvc.cxx.

895 {
896 double length = 230.0;
897 double Latten = fBTofCal[176*m_sequence+id]->getAtten(0);
898 double gainRatio = fBTofCal[176*m_sequence+id]->getAtten(1);
899 double q = ( ADC1*TMath::Exp((0.5*length-zHit)/Latten)+ADC2*TMath::Exp((0.5*length+zHit)/Latten) )/(1.0+TMath::Exp(gainRatio));
900 return q;
901}
****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 885 of file TofCaliSvc.cxx.

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

◆ BPulseHeight1()

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

Implements ITofCaliSvc.

Definition at line 867 of file TofCaliSvc.cxx.

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

◆ BPulseHeight2()

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

Implements ITofCaliSvc.

Definition at line 876 of file TofCaliSvc.cxx.

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

◆ BrEast()

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

Implements ITofCaliSvc.

Definition at line 1080 of file TofCaliSvc.cxx.

1080 {
1081 return fTofInfoCal[m_sequence]->getBrEast(im);
1082}

◆ BrWest()

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

Implements ITofCaliSvc.

Definition at line 1084 of file TofCaliSvc.cxx.

1084 {
1085 return fTofInfoCal[m_sequence]->getBrWest(im);
1086}

◆ BSigma1()

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

Definition at line 591 of file TofCaliSvc.cxx.

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

Referenced by BTimeCounter().

◆ BSigma2()

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

Definition at line 607 of file TofCaliSvc.cxx.

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

Referenced by BTimeCounter().

◆ BSigmaCluster()

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

Definition at line 639 of file TofCaliSvc.cxx.

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

◆ BSigmaCounter()

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

Definition at line 623 of file TofCaliSvc.cxx.

623 {
624 MsgStream log(msgSvc(), name());
625
626 double fplayer[nBarSigCnt];
627 for( int i=0; i<static_cast<int>(nBarSigCnt); i++ ) {
628 fplayer[i]=fBTofCal[176*m_sequence+id]->getFPCounter(i);
629 }
630
631 log << MSG::DEBUG << "BSigmaCounter id =" << id << " 1=" << fplayer[0] << " 2=" << fplayer[1] << " 3=" << fplayer[2] << " 4=" << fplayer[3] << " 5=" << fplayer[4] << endreq;
632
633 double sigma = fplayer[0] + fplayer[1]*z + fplayer[2]*z*z + fplayer[3]*z*z*z + fplayer[4]*z*z*z*z;
634
635 return sigma;
636}
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 374 of file TofCaliSvc.cxx.

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

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

Referenced by BTime2().

◆ BTCorrOffset1()

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

Implements ITofCaliSvc.

Definition at line 406 of file TofCaliSvc.cxx.

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

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

Referenced by BTime2().

◆ BTDelay1()

const double TofCaliSvc::BTDelay1 ( unsigned int  id)

Definition at line 335 of file TofCaliSvc.cxx.

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

◆ BTDelay2()

const double TofCaliSvc::BTDelay2 ( unsigned int  id)

Definition at line 348 of file TofCaliSvc.cxx.

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

◆ BTime1()

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

Definition at line 496 of file TofCaliSvc.cxx.

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

◆ BTime2()

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

Definition at line 514 of file TofCaliSvc.cxx.

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

◆ BTimeCluster()

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

Definition at line 570 of file TofCaliSvc.cxx.

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

◆ BTimeCounter()

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

Definition at line 549 of file TofCaliSvc.cxx.

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

◆ BTof()

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

Definition at line 1096 of file TofCaliSvc.cxx.

1096 {
1097 return fBTofCal[176*m_sequence+id];
1098}

Referenced by Dump().

◆ BTofCommon()

BTofCommonCal * TofCaliSvc::BTofCommon ( ) const
virtual

Implements ITofCaliSvc.

Definition at line 1108 of file TofCaliSvc.cxx.

1108 {
1109 return fBTofCommonCal[m_sequence];
1110}

◆ BVeff()

const double TofCaliSvc::BVeff ( unsigned int  id)

Definition at line 932 of file TofCaliSvc.cxx.

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

◆ chooseConstants()

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

Implements ITofCaliSvc.

Definition at line 270 of file TofCaliSvc.cxx.

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

◆ Dump()

void TofCaliSvc::Dump ( )
virtual

Implements ITofCaliSvc.

Definition at line 1116 of file TofCaliSvc.cxx.

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

Referenced by main().

◆ EAtten()

const double TofCaliSvc::EAtten ( unsigned int  id)

Definition at line 1046 of file TofCaliSvc.cxx.

1046 {
1047 if( id > 95 ) return -1;
1048 return fETofCal[96*m_sequence+id]->getAtten(0);
1049}

◆ EGain()

const double TofCaliSvc::EGain ( unsigned int  id)

Definition at line 1051 of file TofCaliSvc.cxx.

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

◆ Endcap()

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

Implements ITofCaliSvc.

Definition at line 1088 of file TofCaliSvc.cxx.

1088 {
1089 return fTofInfoCal[m_sequence]->getEndcap(im);
1090}

◆ EPh()

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

Implements ITofCaliSvc.

Definition at line 917 of file TofCaliSvc.cxx.

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

◆ EPulseHeight()

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

Implements ITofCaliSvc.

Definition at line 904 of file TofCaliSvc.cxx.

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

◆ ESigma()

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

Definition at line 673 of file TofCaliSvc.cxx.

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

◆ ETDelay()

const double TofCaliSvc::ETDelay ( unsigned int  id)

Definition at line 361 of file TofCaliSvc.cxx.

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

◆ Etf()

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

Implements ITofCaliSvc.

Definition at line 1092 of file TofCaliSvc.cxx.

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

◆ EtfBunchP()

const double TofCaliSvc::EtfBunchP ( int  index)
virtual

Implements ITofCaliSvc.

Definition at line 855 of file TofCaliSvc.cxx.

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

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 
)
virtual

Implements ITofCaliSvc.

◆ EtfTime() [2/2]

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

Implements ITofCaliSvc.

Definition at line 845 of file TofCaliSvc.cxx.

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

◆ EtfTime1()

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

Definition at line 721 of file TofCaliSvc.cxx.

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

◆ EtfTime2()

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

Definition at line 756 of file TofCaliSvc.cxx.

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

◆ EtfTimeMC()

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

Implements ITofCaliSvc.

Definition at line 791 of file TofCaliSvc.cxx.

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

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

◆ EtfTimeMC2()

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

Definition at line 828 of file TofCaliSvc.cxx.

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

◆ EtfTof()

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

Definition at line 1104 of file TofCaliSvc.cxx.

1104 {
1105 return fEtfCal[72*12*m_sequence+id];
1106}

◆ EtfVeff()

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

Implements ITofCaliSvc.

Definition at line 964 of file TofCaliSvc.cxx.

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

◆ EtfZTDC()

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

Implements ITofCaliSvc.

Definition at line 1036 of file TofCaliSvc.cxx.

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

◆ ETime()

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

Definition at line 652 of file TofCaliSvc.cxx.

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

◆ ETof()

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

Definition at line 1100 of file TofCaliSvc.cxx.

1100 {
1101 return fETofCal[96*m_sequence+id];
1102}

◆ EVeff()

const double TofCaliSvc::EVeff ( unsigned int  id)

Definition at line 959 of file TofCaliSvc.cxx.

959 {
960 if( id > 175 ) return -1;
961 return fETofCal[96*m_sequence+id]->getVeff(0);
962}

◆ EventFrom()

const int TofCaliSvc::EventFrom ( )

◆ EventTo()

const int TofCaliSvc::EventTo ( )

◆ finalize()

StatusCode TofCaliSvc::finalize ( )
virtual

Definition at line 92 of file TofCaliSvc.cxx.

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

◆ getQ0()

const double TofCaliSvc::getQ0 ( unsigned int  id)

Definition at line 927 of file TofCaliSvc.cxx.

927 {
928 return fBTofCal[176*m_sequence+id]->getAtten(3);
929}

◆ handle()

void TofCaliSvc::handle ( const Incident &  inc)

Definition at line 1127 of file TofCaliSvc.cxx.

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

◆ initialize()

StatusCode TofCaliSvc::initialize ( )
virtual

Definition at line 59 of file TofCaliSvc.cxx.

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

Referenced by main().

◆ MisLable()

const int TofCaliSvc::MisLable ( )
virtual

Implements ITofCaliSvc.

Definition at line 1076 of file TofCaliSvc.cxx.

1076 {
1077 return fTofInfoCal[m_sequence]->getMisLable();
1078}

◆ QCorr()

const int TofCaliSvc::QCorr ( )
virtual

Implements ITofCaliSvc.

Definition at line 1068 of file TofCaliSvc.cxx.

1068 {
1069 return fTofInfoCal[m_sequence]->getQCorr();
1070}

◆ QElec()

const int TofCaliSvc::QElec ( )
virtual

Implements ITofCaliSvc.

Definition at line 1072 of file TofCaliSvc.cxx.

1072 {
1073 return fTofInfoCal[m_sequence]->getQElec();
1074}

◆ queryInterface()

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

Definition at line 50 of file TofCaliSvc.cxx.

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

◆ RunBegin()

const int TofCaliSvc::RunBegin ( )
virtual

Implements ITofCaliSvc.

Definition at line 1056 of file TofCaliSvc.cxx.

1056 {
1057 return fTofInfoCal[m_sequence]->getRunBegin();
1058}

◆ RunEnd()

const int TofCaliSvc::RunEnd ( )
virtual

Implements ITofCaliSvc.

Definition at line 1060 of file TofCaliSvc.cxx.

1060 {
1061 return fTofInfoCal[m_sequence]->getRunEnd();
1062}

◆ RunFrom()

const int TofCaliSvc::RunFrom ( )

◆ RunTo()

const int TofCaliSvc::RunTo ( )

◆ TOffset()

const double TofCaliSvc::TOffset ( )
virtual

Implements ITofCaliSvc.

Definition at line 490 of file TofCaliSvc.cxx.

490 {
491 double toffset = fBTofCommonCal[m_sequence]->getOffset(0);
492 return toffset;
493}

◆ TofInfo()

TofInfoCal * TofCaliSvc::TofInfo ( ) const
virtual

Implements ITofCaliSvc.

Definition at line 1112 of file TofCaliSvc.cxx.

1112 {
1113 return fTofInfoCal[m_sequence];
1114}

◆ Version()

const int TofCaliSvc::Version ( )
virtual

Implements ITofCaliSvc.

Definition at line 1064 of file TofCaliSvc.cxx.

1064 {
1065 return fTofInfoCal[m_sequence]->getVersion();
1066}

◆ ZADC()

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

Definition at line 1003 of file TofCaliSvc.cxx.

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

◆ ZADC1()

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

Definition at line 1014 of file TofCaliSvc.cxx.

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

◆ ZADC2()

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

Definition at line 1025 of file TofCaliSvc.cxx.

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

◆ ZTDC()

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

Definition at line 974 of file TofCaliSvc.cxx.

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

◆ ZTDC1()

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

Definition at line 983 of file TofCaliSvc.cxx.

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

◆ ZTDC2()

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

Definition at line 993 of file TofCaliSvc.cxx.

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

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