BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TofCorrPID Class Reference

#include <TofCorrPID.h>

Inheritance diagram for TofCorrPID:

Public Member Functions

 ~TofCorrPID ()
void init ()
void calculate ()
bool IsPidInfoValid () const
double chi (int n) const
double prob (int n) const
double offset (int n) const
double sigma (int n) const
int ndof () const
int ipmt () const
double dt (int ipar, int ipmt) const
double dtCorr (int ipar, int ipmt) const
double sigCorr (int ipar, int ipmt) const
double chiCorr (int ipar, int ipmt) const
 ~TofCorrPID ()
void init ()
void calculate ()
bool IsPidInfoValid () const
double chi (int n) const
double prob (int n) const
double offset (int n) const
double sigma (int n) const
int ndof () const
int ipmt () const
double dt (int ipar, int ipmt) const
double dtCorr (int ipar, int ipmt) const
double sigCorr (int ipar, int ipmt) const
double chiCorr (int ipar, int ipmt) const
 ~TofCorrPID ()
void init ()
void calculate ()
bool IsPidInfoValid () const
double chi (int n) const
double prob (int n) const
double offset (int n) const
double sigma (int n) const
int ndof () const
int ipmt () const
double dt (int ipar, int ipmt) const
double dtCorr (int ipar, int ipmt) const
double sigCorr (int ipar, int ipmt) const
double chiCorr (int ipar, int ipmt) const
Public Member Functions inherited from ParticleIDBase
 ParticleIDBase ()
virtual ~ParticleIDBase ()
EvtRecTrackPidTrk () const
void setRecTrack (EvtRecTrack *trk)
double chiMinCut () const
void setChiMinCut (const double chi=4)
double chiMaxCut () const
void setChiMaxCut (const double chi=6)
double pdfMinSigmaCut () const
void setPdfMinSigmaCut (const double pdf=4)
double getRunNo () const
void setRunNo (const double runh=8093)
double p ()
double pt ()
double charge ()
double xmass (int n)
double velc ()
double probCalculate (double chi2, int n)
double pdfCalculate (double offset, double sigma)
double interpolation (double *x, double *y, double x1)
double pol2 (double x, double *par)
double pol3 (double x, double *par)
double pol4 (double x, double *par)
int useDedx () const
int useTof () const
int useTof1 () const
int useTof2 () const
int useTofE () const
int useTofQ () const
int useTofC () const
int useTofCorr () const
int useEmc () const
int useMuc () const
int onlyPionKaon () const
int onlyPionKaonProton () const
int onlyPionKaonElectron () const
int all () const
int onlyElectron () const
int onlyMuon () const
int onlyPion () const
int onlyKaon () const
int onlyProton () const
int methodLikelihood () const
int methodProbability () const
int methodNeuronNetwork () const
int dedxValid () const
int tofValid () const
int tofeValid () const
int tofqValid () const
int tofcValid () const
int tofcorrValid () const
int emcValid () const
int mucValid () const
void set_path (const char *s_path=0)
void set_path (std::string s_path)
 ParticleIDBase ()
virtual ~ParticleIDBase ()
EvtRecTrackPidTrk () const
void setRecTrack (EvtRecTrack *trk)
double chiMinCut () const
void setChiMinCut (const double chi=4)
double chiMaxCut () const
void setChiMaxCut (const double chi=6)
double pdfMinSigmaCut () const
void setPdfMinSigmaCut (const double pdf=4)
double getRunNo () const
void setRunNo (const double runh=8093)
double p ()
double pt ()
double charge ()
double xmass (int n)
double velc ()
double probCalculate (double chi2, int n)
double pdfCalculate (double offset, double sigma)
double interpolation (double *x, double *y, double x1)
double pol2 (double x, double *par)
double pol3 (double x, double *par)
double pol4 (double x, double *par)
int useDedx () const
int useTof () const
int useTof1 () const
int useTof2 () const
int useTofE () const
int useTofQ () const
int useTofC () const
int useTofCorr () const
int useEmc () const
int useMuc () const
int onlyPionKaon () const
int onlyPionKaonProton () const
int onlyPionKaonElectron () const
int all () const
int onlyElectron () const
int onlyMuon () const
int onlyPion () const
int onlyKaon () const
int onlyProton () const
int methodLikelihood () const
int methodProbability () const
int methodNeuronNetwork () const
int dedxValid () const
int tofValid () const
int tofeValid () const
int tofqValid () const
int tofcValid () const
int tofcorrValid () const
int emcValid () const
int mucValid () const
void set_path (const char *s_path=0)
void set_path (std::string s_path)
 ParticleIDBase ()
virtual ~ParticleIDBase ()
EvtRecTrackPidTrk () const
void setRecTrack (EvtRecTrack *trk)
double chiMinCut () const
void setChiMinCut (const double chi=4)
double chiMaxCut () const
void setChiMaxCut (const double chi=6)
double pdfMinSigmaCut () const
void setPdfMinSigmaCut (const double pdf=4)
double getRunNo () const
void setRunNo (const double runh=8093)
double p ()
double pt ()
double charge ()
double xmass (int n)
double velc ()
double probCalculate (double chi2, int n)
double pdfCalculate (double offset, double sigma)
double interpolation (double *x, double *y, double x1)
double pol2 (double x, double *par)
double pol3 (double x, double *par)
double pol4 (double x, double *par)
int useDedx () const
int useTof () const
int useTof1 () const
int useTof2 () const
int useTofE () const
int useTofQ () const
int useTofC () const
int useTofCorr () const
int useEmc () const
int useMuc () const
int onlyPionKaon () const
int onlyPionKaonProton () const
int onlyPionKaonElectron () const
int all () const
int onlyElectron () const
int onlyMuon () const
int onlyPion () const
int onlyKaon () const
int onlyProton () const
int methodLikelihood () const
int methodProbability () const
int methodNeuronNetwork () const
int dedxValid () const
int tofValid () const
int tofeValid () const
int tofqValid () const
int tofcValid () const
int tofcorrValid () const
int emcValid () const
int mucValid () const
void set_path (const char *s_path=0)
void set_path (std::string s_path)

Static Public Member Functions

static TofCorrPIDinstance ()
static TofCorrPIDinstance ()
static TofCorrPIDinstance ()

Protected Member Functions

int particleIDCalculation ()
int neuronPIDCalculation ()
int LikelihoodCalculation ()
void inputParameter (int run)
double offsetTof (unsigned int ispecies, bool barrel, unsigned int ipmt, double betaGamma, int charge, double zrhit, double dt)
double offsetTof (unsigned int ispecies, int tofid, double zrhit, double betaGamma, int charge, double dt)
double offsetTof (unsigned int ispecies, int tofid1, int tofid2, double zrhit1, double zrhit2, double betaGamma, int charge, double dt)
double sigmaTof (unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, int tofid[2], double zrhit[2], double betaGamma)
double sigmaTof (unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, double zrhit, double betaGamma)
double qCurveFunc (unsigned int layer, double betaGamma)
double bSigma (unsigned int end, int tofid, double zrhit)
double bSigma (int tofid[2], double zrhit[2])
double eSigma (int tofid, double zrhit)
bool correlationCheck (unsigned int ipmt)
int particleIDCalculation ()
int neuronPIDCalculation ()
int LikelihoodCalculation ()
void inputParameter (int run)
double offsetTof (unsigned int ispecies, bool barrel, unsigned int ipmt, double betaGamma, int charge, double zrhit, double dt)
double offsetTof (unsigned int ispecies, int tofid, double zrhit, double betaGamma, int charge, double dt)
double offsetTof (unsigned int ispecies, int tofid1, int tofid2, double zrhit1, double zrhit2, double betaGamma, int charge, double dt)
double sigmaTof (unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, int tofid[2], double zrhit[2], double betaGamma)
double sigmaTof (unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, double zrhit, double betaGamma)
double qCurveFunc (unsigned int layer, double betaGamma)
double bSigma (unsigned int end, int tofid, double zrhit)
double bSigma (int tofid[2], double zrhit[2])
double eSigma (int tofid, double zrhit)
bool correlationCheck (unsigned int ipmt)
int particleIDCalculation ()
int neuronPIDCalculation ()
int LikelihoodCalculation ()
void inputParameter (int run)
double offsetTof (unsigned int ispecies, bool barrel, unsigned int ipmt, double betaGamma, int charge, double zrhit, double dt)
double offsetTof (unsigned int ispecies, int tofid, double zrhit, double betaGamma, int charge, double dt)
double offsetTof (unsigned int ispecies, int tofid1, int tofid2, double zrhit1, double zrhit2, double betaGamma, int charge, double dt)
double sigmaTof (unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, int tofid[2], double zrhit[2], double betaGamma)
double sigmaTof (unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, double zrhit, double betaGamma)
double qCurveFunc (unsigned int layer, double betaGamma)
double bSigma (unsigned int end, int tofid, double zrhit)
double bSigma (int tofid[2], double zrhit[2])
double eSigma (int tofid, double zrhit)
bool correlationCheck (unsigned int ipmt)

Additional Inherited Members

Static Protected Attributes inherited from ParticleIDBase
static std::string path = ""

Detailed Description

Constructor & Destructor Documentation

◆ ~TofCorrPID() [1/3]

TofCorrPID::~TofCorrPID ( )
inline

Definition at line 17 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

17{ ; }

◆ ~TofCorrPID() [2/3]

TofCorrPID::~TofCorrPID ( )
inline

◆ ~TofCorrPID() [3/3]

TofCorrPID::~TofCorrPID ( )
inline

Member Function Documentation

◆ bSigma() [1/6]

double TofCorrPID::bSigma ( int tofid[2],
double zrhit[2] )
protected

Definition at line 1103 of file TofCorrPID.cxx.

1103 {
1104
1105 double sigma1 = bSigma( 2, tofid[0], zrhit[0] );
1106 double sigma2 = bSigma( 2, tofid[1], zrhit[1] );
1107 double sigmaCorr2 = m_p_common * m_p_common;
1108 double sigma = ( sigma1 * sigma1 * sigma2 * sigma2 - sigmaCorr2 * sigmaCorr2 ) /
1109 ( sigma1 * sigma1 + sigma2 * sigma2 - 2.0 * sigmaCorr2 );
1110 sigma = sqrt( fabs( sigma ) );
1111
1112 return sigma;
1113}
double bSigma(unsigned int end, int tofid, double zrhit)

◆ bSigma() [2/6]

double TofCorrPID::bSigma ( int tofid[2],
double zrhit[2] )
protected

◆ bSigma() [3/6]

double TofCorrPID::bSigma ( int tofid[2],
double zrhit[2] )
protected

◆ bSigma() [4/6]

double TofCorrPID::bSigma ( unsigned int end,
int tofid,
double zrhit )
protected

Definition at line 1088 of file TofCorrPID.cxx.

1088 {
1089
1090 double func[5];
1091 func[0] = 1.0;
1092 func[1] = zrhit;
1093 func[2] = zrhit * zrhit;
1094 func[3] = zrhit * zrhit * zrhit;
1095 func[4] = zrhit * zrhit * zrhit * zrhit;
1096
1097 double sigma = 0.0;
1098 for ( unsigned int i = 0; i < 5; i++ ) { sigma += m_p_weight[tofid][end][i] * func[i]; }
1099
1100 return sigma;
1101}

Referenced by bSigma(), offsetTof(), offsetTof(), and sigmaTof().

◆ bSigma() [5/6]

double TofCorrPID::bSigma ( unsigned int end,
int tofid,
double zrhit )
protected

◆ bSigma() [6/6]

double TofCorrPID::bSigma ( unsigned int end,
int tofid,
double zrhit )
protected

◆ calculate() [1/3]

void TofCorrPID::calculate ( )
virtual

Implements ParticleIDBase.

Definition at line 62 of file TofCorrPID.cxx.

62 {
63 if ( particleIDCalculation() == 0 ) m_ndof = 1;
64}
int particleIDCalculation()

◆ calculate() [2/3]

void TofCorrPID::calculate ( )
virtual

Implements ParticleIDBase.

◆ calculate() [3/3]

void TofCorrPID::calculate ( )
virtual

Implements ParticleIDBase.

◆ chi() [1/3]

double TofCorrPID::chi ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 22 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

22{ return m_chi[n]; }
const Int_t n

◆ chi() [2/3]

double TofCorrPID::chi ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 22 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

22{ return m_chi[n]; }

◆ chi() [3/3]

double TofCorrPID::chi ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 22 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

22{ return m_chi[n]; }

◆ chiCorr() [1/3]

double TofCorrPID::chiCorr ( int ipar,
int ipmt ) const
inline

Definition at line 32 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

32{ return m_chiCorr[ipar][ipmt]; }

◆ chiCorr() [2/3]

double TofCorrPID::chiCorr ( int ipar,
int ipmt ) const
inline

Definition at line 32 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

32{ return m_chiCorr[ipar][ipmt]; }

◆ chiCorr() [3/3]

double TofCorrPID::chiCorr ( int ipar,
int ipmt ) const
inline

Definition at line 32 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

32{ return m_chiCorr[ipar][ipmt]; }

◆ correlationCheck() [1/3]

bool TofCorrPID::correlationCheck ( unsigned int ipmt)
protected

Definition at line 1128 of file TofCorrPID.cxx.

1128 {
1129 bool chiCut = false;
1130 bool good = false;
1131 double pdftemp = 0;
1132 for ( unsigned int i = 0; i < 5; i++ )
1133 {
1134 if ( ( m_chiCorr[i][ipmt] > ( 0.0 - chiMinCut() ) && m_chiCorr[i][ipmt] < chiMaxCut() ) &&
1135 !good )
1136 { good = true; }
1137 double ppp = pdfCalculate( m_chiCorr[i][ipmt], 1 );
1138 if ( fabs( ppp ) > pdftemp ) { pdftemp = fabs( ppp ); }
1139 }
1140 m_pdfmin = pdftemp;
1141 if ( pdftemp < pdfCalculate( pdfMinSigmaCut(), 1 ) ) return chiCut;
1142 if ( !good ) return chiCut;
1143 chiCut = true;
1144 return chiCut;
1145}
double pdfCalculate(double offset, double sigma)

Referenced by particleIDCalculation().

◆ correlationCheck() [2/3]

bool TofCorrPID::correlationCheck ( unsigned int ipmt)
protected

◆ correlationCheck() [3/3]

bool TofCorrPID::correlationCheck ( unsigned int ipmt)
protected

◆ dt() [1/3]

double TofCorrPID::dt ( int ipar,
int ipmt ) const
inline

Definition at line 29 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

29{ return m_dt[ipar][ipmt]; }

Referenced by offsetTof(), offsetTof(), offsetTof(), and particleIDCalculation().

◆ dt() [2/3]

double TofCorrPID::dt ( int ipar,
int ipmt ) const
inline

Definition at line 29 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

29{ return m_dt[ipar][ipmt]; }

◆ dt() [3/3]

double TofCorrPID::dt ( int ipar,
int ipmt ) const
inline

Definition at line 29 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

29{ return m_dt[ipar][ipmt]; }

◆ dtCorr() [1/3]

double TofCorrPID::dtCorr ( int ipar,
int ipmt ) const
inline

Definition at line 30 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

30{ return m_dtCorr[ipar][ipmt]; }

◆ dtCorr() [2/3]

double TofCorrPID::dtCorr ( int ipar,
int ipmt ) const
inline

Definition at line 30 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

30{ return m_dtCorr[ipar][ipmt]; }

◆ dtCorr() [3/3]

double TofCorrPID::dtCorr ( int ipar,
int ipmt ) const
inline

Definition at line 30 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

30{ return m_dtCorr[ipar][ipmt]; }

◆ eSigma() [1/3]

double TofCorrPID::eSigma ( int tofid,
double zrhit )
protected

Definition at line 1115 of file TofCorrPID.cxx.

1115 {
1116
1117 double func[5];
1118 func[0] = 1.0;
1119 func[1] = zrhit;
1120 func[2] = zrhit * zrhit;
1121
1122 double sigma = 0.0;
1123 for ( unsigned int i = 0; i < 3; i++ ) { sigma += m_ec_sigma[tofid][i] * func[i]; }
1124
1125 return sigma;
1126}

Referenced by sigmaTof().

◆ eSigma() [2/3]

double TofCorrPID::eSigma ( int tofid,
double zrhit )
protected

◆ eSigma() [3/3]

double TofCorrPID::eSigma ( int tofid,
double zrhit )
protected

◆ init() [1/3]

void TofCorrPID::init ( )
virtual

Implements ParticleIDBase.

Definition at line 29 of file TofCorrPID.cxx.

29 {
30
31 for ( int i = 0; i < 5; i++ )
32 {
33 m_chi[i] = -100.0;
34 m_prob[i] = -1.0;
35 m_sigma[i] = 10.0;
36 m_offset[i] = -1000.0;
37 }
38 m_chimin = -99.0;
39 m_chimax = 99.0;
40 m_pdfmin = 99.;
41 m_ndof = 0;
42
43 m_ipmt = -1;
44 for ( unsigned int i = 0; i < 5; i++ )
45 {
46 for ( unsigned int j = 0; j < 7; j++ )
47 {
48 m_dt[i][j] = -1000.0;
49 m_dtCorr[i][j] = -1000.0;
50 m_sigCorr[i][j] = 10.0;
51 m_chiCorr[i][j] = 100.0;
52 }
53 }
54
55 int run = getRunNo();
56 if ( !( abs( run ) >= m_runBegin && abs( run ) <= m_runEnd ) )
57 { inputParameter( getRunNo() ); }
58
59 return;
60}
void inputParameter(int run)

◆ init() [2/3]

void TofCorrPID::init ( )
virtual

Implements ParticleIDBase.

◆ init() [3/3]

void TofCorrPID::init ( )
virtual

Implements ParticleIDBase.

◆ inputParameter() [1/3]

void TofCorrPID::inputParameter ( int run)
protected

Definition at line 476 of file TofCorrPID.cxx.

476 {
477
478 std::string filePath = path + "/share/TofCorrPID/";
479
480 filePath = filePath + "jpsi2012";
481 m_runBegin = 0;
482 m_runEnd = 1000000;
483
484 if ( run > 0 ) { filePath = filePath + "/data/"; }
485 else { filePath = filePath + "/mc/"; }
486
487 // weight from tof calibration
488 std::string fileWeight = filePath + "calib_barrel_sigma.txt";
489 ifstream inputWeight( fileWeight.c_str(), std::ios_base::in );
490 if ( !inputWeight )
491 {
492 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileWeight << endl;
493 exit( 1 );
494 }
495
496 for ( unsigned int tofid = 0; tofid < 176; tofid++ )
497 {
498 for ( unsigned int readout = 0; readout < 3; readout++ )
499 {
500 for ( unsigned int p_i = 0; p_i < 5; p_i++ )
501 { inputWeight >> m_p_weight[tofid][readout][p_i]; }
502 }
503 }
504 // cout << "finish read " << fileWeight << endl;
505
506 // common item, from bunch size and bunch time
507 std::string fileCommon = filePath + "calib_barrel_common.txt";
508 ifstream inputCommon( fileCommon.c_str(), std::ios_base::in );
509 if ( !inputCommon )
510 {
511 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileCommon << endl;
512 exit( 1 );
513 }
514 inputCommon >> m_p_common;
515 // cout << "finish read " << fileCommon << endl;
516
517 // endcap sigma
518 std::string fileEcSigma = filePath + "calib_endcap_sigma.txt";
519 ifstream inputEcSigma( fileEcSigma.c_str(), std::ios_base::in );
520 if ( !inputEcSigma )
521 {
522 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileEcSigma << endl;
523 exit( 1 );
524 }
525
526 for ( unsigned int tofid = 0; tofid < 96; tofid++ )
527 {
528 for ( unsigned int p_i = 0; p_i < 3; p_i++ ) { inputEcSigma >> m_ec_sigma[tofid][p_i]; }
529 }
530 // cout << "finish read " << fileEcSigma << endl;
531
532 // curve of betaGamma versus Q0
533 std::string fileQ0BetaGamma = filePath + "curve_Q0_BetaGamma.txt";
534 ifstream inputQ0BetaGamma( fileQ0BetaGamma.c_str(), std::ios_base::in );
535 if ( !inputQ0BetaGamma )
536 {
537 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileQ0BetaGamma << endl;
538 exit( 1 );
539 }
540 // barrel layer1 layer2 and endcap
541 for ( unsigned int layer = 0; layer < 3; layer++ )
542 {
543 for ( unsigned int ipar = 0; ipar < 5; ipar++ )
544 { inputQ0BetaGamma >> m_q0_bg[layer][ipar]; }
545 }
546 // cout << "finish read " << fileQ0BetaGamma << endl;
547
548 // paramter of A and B
549 std::string fileParAB = filePath + "parameter_A_B.txt";
550 ifstream inputParAB( fileParAB.c_str(), std::ios_base::in );
551 if ( !inputParAB )
552 {
553 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileParAB << endl;
554 exit( 1 );
555 }
556
557 // Jpsi2012
558 // 0: pion/kaon, 1: proton/anti-proton
559 // 0: inner east, 1: inner west, 2: outer east, 3: outer west, 4: west endcap
560 // 0: plus, 1: minus
561 // 0: parameter A, 1: parameter B
562 for ( unsigned int ispecies = 0; ispecies < 2; ispecies++ )
563 {
564 for ( unsigned int ipmt = 0; ipmt < 5; ipmt++ )
565 {
566 for ( unsigned int icharge = 0; icharge < 2; icharge++ )
567 {
568 for ( unsigned int iab = 0; iab < 2; iab++ )
569 {
570 for ( unsigned int ipar = 0; ipar < 11; ipar++ )
571 { inputParAB >> m_par_ab_12[ispecies][ipmt][icharge][iab][ipar]; }
572 }
573 }
574 }
575 }
576
577 // sigma for pion, kaon and proton
578 std::string fileSigma = filePath + "parameter_sigma.txt";
579 ifstream inputSigma( fileSigma.c_str(), std::ios_base::in );
580 if ( !inputSigma )
581 {
582 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileSigma << endl;
583 exit( 1 );
584 }
585 // Jpsi2009 & Jpsi2012
586 // 0: pion, 1: kaon, 2: proton, 3: anti-proton
587 // 0: inner east, 1: inner west, 2: outer east, 3: outer west
588 // 4: inner layer, 5: outer layer, 6: double layer
589 // 7: west endcap
590 for ( unsigned int ispecies = 0; ispecies < 4; ispecies++ )
591 {
592 for ( unsigned int ipmt = 0; ipmt < 8; ipmt++ )
593 {
594 for ( unsigned int ipar = 0; ipar < 12; ipar++ )
595 { inputSigma >> m_par_sigma[ispecies][ipmt][ipar]; }
596 }
597 }
598
599 // offset for low momentum proton and anti-proton
600 std::string fileProtonOffset = filePath + "parameter_offset_proton.txt";
601 ifstream inputProtonOffset( fileProtonOffset.c_str(), std::ios_base::in );
602 if ( !inputProtonOffset )
603 {
604 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileProtonOffset << endl;
605 exit( 1 );
606 }
607
608 // Jpsi2012
609 // 0: proton, 1: anti-proton
610 // 0: inner east, 1: inner west, 2: outer east, 3: outer west
611 // 4: inner layer, 5: outer layer, 6: double layer
612 // 7: west endcap
613 for ( unsigned int ispecies = 0; ispecies < 2; ispecies++ )
614 {
615 for ( unsigned int ipmt = 0; ipmt < 8; ipmt++ )
616 {
617 for ( unsigned int ipar = 0; ipar < 20; ipar++ )
618 {
619 if ( ipmt != 7 )
620 {
621 for ( unsigned int jpar = 0; jpar < 46; jpar++ )
622 { inputProtonOffset >> m_p_offset_12[ispecies][ipmt][ipar][jpar]; }
623 }
624 else
625 {
626 for ( unsigned int jpar = 0; jpar < 7; jpar++ )
627 { inputProtonOffset >> m_p_offset_ec12[ispecies][ipar][jpar]; }
628 }
629 }
630 }
631 }
632 // cout << "finish read " << fileProtonOffset << endl;
633
634 // sigma for low momentum proton and anti-proton
635 std::string fileProtonSigma = filePath + "parameter_sigma_proton.txt";
636 ifstream inputProtonSigma( fileProtonSigma.c_str(), std::ios_base::in );
637 if ( !inputProtonSigma )
638 {
639 cout << "ParticleID::TofCorrPID: Can NOT open file: " << fileProtonSigma << endl;
640 exit( 1 );
641 }
642
643 // Jpsi2012
644 // 0: proton, 1: anti-proton
645 // 0: inner east, 1: inner west, 2: outer east, 3: outer west
646 // 4: inner layer, 5: outer layer, 6: double layer
647 // 7: west endcap
648 for ( unsigned int ispecies = 0; ispecies < 2; ispecies++ )
649 {
650 for ( unsigned int ipmt = 0; ipmt < 8; ipmt++ )
651 {
652 for ( unsigned int ipar = 0; ipar < 20; ipar++ )
653 {
654 if ( ipmt != 7 )
655 {
656 for ( unsigned int jpar = 0; jpar < 46; jpar++ )
657 { inputProtonSigma >> m_p_sigma_12[ispecies][ipmt][ipar][jpar]; }
658 }
659 else
660 {
661 for ( unsigned int jpar = 0; jpar < 7; jpar++ )
662 { inputProtonSigma >> m_p_sigma_ec12[ispecies][ipar][jpar]; }
663 }
664 }
665 }
666 }
667 // cout << "finish read " << fileProtonSigma << endl;
668
669 return;
670}

Referenced by init().

◆ inputParameter() [2/3]

void TofCorrPID::inputParameter ( int run)
protected

◆ inputParameter() [3/3]

void TofCorrPID::inputParameter ( int run)
protected

◆ instance() [1/3]

TofCorrPID * TofCorrPID::instance ( )
static

Definition at line 19 of file TofCorrPID.cxx.

19 {
20 if ( !m_pointer ) m_pointer = new TofCorrPID();
21 return m_pointer;
22}

Referenced by ParticleID::init().

◆ instance() [2/3]

TofCorrPID * TofCorrPID::instance ( )
static

◆ instance() [3/3]

TofCorrPID * TofCorrPID::instance ( )
static

◆ ipmt() [1/3]

int TofCorrPID::ipmt ( ) const
inline

◆ ipmt() [2/3]

int TofCorrPID::ipmt ( ) const
inline

Definition at line 28 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

28{ return m_ipmt; }

◆ ipmt() [3/3]

int TofCorrPID::ipmt ( ) const
inline

Definition at line 28 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

28{ return m_ipmt; }

◆ IsPidInfoValid() [1/3]

bool TofCorrPID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 21 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

21{ return ( m_ndof > 0 ); }

◆ IsPidInfoValid() [2/3]

bool TofCorrPID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 21 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

21{ return ( m_ndof > 0 ); }

◆ IsPidInfoValid() [3/3]

bool TofCorrPID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 21 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

21{ return ( m_ndof > 0 ); }

◆ LikelihoodCalculation() [1/3]

int TofCorrPID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 37 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

37{ return -1; }

◆ LikelihoodCalculation() [2/3]

int TofCorrPID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 37 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

37{ return -1; }

◆ LikelihoodCalculation() [3/3]

int TofCorrPID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 37 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

37{ return -1; }

◆ ndof() [1/3]

int TofCorrPID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 26 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

26{ return m_ndof; }

◆ ndof() [2/3]

int TofCorrPID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 26 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

26{ return m_ndof; }

◆ ndof() [3/3]

int TofCorrPID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 26 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

26{ return m_ndof; }

◆ neuronPIDCalculation() [1/3]

int TofCorrPID::neuronPIDCalculation ( )
inlineprotected

Definition at line 36 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

36{ return -1; }

◆ neuronPIDCalculation() [2/3]

int TofCorrPID::neuronPIDCalculation ( )
inlineprotected

Definition at line 36 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

36{ return -1; }

◆ neuronPIDCalculation() [3/3]

int TofCorrPID::neuronPIDCalculation ( )
inlineprotected

Definition at line 36 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

36{ return -1; }

◆ offset() [1/3]

double TofCorrPID::offset ( int n) const
inline

Definition at line 24 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

24{ return m_offset[n]; }

Referenced by particleIDCalculation().

◆ offset() [2/3]

double TofCorrPID::offset ( int n) const
inline

Definition at line 24 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

24{ return m_offset[n]; }

◆ offset() [3/3]

double TofCorrPID::offset ( int n) const
inline

Definition at line 24 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

24{ return m_offset[n]; }

◆ offsetTof() [1/9]

double TofCorrPID::offsetTof ( unsigned int ispecies,
bool barrel,
unsigned int ipmt,
double betaGamma,
int charge,
double zrhit,
double dt )
protected

Definition at line 672 of file TofCorrPID.cxx.

673 {
674 if ( ispecies == 0 || ispecies == 1 ) { return dt; }
675
676 double deltaT = -1000.0;
677 if ( ( ipmt >= 4 && barrel ) || ( ipmt != 7 && ipmt != 8 && !barrel ) || betaGamma < 0.0 ||
678 abs( charge ) != 1 || fabs( zrhit ) > 120.0 )
679 {
680 // cout << "Particle::TofCorrPID: offsetTof for single end: the input parameter are NOT
681 // correct! Please check them!" << endl;
682 return deltaT;
683 }
684 unsigned int layer = 0;
685 if ( barrel )
686 {
687 if ( ipmt == 0 || ipmt == 1 ) { layer = 0; }
688 else if ( ipmt == 2 || ipmt == 3 ) { layer = 1; }
689 }
690 else { layer = 2; }
691 double q0 = qCurveFunc( layer, betaGamma );
692
693 unsigned int inumber = ipmt;
694 if ( !barrel ) { inumber = 4; }
695
696 double func[9];
697 for ( unsigned int i = 0; i < 9; i++ ) { func[i] = 0.0; }
698
699 double parA = 0.0;
700 double parB = 0.0;
701
702 // Jpsi2012
703 func[0] = 1.0;
704 for ( unsigned int i = 1; i < 8; i++ ) { func[i] = func[i - 1] * zrhit; }
705
706 unsigned int iparticle = 0;
707 if ( ispecies == 2 || ispecies == 3 ) { iparticle = 0; }
708 else if ( ispecies == 4 ) { iparticle = 1; }
709 unsigned int icharge = 0;
710 if ( charge == 1 ) { icharge = 0; }
711 else if ( charge == -1 ) { icharge = 1; }
712
713 if ( ispecies != 4 || betaGamma * xmass( 4 ) > 0.8 )
714 {
715 for ( unsigned int i = 0; i < 8; i++ )
716 {
717 if ( i < 5 )
718 {
719 parA += m_par_ab_12[iparticle][inumber][icharge][0][i] * func[i];
720 parB += m_par_ab_12[iparticle][inumber][icharge][1][i] * func[i];
721 }
722 else if ( i >= 5 )
723 {
724 parA += m_par_ab_12[iparticle][inumber][icharge][0][i + 3] * func[i];
725 parB += m_par_ab_12[iparticle][inumber][icharge][1][i + 3] * func[i];
726 }
727 }
728 for ( unsigned int iab = 0; iab < 2; iab++ )
729 {
730 func[8] = m_par_ab_12[iparticle][inumber][icharge][iab][5] *
731 TMath::Gaus( zrhit, m_par_ab_12[iparticle][inumber][icharge][iab][6],
732 m_par_ab_12[iparticle][inumber][icharge][iab][7] );
733 if ( iab == 0 ) { parA += func[8]; }
734 else if ( iab == 1 ) { parB += func[8]; }
735 }
736 }
737
738 double tcorr = parA + parB / sqrt( q0 );
739
740 // barrel TOF low momentum proton and anti-proton
741 // Jpsi2012
742 if ( barrel && ispecies == 4 && betaGamma * xmass( 4 ) < 0.8 )
743 {
744 int nzbin = 46;
745 double zbegin = -115.0;
746 double zend = 115.0;
747 double zstep = ( zend - zbegin ) / nzbin;
748
749 double nbgbin = 20.0;
750 double bgbegin = 0.3;
751 double bgend = 0.8;
752 double bgstep;
753 bgstep = ( bgend - bgbegin ) / nbgbin;
754
755 int izbin = static_cast<int>( ( zrhit - zbegin ) / zstep );
756 if ( izbin < 0 ) { izbin = 0; }
757 else if ( izbin >= nzbin ) { izbin = nzbin - 1; }
758 int ibgbin = static_cast<int>( ( betaGamma * xmass( 4 ) - bgbegin ) / bgstep );
759 if ( ibgbin < 0 ) { ibgbin = 0; }
760 else if ( ibgbin >= nbgbin ) { ibgbin = nbgbin - 1; }
761
762 if ( charge == 1 ) { tcorr = m_p_offset_12[0][ipmt][ibgbin][izbin]; }
763 else { tcorr = m_p_offset_12[1][ipmt][ibgbin][izbin]; }
764 }
765 else if ( !barrel && ispecies == 4 && betaGamma * xmass( 4 ) < 0.8 )
766 {
767 int nrbin = 7;
768 double rbegin = 55.0;
769 double rend = 83.0;
770 double rstep = ( rend - rbegin ) / nrbin;
771
772 double nbgbin = 20.0;
773 double bgbegin = 0.3;
774 double bgend = 0.8;
775 double bgstep;
776 bgstep = ( bgend - bgbegin ) / nbgbin;
777
778 int irbin = static_cast<int>( ( zrhit - rbegin ) / rstep );
779 if ( irbin < 0 ) { irbin = 0; }
780 else if ( irbin >= nrbin ) { irbin = nrbin - 1; }
781 int ibgbin = static_cast<int>( ( betaGamma * xmass( 4 ) - bgbegin ) / bgstep );
782 if ( ibgbin < 0 ) { ibgbin = 0; }
783 else if ( ibgbin >= nbgbin ) { ibgbin = nbgbin - 1; }
784
785 if ( charge == 1 ) { tcorr = m_p_offset_ec12[0][ibgbin][irbin]; }
786 else { tcorr = m_p_offset_ec12[1][ibgbin][irbin]; }
787 }
788
789 deltaT = dt - tcorr;
790
791 return deltaT;
792}
const double xmass[5]
Definition Gam4pikp.cxx:35
const double zend
Definition TofCalibFit.h:13
const double zbegin
Definition TofCalibFit.h:12
double qCurveFunc(unsigned int layer, double betaGamma)
double dt(int ipar, int ipmt) const

Referenced by particleIDCalculation().

◆ offsetTof() [2/9]

double TofCorrPID::offsetTof ( unsigned int ispecies,
bool barrel,
unsigned int ipmt,
double betaGamma,
int charge,
double zrhit,
double dt )
protected

◆ offsetTof() [3/9]

double TofCorrPID::offsetTof ( unsigned int ispecies,
bool barrel,
unsigned int ipmt,
double betaGamma,
int charge,
double zrhit,
double dt )
protected

◆ offsetTof() [4/9]

double TofCorrPID::offsetTof ( unsigned int ispecies,
int tofid,
double zrhit,
double betaGamma,
int charge,
double dt )
protected

Definition at line 794 of file TofCorrPID.cxx.

795 {
796 if ( ispecies == 0 || ispecies == 1 ) { return dt; }
797
798 double deltaT = -1000.0;
799 if ( tofid < 0 || tofid >= 176 )
800 {
801 cout << "Particle::TofCorrPID: offsetTof for single layer: the input parameter are NOT "
802 "correct! Please check them!"
803 << endl;
804 exit( 1 );
805 }
806 int pmt[3] = { -9, -9, -9 };
807 if ( tofid >= 0 && tofid <= 87 )
808 {
809 pmt[0] = 0;
810 pmt[1] = 1;
811 pmt[2] = 4;
812 }
813 else
814 {
815 pmt[0] = 2;
816 pmt[1] = 3;
817 pmt[2] = 5;
818 }
819
820 double sigmaCorr2 = m_p_common * m_p_common;
821 double sigmaLeft = bSigma( 0, tofid, zrhit );
822 double sigmaLeft2 = sigmaLeft * sigmaLeft;
823 double sigmaRight = bSigma( 1, tofid, zrhit );
824 double sigmaRight2 = sigmaRight * sigmaRight;
825
826 double fraction =
827 ( sigmaRight2 - sigmaCorr2 ) / ( sigmaLeft2 + sigmaRight2 - 2.0 * sigmaCorr2 );
828 deltaT =
829 fraction * m_dtCorr[ispecies][pmt[0]] + ( 1.0 - fraction ) * m_dtCorr[ispecies][pmt[1]];
830
831 // Jpsi2012
832 double tcorr = 0.0;
833 unsigned int ipmt = 4;
834 if ( tofid >= 88 && tofid < 176 ) { ipmt = 5; }
835 if ( ispecies == 4 && betaGamma * xmass( 4 ) < 0.8 )
836 {
837 int nzbin = 46;
838 double zbegin = -115.0;
839 double zend = 115.0;
840 double zstep = ( zend - zbegin ) / nzbin;
841
842 double nbgbin = 20.0;
843 double bgbegin = 0.3;
844 double bgend = 0.8;
845 double bgstep;
846 bgstep = ( bgend - bgbegin ) / nbgbin;
847
848 int izbin = static_cast<int>( ( zrhit - zbegin ) / zstep );
849 if ( izbin < 0 ) { izbin = 0; }
850 else if ( izbin >= nzbin ) { izbin = nzbin - 1; }
851 int ibgbin = static_cast<int>( ( betaGamma * xmass( 4 ) - bgbegin ) / bgstep );
852 if ( ibgbin < 0 ) { ibgbin = 0; }
853 else if ( ibgbin >= nbgbin ) { ibgbin = nbgbin - 1; }
854
855 if ( charge == 1 ) { tcorr = m_p_offset_12[0][ipmt][ibgbin][izbin]; }
856 else { tcorr = m_p_offset_12[1][ipmt][ibgbin][izbin]; }
857 }
858 deltaT = deltaT - tcorr;
859
860 return deltaT;
861}

◆ offsetTof() [5/9]

double TofCorrPID::offsetTof ( unsigned int ispecies,
int tofid,
double zrhit,
double betaGamma,
int charge,
double dt )
protected

◆ offsetTof() [6/9]

double TofCorrPID::offsetTof ( unsigned int ispecies,
int tofid,
double zrhit,
double betaGamma,
int charge,
double dt )
protected

◆ offsetTof() [7/9]

double TofCorrPID::offsetTof ( unsigned int ispecies,
int tofid1,
int tofid2,
double zrhit1,
double zrhit2,
double betaGamma,
int charge,
double dt )
protected

Definition at line 863 of file TofCorrPID.cxx.

864 {
865 if ( ispecies == 0 || ispecies == 1 ) { return dt; }
866
867 double deltaT = -1000.0;
868 if ( tofid1 < 0 || tofid1 >= 88 || tofid2 < 88 || tofid2 >= 176 )
869 {
870 cout << "Particle::TofCorrPID: offsetTof for double layer: the input parameter are NOT "
871 "correct! Please check them!"
872 << endl;
873 exit( 1 );
874 }
875
876 double sigmaCorr2 = m_p_common * m_p_common;
877 double sigmaInner = bSigma( 2, tofid1, zrhit1 );
878 double sigmaInner2 = sigmaInner * sigmaInner;
879 double sigmaOuter = bSigma( 2, tofid2, zrhit2 );
880 double sigmaOuter2 = sigmaOuter * sigmaOuter;
881 double sigma = sqrt( ( sigmaInner2 * sigmaOuter2 - sigmaCorr2 * sigmaCorr2 ) /
882 ( sigmaInner2 + sigmaOuter2 - 2.0 * sigmaCorr2 ) );
883
884 m_sigma[0] = sigma;
885 m_sigma[1] = sigma;
886
887 double fraction =
888 ( sigmaOuter2 - sigmaCorr2 ) / ( sigmaInner2 + sigmaOuter2 - 2.0 * sigmaCorr2 );
889 deltaT = fraction * m_dtCorr[ispecies][4] + ( 1.0 - fraction ) * m_dtCorr[ispecies][5];
890
891 // Jpsi2012
892 double tcorr = 0.0;
893 if ( ispecies == 4 && betaGamma * xmass( 4 ) < 0.8 )
894 {
895 int nzbin = 46;
896 double zbegin = -115.0;
897 double zend = 115.0;
898 double zstep = ( zend - zbegin ) / nzbin;
899
900 double nbgbin = 20.0;
901 double bgbegin = 0.3;
902 double bgend = 0.8;
903 double bgstep;
904 bgstep = ( bgend - bgbegin ) / nbgbin;
905
906 int izbin = static_cast<int>( ( zrhit1 - zbegin ) / zstep );
907 if ( izbin < 0 ) { izbin = 0; }
908 else if ( izbin >= nzbin ) { izbin = nzbin - 1; }
909 int ibgbin = static_cast<int>( ( betaGamma * xmass( 4 ) - bgbegin ) / bgstep );
910 if ( ibgbin < 0 ) { ibgbin = 0; }
911 else if ( ibgbin >= nbgbin ) { ibgbin = nbgbin - 1; }
912
913 if ( charge == 1 ) { tcorr = m_p_offset_12[0][6][ibgbin][izbin]; }
914 else { tcorr = m_p_offset_12[1][6][ibgbin][izbin]; }
915 }
916 deltaT = deltaT - tcorr;
917
918 return deltaT;
919}

◆ offsetTof() [8/9]

double TofCorrPID::offsetTof ( unsigned int ispecies,
int tofid1,
int tofid2,
double zrhit1,
double zrhit2,
double betaGamma,
int charge,
double dt )
protected

◆ offsetTof() [9/9]

double TofCorrPID::offsetTof ( unsigned int ispecies,
int tofid1,
int tofid2,
double zrhit1,
double zrhit2,
double betaGamma,
int charge,
double dt )
protected

◆ particleIDCalculation() [1/3]

int TofCorrPID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

Definition at line 66 of file TofCorrPID.cxx.

66 {
67 int irc = -1;
68
69 EvtRecTrack* recTrk = PidTrk();
70 if ( !( recTrk->isMdcTrackValid() ) ) return irc;
71 if ( !( recTrk->isMdcKalTrackValid() ) ) return irc;
72 if ( !( recTrk->isExtTrackValid() ) ) return irc;
73 if ( !( recTrk->isTofTrackValid() ) ) return irc;
74
75#ifndef BEAN
76 SmartRefVector<RecTofTrack> tofTrk = recTrk->tofTrack();
77 SmartRefVector<RecTofTrack>::iterator it;
78#else
79 const std::vector<TTofTrack*>& tofTrk = recTrk->tofTrack();
80 std::vector<TTofTrack*>::const_iterator it;
81#endif
82
83 RecMdcTrack* mdcTrk = recTrk->mdcTrack();
84 int charge = mdcTrk->charge();
85
86 double p[5], betaGamma[5];
87 RecMdcKalTrack* kalTrk = recTrk->mdcKalTrack();
88 for ( int i = 0; i < 5; i++ )
89 {
90 if ( i == 0 ) { kalTrk->setPidType( RecMdcKalTrack::electron ); }
91 else if ( i == 1 ) { kalTrk->setPidType( RecMdcKalTrack::muon ); }
92 else if ( i == 2 ) { kalTrk->setPidType( RecMdcKalTrack::pion ); }
93 else if ( i == 3 ) { kalTrk->setPidType( RecMdcKalTrack::kaon ); }
94 else if ( i == 4 ) { kalTrk->setPidType( RecMdcKalTrack::proton ); }
95#ifndef BEAN
96 HepLorentzVector ptrk = kalTrk->p4();
97#else
98 HepLorentzVector ptrk = kalTrk->p4( xmass( i ) );
99#endif
100 p[i] = ptrk.rho();
101 betaGamma[i] = p[i] / xmass( i );
102 }
103
104 double zrhit[2];
105 RecExtTrack* extTrk = recTrk->extTrack();
106 zrhit[0] = extTrk->tof1Position().z();
107 zrhit[1] = extTrk->tof2Position().z();
108
109 int tofid[2] = { -9, -9 };
110
111 m_ipmt = -1;
112 bool readFile = false;
113 bool signal[2] = { false, false };
114 TofHitStatus* hitst = new TofHitStatus;
115 for ( it = tofTrk.begin(); it != tofTrk.end(); it++ )
116 {
117 unsigned int st = ( *it )->status();
118 hitst->setStatus( st );
119 if ( hitst->is_raw() ) return irc; // TOF no hit
120 bool barrel = hitst->is_barrel();
121 bool ismrpc = hitst->is_mrpc();
122 if ( !barrel && !ismrpc ) { zrhit[0] = extTrk->tof1Position().rho(); }
123 bool readout = hitst->is_readout();
124 bool counter = hitst->is_counter();
125 bool cluster = hitst->is_cluster();
126 int layer = hitst->layer();
127 tofid[layer - 1] = ( *it )->tofID();
128 bool east = hitst->is_east();
129 double tof = ( *it )->tof();
130 unsigned int ipmt = 0;
131 if ( readout )
132 {
133 // barrel: 0:inner east, 1:inner west, 2:outer east, 3: outer west
134 // endcap: 7:east endcap, 8:west endcap
135 if ( barrel ) { ipmt = ( ( st & 0xC0 ) >> 5 ) + ( ( ( st ^ 0x20 ) & 0x20 ) >> 5 ) - 2; }
136 else
137 {
138 if ( !ismrpc )
139 {
140 if ( tofid[0] <= 47 ) { ipmt = 7; }
141 else { ipmt = 8; }
142 }
143 else
144 {
145 if ( tofid[0] <= 35 ) { ipmt = 7; }
146 else { ipmt = 8; }
147 }
148 }
149
150 for ( unsigned int i = 0; i < 5; i++ )
151 {
152 double offset = ( *it )->toffset( i );
153 double texp = ( *it )->texp( i );
154 if ( texp < 0.0 ) continue;
155 double dt = tof - offset - texp;
156 if ( barrel )
157 {
158 m_dt[i][ipmt] = dt;
159 m_dtCorr[i][ipmt] =
160 offsetTof( i, barrel, ipmt, betaGamma[i], charge, zrhit[layer - 1], dt );
161 m_sigCorr[i][ipmt] =
162 sigmaTof( i, charge, barrel, ipmt, &tofid[0], &zrhit[0], betaGamma[i] );
163 m_chiCorr[i][ipmt] = m_dtCorr[i][ipmt] / m_sigCorr[i][ipmt];
164 }
165 else
166 {
167 if ( !ismrpc )
168 {
169 m_dt[i][0] = dt;
170 m_dtCorr[i][0] =
171 offsetTof( i, barrel, ipmt, betaGamma[i], charge, zrhit[layer - 1], dt );
172 m_sigCorr[i][0] =
173 sigmaTof( i, charge, barrel, ipmt, &tofid[0], &zrhit[0], betaGamma[i] );
174 m_chiCorr[i][0] = m_dtCorr[i][ipmt] / m_sigCorr[i][ipmt];
175 }
176 else
177 {
178 m_dt[i][0] = dt;
179 m_dtCorr[i][0] = dt;
180 // m_sigCorr[i][0] = 0.065;
181 int strip = ( *it )->strip();
182 double p0, p1;
183 if ( strip < 0 || strip > 11 ) { m_sigCorr[i][0] = 0.065; }
184 else
185 {
186 if ( strip == 0 )
187 {
188 p0 = 0.16;
189 p1 = 0.0;
190 }
191 else if ( strip == 1 )
192 {
193 p0 = 0.051094;
194 p1 = 0.019467;
195 }
196 else if ( strip == 2 )
197 {
198 p0 = 0.056019;
199 p1 = 0.012964;
200 }
201 else if ( strip == 3 )
202 {
203 p0 = 0.043901;
204 p1 = 0.015933;
205 }
206 else if ( strip == 4 )
207 {
208 p0 = 0.049750;
209 p1 = 0.010473;
210 }
211 else if ( strip == 5 )
212 {
213 p0 = 0.048345;
214 p1 = 0.008545;
215 }
216 else if ( strip == 6 )
217 {
218 p0 = 0.046518;
219 p1 = 0.009038;
220 }
221 else if ( strip == 7 )
222 {
223 p0 = 0.048803;
224 p1 = 0.007251;
225 }
226 else if ( strip == 8 )
227 {
228 p0 = 0.047523;
229 p1 = 0.008434;
230 }
231 else if ( strip == 9 )
232 {
233 p0 = 0.042187;
234 p1 = 0.010307;
235 }
236 else if ( strip == 10 )
237 {
238 p0 = 0.050337;
239 p1 = 0.005951;
240 }
241 else if ( strip == 11 )
242 {
243 p0 = 0.054740;
244 p1 = 0.005629;
245 }
246 if ( p[i] < 0.05 ) { m_sigCorr[i][0] = p0 + p1 / 0.05; }
247 else { m_sigCorr[i][0] = p0 + p1 / p[i]; }
248 }
249 if ( i == 4 ) { m_sigCorr[i][0] = 1.5 * m_sigCorr[i][0]; }
250 m_chiCorr[i][0] = m_dtCorr[i][0] / m_sigCorr[i][0];
251 }
252 }
253 }
254 if ( counter && cluster )
255 {
256 m_ipmt = ipmt;
257 for ( unsigned int i = 0; i < 5; i++ )
258 {
259 if ( ( ( *it )->texp( i ) ) > 0.0 )
260 {
261 if ( barrel )
262 {
263 m_offset[i] = m_dtCorr[i][ipmt];
264 m_sigma[i] = m_sigCorr[i][ipmt];
265 }
266 else
267 {
268 m_offset[i] = m_dtCorr[i][0];
269 m_sigma[i] = m_sigCorr[i][0];
270 }
271 }
272 }
273 }
274 }
275 else
276 {
277 if ( counter )
278 {
279 ipmt = layer + 3;
280 for ( unsigned int i = 0; i < 5; i++ )
281 {
282 double offset = ( *it )->toffset( i );
283 double texp = ( *it )->texp( i );
284 if ( texp < 0.0 ) continue;
285 double dt = tof - offset - texp;
286 if ( barrel )
287 {
288 m_dt[i][ipmt] = dt;
289 m_dtCorr[i][ipmt] =
290 offsetTof( i, tofid[layer - 1], zrhit[layer - 1], betaGamma[i], charge, dt );
291 m_sigCorr[i][ipmt] =
292 sigmaTof( i, charge, barrel, layer + 3, &tofid[0], &zrhit[0], betaGamma[i] );
293 m_chiCorr[i][ipmt] = m_dtCorr[i][ipmt] / m_sigCorr[i][ipmt];
294 }
295 else
296 {
297 if ( ismrpc )
298 {
299 m_dt[i][0] = dt;
300 m_dtCorr[i][0] = dt;
301 // m_sigCorr[i][0] = 0.065;
302 int strip = ( *it )->strip();
303 double p0, p1;
304 if ( strip < 0 || strip > 11 ) { m_sigCorr[i][0] = 0.065; }
305 else
306 {
307 if ( strip == 0 )
308 {
309 p0 = 0.16;
310 p1 = 0.0;
311 }
312 else if ( strip == 1 )
313 {
314 p0 = 0.051094;
315 p1 = 0.019467;
316 }
317 else if ( strip == 2 )
318 {
319 p0 = 0.056019;
320 p1 = 0.012964;
321 }
322 else if ( strip == 3 )
323 {
324 p0 = 0.043901;
325 p1 = 0.015933;
326 }
327 else if ( strip == 4 )
328 {
329 p0 = 0.049750;
330 p1 = 0.010473;
331 }
332 else if ( strip == 5 )
333 {
334 p0 = 0.048345;
335 p1 = 0.008545;
336 }
337 else if ( strip == 6 )
338 {
339 p0 = 0.046518;
340 p1 = 0.009038;
341 }
342 else if ( strip == 7 )
343 {
344 p0 = 0.048803;
345 p1 = 0.007251;
346 }
347 else if ( strip == 8 )
348 {
349 p0 = 0.047523;
350 p1 = 0.008434;
351 }
352 else if ( strip == 9 )
353 {
354 p0 = 0.042187;
355 p1 = 0.010307;
356 }
357 else if ( strip == 10 )
358 {
359 p0 = 0.050337;
360 p1 = 0.005951;
361 }
362 else if ( strip == 11 )
363 {
364 p0 = 0.054740;
365 p1 = 0.005629;
366 }
367 if ( p[i] < 0.05 ) { m_sigCorr[i][0] = p0 + p1 / 0.05; }
368 else { m_sigCorr[i][0] = p0 + p1 / p[i]; }
369 }
370 if ( i == 4 ) { m_sigCorr[i][0] = 1.5 * m_sigCorr[i][0]; }
371 m_chiCorr[i][0] = m_dtCorr[i][0] / m_sigCorr[i][0];
372 }
373 else
374 {
375 cout << "ParticleID: TofCorr::particleIDCalculation: Endcap Scintillator TOF "
376 "have more than one end!!!"
377 << endl;
378 }
379 }
380 }
381 if ( cluster )
382 {
383 m_ipmt = ipmt;
384 for ( unsigned int i = 0; i < 5; i++ )
385 {
386 if ( ( ( *it )->texp( i ) ) > 0.0 )
387 {
388 if ( barrel )
389 {
390 m_offset[i] = m_dtCorr[i][ipmt];
391 m_sigma[i] = m_sigCorr[i][ipmt];
392 }
393 else
394 {
395 m_offset[i] = m_dtCorr[i][0];
396 m_sigma[i] = m_sigCorr[i][0];
397 }
398 }
399 }
400 }
401 else { signal[layer - 1] = correlationCheck( ipmt ); }
402 }
403 else
404 {
405 if ( cluster )
406 {
407 ipmt = 6;
408 for ( unsigned int i = 0; i < 5; i++ )
409 {
410 double offset = ( *it )->toffset( i );
411 double texp = ( *it )->texp( i );
412 if ( texp < 0.0 ) continue;
413 double dt = tof - offset - texp;
414 m_dt[i][ipmt] = dt;
415 m_dtCorr[i][ipmt] = offsetTof( i, tofid[0], tofid[1], zrhit[0], zrhit[1],
416 betaGamma[i], charge, dt );
417 m_sigCorr[i][ipmt] =
418 sigmaTof( i, charge, barrel, ipmt, &tofid[0], &zrhit[0], betaGamma[i] );
419 m_chiCorr[i][ipmt] = m_dtCorr[i][ipmt] / m_sigCorr[i][ipmt];
420 }
421 if ( signal[0] && signal[1] )
422 {
423 m_ipmt = 6;
424 for ( unsigned int i = 0; i < 5; i++ )
425 {
426 m_offset[i] = m_dtCorr[i][ipmt];
427 m_sigma[i] = m_sigCorr[i][ipmt];
428 }
429 }
430 else if ( signal[0] && !signal[1] )
431 {
432 m_ipmt = 4;
433 for ( unsigned int i = 0; i < 5; i++ )
434 {
435 m_offset[i] = m_dtCorr[i][4];
436 m_sigma[i] = m_sigCorr[i][4];
437 }
438 }
439 else if ( !signal[0] && signal[1] )
440 {
441 m_ipmt = 5;
442 for ( unsigned int i = 0; i < 5; i++ )
443 {
444 m_offset[i] = m_dtCorr[i][5];
445 m_sigma[i] = m_sigCorr[i][5];
446 }
447 }
448 else return irc;
449 }
450 }
451 }
452 }
453 delete hitst;
454
455 double pdftemp = 0;
456 for ( unsigned int i = 0; i < 5; i++ )
457 {
458 m_chi[i] = m_offset[i] / m_sigma[i];
459 if ( m_chi[i] < 0. && m_chi[i] > m_chimin ) { m_chimin = m_chi[i]; }
460 if ( m_chi[i] > 0. && m_chi[i] < m_chimax ) { m_chimax = m_chi[i]; }
461 double ppp = pdfCalculate( m_chi[i], 1 );
462 if ( fabs( ppp ) > pdftemp ) { pdftemp = fabs( ppp ); }
463 }
464
465 m_pdfmin = pdftemp;
466 if ( pdftemp < pdfCalculate( pdfMinSigmaCut(), 1 ) ) return irc;
467 if ( ( m_chimin > -90.0 && ( 0 - m_chimin ) > chiMinCut() ) &&
468 ( m_chimax < 90.0 && m_chimax > chiMaxCut() ) )
469 return irc;
470 for ( int i = 0; i < 5; i++ ) { m_prob[i] = probCalculate( m_chi[i] * m_chi[i], 1 ); }
471
472 irc = 0;
473 return irc;
474}
double p1[4]
const HepLorentzVector p4() const
SmartRefVector< RecTofTrack > tofTrack()
double probCalculate(double chi2, int n)
double sigmaTof(unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, int tofid[2], double zrhit[2], double betaGamma)
double offsetTof(unsigned int ispecies, bool barrel, unsigned int ipmt, double betaGamma, int charge, double zrhit, double dt)
bool correlationCheck(unsigned int ipmt)
void setStatus(unsigned int status)

Referenced by calculate().

◆ particleIDCalculation() [2/3]

int TofCorrPID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

◆ particleIDCalculation() [3/3]

int TofCorrPID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

◆ prob() [1/3]

double TofCorrPID::prob ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 23 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

23{ return m_prob[n]; }

◆ prob() [2/3]

double TofCorrPID::prob ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 23 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

23{ return m_prob[n]; }

◆ prob() [3/3]

double TofCorrPID::prob ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 23 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

23{ return m_prob[n]; }

◆ qCurveFunc() [1/3]

double TofCorrPID::qCurveFunc ( unsigned int layer,
double betaGamma )
protected

Definition at line 1070 of file TofCorrPID.cxx.

1070 {
1071 double q0 = -100.0;
1072 if ( layer >= 3 || betaGamma < 0.0 )
1073 {
1074 cout << "Particle::TofCorrPID::qCurveFunc: the input parameter are NOT correct! Please "
1075 "check them!"
1076 << endl;
1077 return q0;
1078 }
1079
1080 double beta = betaGamma / sqrt( 1.0 + betaGamma * betaGamma );
1081 double logterm = log( m_q0_bg[layer][2] + pow( ( 1.0 / betaGamma ), m_q0_bg[layer][4] ) );
1082 q0 = m_q0_bg[layer][0] * ( m_q0_bg[layer][1] - pow( beta, m_q0_bg[layer][3] ) - logterm ) /
1083 pow( beta, m_q0_bg[layer][3] );
1084
1085 return q0;
1086}

Referenced by offsetTof().

◆ qCurveFunc() [2/3]

double TofCorrPID::qCurveFunc ( unsigned int layer,
double betaGamma )
protected

◆ qCurveFunc() [3/3]

double TofCorrPID::qCurveFunc ( unsigned int layer,
double betaGamma )
protected

◆ sigCorr() [1/3]

double TofCorrPID::sigCorr ( int ipar,
int ipmt ) const
inline

Definition at line 31 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

31{ return m_sigCorr[ipar][ipmt]; }

◆ sigCorr() [2/3]

double TofCorrPID::sigCorr ( int ipar,
int ipmt ) const
inline

Definition at line 31 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

31{ return m_sigCorr[ipar][ipmt]; }

◆ sigCorr() [3/3]

double TofCorrPID::sigCorr ( int ipar,
int ipmt ) const
inline

Definition at line 31 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

31{ return m_sigCorr[ipar][ipmt]; }

◆ sigma() [1/3]

double TofCorrPID::sigma ( int n) const
inline

Definition at line 25 of file Analysis/ParticleID/include/ParticleID/TofCorrPID.h.

25{ return m_sigma[n]; }

Referenced by bSigma(), bSigma(), eSigma(), offsetTof(), sigmaTof(), and sigmaTof().

◆ sigma() [2/3]

double TofCorrPID::sigma ( int n) const
inline

Definition at line 25 of file InstallArea/x86_64-el9-gcc13-dbg/include/ParticleID/TofCorrPID.h.

25{ return m_sigma[n]; }

◆ sigma() [3/3]

double TofCorrPID::sigma ( int n) const
inline

Definition at line 25 of file InstallArea/x86_64-el9-gcc13-opt/include/ParticleID/TofCorrPID.h.

25{ return m_sigma[n]; }

◆ sigmaTof() [1/6]

double TofCorrPID::sigmaTof ( unsigned int ispecies,
int charge,
bool barrel,
unsigned int ipmt,
double zrhit,
double betaGamma )
protected

Definition at line 951 of file TofCorrPID.cxx.

952 {
953
954 int ibgbin = -1;
955 int izbin = 0;
956 // Jpsi2012
957 if ( ispecies == 4 && ( betaGamma * xmass( 4 ) ) < 0.8 )
958 {
959 double nbgbin = 20.0;
960 double bgbegin = 0.3;
961 double bgend = 0.8;
962 double bgstep;
963 bgstep = ( bgend - bgbegin ) / nbgbin;
964 ibgbin = static_cast<int>( ( betaGamma * xmass( 4 ) - bgbegin ) / bgstep );
965
966 if ( ibgbin < 0 ) { ibgbin = 0; }
967 else if ( ibgbin >= nbgbin ) { ibgbin = nbgbin - 1; }
968
969 if ( barrel )
970 {
971 int nzbin = 46;
972 double zbegin = -115.0;
973 double zend = 115.0;
974 double zstep = ( zend - zbegin ) / nzbin;
975
976 izbin = static_cast<int>( ( zrhit - zbegin ) / zstep );
977 if ( izbin < 0 ) { izbin = 0; }
978 else if ( izbin >= nzbin ) { izbin = nzbin - 1; }
979 }
980 else
981 {
982 int nzbin = 7;
983 double zbegin = 55.0;
984 double zend = 83.0;
985 double zstep = ( zend - zbegin ) / nzbin;
986
987 izbin = static_cast<int>( ( zrhit - zbegin ) / zstep );
988 if ( izbin < 0 ) { izbin = 0; }
989 else if ( izbin >= nzbin ) { izbin = nzbin - 1; }
990 }
991 }
992
993 unsigned int numParam = 4;
994 double func[12];
995 for ( unsigned int i = 0; i < 4; i++ )
996 {
997 if ( i == 0 ) { func[i] = 1.0; }
998 else { func[i] = func[i - 1] * zrhit; }
999 }
1000 for ( unsigned int i = 4; i < 12; i++ ) { func[i] = 0.0; }
1001
1002 // Jpsi2012
1003 if ( barrel )
1004 { // barrel
1005 if ( ispecies == 2 || ispecies == 3 )
1006 { // pion / kaon
1007 for ( unsigned int i = 4; i < 10; i++ ) { func[i] = func[i - 1] * zrhit; }
1008 func[10] = 1.0 / ( 115.0 - zrhit ) / ( 115.0 - zrhit );
1009 func[11] = 1.0 / ( 115.0 + zrhit ) / ( 115.0 + zrhit );
1010 numParam = 12;
1011 }
1012 else if ( ispecies == 4 )
1013 { // proton / anti-proton
1014 for ( unsigned int i = 4; i < 12; i++ ) { func[i] = func[i - 1] * zrhit; }
1015 numParam = 12;
1016 }
1017 }
1018 else
1019 { // endcap
1020 numParam = 4;
1021 }
1022
1023 unsigned int inumber = ipmt;
1024 if ( !barrel ) { inumber = 7; }
1025
1026 double sigma = 0.0;
1027 if ( ispecies == 2 || ispecies == 3 )
1028 { // pion / kaon
1029 for ( unsigned int i = 0; i < numParam; i++ )
1030 { sigma += m_par_sigma[ispecies - 2][inumber][i] * func[i]; }
1031 }
1032 else if ( ispecies == 4 )
1033 {
1034 if ( ibgbin != -1 )
1035 {
1036 // Jpsi2012
1037 if ( barrel )
1038 {
1039 if ( charge == 1 ) { sigma = m_p_sigma_12[0][inumber][ibgbin][izbin]; }
1040 else { sigma = m_p_sigma_12[1][inumber][ibgbin][izbin]; }
1041 }
1042 else
1043 {
1044 if ( charge == 1 ) { sigma = m_p_sigma_ec12[0][ibgbin][izbin]; }
1045 else { sigma = m_p_sigma_ec12[1][ibgbin][izbin]; }
1046 }
1047 if ( fabs( sigma + 999.0 ) < 1.0e-6 ) { sigma = 0.3; }
1048 }
1049 else
1050 {
1051 for ( unsigned int i = 0; i < numParam; i++ )
1052 {
1053 if ( charge == 1 ) { sigma += m_par_sigma[2][inumber][i] * func[i]; }
1054 else { sigma += m_par_sigma[3][inumber][i] * func[i]; }
1055 }
1056 }
1057 }
1058
1059 // Jpsi2012
1060 int run = getRunNo();
1061 if ( run > 0 )
1062 {
1063 if ( ispecies == 2 )
1064 { sigma = sigma * ( TMath::Exp( ( betaGamma - 0.356345 ) / ( -0.767124 ) ) + 0.994072 ); }
1065 }
1066
1067 return sigma;
1068}

◆ sigmaTof() [2/6]

double TofCorrPID::sigmaTof ( unsigned int ispecies,
int charge,
bool barrel,
unsigned int ipmt,
double zrhit,
double betaGamma )
protected

◆ sigmaTof() [3/6]

double TofCorrPID::sigmaTof ( unsigned int ispecies,
int charge,
bool barrel,
unsigned int ipmt,
double zrhit,
double betaGamma )
protected

◆ sigmaTof() [4/6]

double TofCorrPID::sigmaTof ( unsigned int ispecies,
int charge,
bool barrel,
unsigned int ipmt,
int tofid[2],
double zrhit[2],
double betaGamma )
protected

Definition at line 921 of file TofCorrPID.cxx.

922 {
923
924 double sigma = 1.0e-6;
925
926 if ( ispecies == 0 || ispecies == 1 )
927 {
928 if ( barrel )
929 {
930 if ( ipmt == 0 ) { sigma = bSigma( 0, tofid[0], zrhit[0] ); }
931 else if ( ipmt == 1 ) { sigma = bSigma( 1, tofid[0], zrhit[0] ); }
932 else if ( ipmt == 2 ) { sigma = bSigma( 0, tofid[1], zrhit[1] ); }
933 else if ( ipmt == 3 ) { sigma = bSigma( 1, tofid[1], zrhit[1] ); }
934 else if ( ipmt == 4 ) { sigma = bSigma( 2, tofid[0], zrhit[0] ); }
935 else if ( ipmt == 5 ) { sigma = bSigma( 2, tofid[1], zrhit[1] ); }
936 else if ( ipmt == 6 ) { sigma = bSigma( &tofid[0], &zrhit[0] ); }
937 }
938 else { sigma = eSigma( tofid[0], zrhit[0] ); }
939 }
940 else
941 {
942 unsigned int iz = 0;
943 if ( ipmt == 2 || ipmt == 3 || ipmt == 5 ) { iz = 1; }
944
945 sigma = sigmaTof( ispecies, charge, barrel, ipmt, zrhit[iz], betaGamma );
946 }
947
948 return sigma;
949}
double eSigma(int tofid, double zrhit)

Referenced by particleIDCalculation(), and sigmaTof().

◆ sigmaTof() [5/6]

double TofCorrPID::sigmaTof ( unsigned int ispecies,
int charge,
bool barrel,
unsigned int ipmt,
int tofid[2],
double zrhit[2],
double betaGamma )
protected

◆ sigmaTof() [6/6]

double TofCorrPID::sigmaTof ( unsigned int ispecies,
int charge,
bool barrel,
unsigned int ipmt,
int tofid[2],
double zrhit[2],
double betaGamma )
protected

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