4#include "ParticleID/TofCorrPID.h"
7#include "EvtRecEvent/EvtRecTrack.h"
8#include "MdcRecEvent/RecMdcTrack.h"
9#include "MdcRecEvent/RecMdcKalTrack.h"
10#include "ExtEvent/RecExtTrack.h"
11#include "TofRecEvent/RecTofTrack.h"
12#include "DstEvent/TofHitStatus.h"
14#include "TofHitStatus.h"
32 for(
int i = 0; i < 5; i++) {
36 m_offset[i] = -1000.0;
44 for(
unsigned int i=0; i<5; i++ ) {
45 for(
unsigned int j=0; j<7; j++ ) {
47 m_dtCorr[i][j] = -1000.0;
48 m_sigCorr[i][j] = 10.0;
49 m_chiCorr[i][j] = 100.0;
54 if( !(
abs(run)>=m_runBegin &&
abs(run)<=m_runEnd ) ) {
77 SmartRefVector<RecTofTrack> tofTrk = recTrk->
tofTrack();
78 SmartRefVector<RecTofTrack>::iterator it;
80 const std::vector<TTofTrack* >& tofTrk = recTrk->
tofTrack();
81 std::vector<TTofTrack* >::const_iterator it;
87 double p[5], betaGamma[5];
89 for(
int i=0; i<5; i++ ) {
106 HepLorentzVector ptrk = kalTrk->
p4();
108 HepLorentzVector ptrk = kalTrk->
p4(
xmass(i) );
111 betaGamma[i] =
p[i]/
xmass(i);
119 int tofid[2] = { -9, -9 };
122 bool readFile =
false;
123 bool signal[2] = {
false,
false };
125 for( it = tofTrk.begin(); it!=tofTrk.end(); it++ ) {
126 unsigned int st = (*it)->status();
128 if( hitst->
is_raw() )
return irc;
130 bool ismrpc = hitst->
is_mrpc();
131 if( !barrel && !ismrpc ) { zrhit[0] = extTrk->
tof1Position().rho(); }
135 int layer = hitst->
layer();
136 tofid[layer-1] = (*it)->tofID();
138 double tof = (*it)->tof();
139 unsigned int ipmt = 0;
143 if( barrel ) {
ipmt = ( ( st & 0xC0 ) >> 5 ) + ( ( ( st ^ 0x20 ) & 0x20 ) >> 5 ) - 2; }
146 if( tofid[0]<=47 ) {
ipmt = 7; }
150 if( tofid[0]<=35 ) {
ipmt = 7; }
155 for(
unsigned int i=0; i<5; i++ ) {
156 double offset = (*it)->toffset(i);
157 double texp = (*it)->texp(i);
158 if( texp<0.0 )
continue;
164 m_chiCorr[i][
ipmt] = m_dtCorr[i][
ipmt]/m_sigCorr[i][
ipmt];
170 m_sigCorr[i][0] =
sigmaTof( i,
charge, barrel,
ipmt, &tofid[0], &zrhit[0], betaGamma[i] );
171 m_chiCorr[i][0] = m_dtCorr[i][
ipmt]/m_sigCorr[i][
ipmt];
177 int strip = (*it)->strip();
179 if( strip<0 || strip>11 ) { m_sigma[i] = 0.065; }
181 if( strip==0 ) { p0=0.16; p1=0.0; }
182 else if( strip==1 ) { p0=0.051094; p1=0.019467; }
183 else if( strip==2 ) { p0=0.056019; p1=0.012964; }
184 else if( strip==3 ) { p0=0.043901; p1=0.015933; }
185 else if( strip==4 ) { p0=0.049750; p1=0.010473; }
186 else if( strip==5 ) { p0=0.048345; p1=0.008545; }
187 else if( strip==6 ) { p0=0.046518; p1=0.009038; }
188 else if( strip==7 ) { p0=0.048803; p1=0.007251; }
189 else if( strip==8 ) { p0=0.047523; p1=0.008434; }
190 else if( strip==9 ) { p0=0.042187; p1=0.010307; }
191 else if( strip==10 ) { p0=0.050337; p1=0.005951; }
192 else if( strip==11 ) { p0=0.054740; p1=0.005629; }
193 if(
p[i]<0.05 ) { m_sigma[i] = p0+p1/0.05; }
194 else { m_sigma[i] = p0+p1/
p[i]; }
196 m_chiCorr[i][0] = m_dtCorr[i][0]/m_sigCorr[i][0];
200 if( counter && cluster ) {
202 for(
unsigned int i=0; i<5; i++ ) {
203 if( ((*it)->texp(i))>0.0 ) {
205 m_offset[i] = m_dtCorr[i][
ipmt];
206 m_sigma[i] = m_sigCorr[i][
ipmt];
209 m_offset[i] = m_dtCorr[i][0];
210 m_sigma[i] = m_sigCorr[i][0];
219 for(
unsigned int i=0; i<5; i++ ) {
220 double offset = (*it)->toffset(i);
221 double texp = (*it)->texp(i);
222 if( texp<0.0 )
continue;
227 m_sigCorr[i][
ipmt] =
sigmaTof( i,
charge, barrel, layer+3, &tofid[0], &zrhit[0], betaGamma[i] );
228 m_chiCorr[i][
ipmt] = m_dtCorr[i][
ipmt]/m_sigCorr[i][
ipmt];
235 int strip = (*it)->strip();
237 if( strip<0 || strip>11 ) { m_sigma[i] = 0.065; }
239 if( strip==0 ) { p0=0.16; p1=0.0; }
240 else if( strip==1 ) { p0=0.051094; p1=0.019467; }
241 else if( strip==2 ) { p0=0.056019; p1=0.012964; }
242 else if( strip==3 ) { p0=0.043901; p1=0.015933; }
243 else if( strip==4 ) { p0=0.049750; p1=0.010473; }
244 else if( strip==5 ) { p0=0.048345; p1=0.008545; }
245 else if( strip==6 ) { p0=0.046518; p1=0.009038; }
246 else if( strip==7 ) { p0=0.048803; p1=0.007251; }
247 else if( strip==8 ) { p0=0.047523; p1=0.008434; }
248 else if( strip==9 ) { p0=0.042187; p1=0.010307; }
249 else if( strip==10 ) { p0=0.050337; p1=0.005951; }
250 else if( strip==11 ) { p0=0.054740; p1=0.005629; }
251 if(
p[i]<0.05 ) { m_sigma[i] = p0+p1/0.05; }
252 else { m_sigma[i] = p0+p1/
p[i]; }
254 m_chiCorr[i][0] = m_dtCorr[i][0]/m_sigCorr[i][0];
257 cout <<
"ParticleID: TofCorr::particleIDCalculation: Endcap Scintillator TOF have more than one end!!!" << endl;
263 for(
unsigned int i=0; i<5; i++ ) {
264 if( ((*it)->texp(i))>0.0 ) {
266 m_offset[i] = m_dtCorr[i][
ipmt];
267 m_sigma[i] = m_sigCorr[i][
ipmt];
270 m_offset[i] = m_dtCorr[i][0];
271 m_sigma[i] = m_sigCorr[i][0];
283 for(
unsigned int i=0; i<5; i++ ) {
284 double offset = (*it)->toffset(i);
285 double texp = (*it)->texp(i);
286 if( texp<0.0 )
continue;
289 m_dtCorr[i][
ipmt] =
offsetTof( i, tofid[0], tofid[1], zrhit[0], zrhit[1], betaGamma[i],
charge,
dt );
291 m_chiCorr[i][
ipmt] = m_dtCorr[i][
ipmt]/m_sigCorr[i][
ipmt];
293 if( signal[0] && signal[1] ) {
295 for(
unsigned int i=0; i<5; i++ ) {
296 m_offset[i] = m_dtCorr[i][
ipmt];
297 m_sigma[i] = m_sigCorr[i][
ipmt];
300 else if( signal[0] && !signal[1] ) {
302 for(
unsigned int i=0; i<5; i++ ) {
303 m_offset[i] = m_dtCorr[i][4];
304 m_sigma[i] = m_sigCorr[i][4];
307 else if( !signal[0] && signal[1] ) {
309 for(
unsigned int i=0; i<5; i++ ) {
310 m_offset[i] = m_dtCorr[i][5];
311 m_sigma[i] = m_sigCorr[i][5];
322 for(
unsigned int i=0; i<5; i++ ) {
323 m_chi[i] = m_offset[i]/m_sigma[i];
324 if( m_chi[i]<0. && m_chi[i]>m_chimin ) { m_chimin = m_chi[i]; }
325 if( m_chi[i]>0. && m_chi[i]<m_chimax ) { m_chimax = m_chi[i]; }
327 if( fabs(ppp) > pdftemp) { pdftemp = fabs(ppp); }
332 if( ( m_chimin > -90.0 && (0-m_chimin)>
chiMinCut() ) && ( m_chimax < 90.0 && m_chimax>
chiMaxCut() ) )
return irc;
333 for(
int i = 0; i < 5; i++) {
344 std::string filePath =
path +
"/share/TofCorrPID/";
346 filePath = filePath +
"jpsi2012";
351 filePath = filePath +
"/data/";
354 filePath = filePath +
"/mc/";
359 std::string fileWeight = filePath +
"calib_barrel_sigma.txt";
360 ifstream inputWeight( fileWeight.c_str(), std::ios_base::in );
362 cout <<
"ParticleID::TofCorrPID: Can NOT open file: " << fileWeight << endl;
366 for(
unsigned int tofid=0; tofid<176; tofid++ ) {
367 for(
unsigned int readout=0; readout<3; readout++ ) {
368 for(
unsigned int p_i=0; p_i<5; p_i++ ) {
369 inputWeight >> m_p_weight[tofid][readout][p_i];
376 std::string fileCommon = filePath +
"calib_barrel_common.txt";
377 ifstream inputCommon( fileCommon.c_str(), std::ios_base::in );
379 cout <<
"ParticleID::TofCorrPID: Can NOT open file: " << fileCommon << endl;
382 inputCommon >> m_p_common;
386 std::string fileEcSigma = filePath +
"calib_endcap_sigma.txt";
387 ifstream inputEcSigma( fileEcSigma.c_str(), std::ios_base::in );
388 if( !inputEcSigma ) {
389 cout <<
"ParticleID::TofCorrPID: Can NOT open file: " << fileEcSigma << endl;
393 for(
unsigned int tofid=0; tofid<96; tofid++ ) {
394 for(
unsigned int p_i=0; p_i<3; p_i++ ) {
395 inputEcSigma >> m_ec_sigma[tofid][p_i];
401 std::string fileQ0BetaGamma = filePath +
"curve_Q0_BetaGamma.txt";
402 ifstream inputQ0BetaGamma( fileQ0BetaGamma.c_str(), std::ios_base::in );
403 if( !inputQ0BetaGamma ) {
404 cout <<
"ParticleID::TofCorrPID: Can NOT open file: " << fileQ0BetaGamma << endl;
408 for(
unsigned int layer=0; layer<3; layer++ ) {
409 for(
unsigned int ipar=0; ipar<5; ipar++ ) {
410 inputQ0BetaGamma >> m_q0_bg[layer][ipar];
416 std::string fileParAB = filePath +
"parameter_A_B.txt";
417 ifstream inputParAB( fileParAB.c_str(), std::ios_base::in );
419 cout <<
"ParticleID::TofCorrPID: Can NOT open file: " << fileParAB << endl;
428 for(
unsigned int ispecies=0; ispecies<2; ispecies++ ) {
430 for(
unsigned int icharge=0; icharge<2; icharge++ ) {
431 for(
unsigned int iab=0; iab<2; iab++ ) {
432 for(
unsigned int ipar=0; ipar<11; ipar++ ) {
433 inputParAB >> m_par_ab_12[ispecies][
ipmt][icharge][iab][ipar];
441 std::string fileSigma = filePath +
"parameter_sigma.txt";
442 ifstream inputSigma( fileSigma.c_str(), std::ios_base::in );
444 cout <<
"ParticleID::TofCorrPID: Can NOT open file: " << fileSigma << endl;
452 for(
unsigned int ispecies=0; ispecies<4; ispecies++ ) {
454 for(
unsigned int ipar=0; ipar<12; ipar++ ) {
455 inputSigma >> m_par_sigma[ispecies][
ipmt][ipar];
461 std::string fileProtonOffset = filePath +
"parameter_offset_proton.txt";
462 ifstream inputProtonOffset( fileProtonOffset.c_str(), std::ios_base::in );
463 if( !inputProtonOffset ) {
464 cout <<
"ParticleID::TofCorrPID: Can NOT open file: " << fileProtonOffset << endl;
473 for(
unsigned int ispecies=0; ispecies<2; ispecies++ ) {
475 for(
unsigned int ipar=0; ipar<20; ipar++ ) {
477 for(
unsigned int jpar=0; jpar<46; jpar++ ) {
478 inputProtonOffset >> m_p_offset_12[ispecies][
ipmt][ipar][jpar];
482 for(
unsigned int jpar=0; jpar<7; jpar++ ) {
483 inputProtonOffset >> m_p_offset_ec12[ispecies][ipar][jpar];
492 std::string fileProtonSigma = filePath +
"parameter_sigma_proton.txt";
493 ifstream inputProtonSigma( fileProtonSigma.c_str(), std::ios_base::in );
494 if( !inputProtonSigma ) {
495 cout <<
"ParticleID::TofCorrPID: Can NOT open file: " << fileProtonSigma << endl;
504 for(
unsigned int ispecies=0; ispecies<2; ispecies++ ) {
506 for(
unsigned int ipar=0; ipar<20; ipar++ ) {
508 for(
unsigned int jpar=0; jpar<46; jpar++ ) {
509 inputProtonSigma >> m_p_sigma_12[ispecies][
ipmt][ipar][jpar];
513 for(
unsigned int jpar=0; jpar<7; jpar++ ) {
514 inputProtonSigma >> m_p_sigma_ec12[ispecies][ipar][jpar];
526double TofCorrPID::offsetTof(
unsigned int ispecies,
bool barrel,
unsigned int ipmt,
double betaGamma,
int charge,
double zrhit,
double dt ) {
527 if( ispecies==0 || ispecies==1 ) {
return dt; }
529 double deltaT = -1000.0;
530 if( (
ipmt>= 4 && barrel ) || (
ipmt!=7 &&
ipmt!=8 && !barrel ) || betaGamma<0.0 ||
abs(
charge)!=1 || fabs(zrhit)>120.0 ) {
531 cout <<
"Particle::TofCorrPID: offsetTof for single end: the input parameter are NOT correct! Please check them!" << endl;
534 unsigned int layer=0;
536 if(
ipmt==0 ||
ipmt==1 ) { layer=0; }
537 else if(
ipmt==2 ||
ipmt==3 ) { layer=1; }
542 unsigned int inumber=
ipmt;
543 if( !barrel ) { inumber=4; }
546 for(
unsigned int i=0; i<9; i++ ) {
555 for(
unsigned int i=1; i<8; i++ ) {
556 func[i] = func[i-1]*zrhit;
559 unsigned int iparticle=0;
560 if( ispecies==2 || ispecies==3 ) { iparticle=0; }
561 else if( ispecies==4 ) { iparticle=1; }
562 unsigned int icharge=0;
563 if(
charge==1 ) { icharge=0; }
564 else if(
charge==-1 ) { icharge=1; }
566 if( ispecies!=4 || betaGamma*
xmass(4)>0.8 ) {
567 for(
unsigned int i=0; i<8; i++ ) {
569 parA += m_par_ab_12[iparticle][inumber][icharge][0][i]*func[i];
570 parB += m_par_ab_12[iparticle][inumber][icharge][1][i]*func[i];
573 parA += m_par_ab_12[iparticle][inumber][icharge][0][i+3]*func[i];
574 parB += m_par_ab_12[iparticle][inumber][icharge][1][i+3]*func[i];
577 for(
unsigned int iab=0; iab<2; iab++ ) {
578 func[8] = m_par_ab_12[iparticle][inumber][icharge][iab][5]*TMath::Gaus(zrhit,m_par_ab_12[iparticle][inumber][icharge][iab][6], m_par_ab_12[iparticle][inumber][icharge][iab][7]);
588 double tcorr = parA + parB/sqrt(q0);
592 if( barrel && ispecies==4 && betaGamma*
xmass(4)<0.8 ) {
598 double nbgbin = 20.0;
599 double bgbegin = 0.3;
602 bgstep = (bgend-bgbegin)/nbgbin;
604 int izbin =
static_cast<int>((zrhit-
zbegin)/zstep);
605 if( izbin<0 ) { izbin=0; }
606 else if( izbin>=nzbin ) { izbin=nzbin-1; }
607 int ibgbin =
static_cast<int>((betaGamma*
xmass(4)-bgbegin)/bgstep);
608 if( ibgbin<0 ) { ibgbin=0; }
609 else if( ibgbin>=nbgbin ) { ibgbin=nbgbin-1; }
612 tcorr = m_p_offset_12[0][
ipmt][ibgbin][izbin];
615 tcorr = m_p_offset_12[1][
ipmt][ibgbin][izbin];
618 else if( !barrel && ispecies==4 && betaGamma*
xmass(4)<0.8 ) {
624 double nbgbin = 20.0;
625 double bgbegin = 0.3;
628 bgstep = (bgend-bgbegin)/nbgbin;
630 int irbin =
static_cast<int>((zrhit-
rbegin)/rstep);
631 if( irbin<0 ) { irbin=0; }
632 else if( irbin>=nrbin ) { irbin=nrbin-1; }
633 int ibgbin =
static_cast<int>((betaGamma*
xmass(4)-bgbegin)/bgstep);
634 if( ibgbin<0 ) { ibgbin=0; }
635 else if( ibgbin>=nbgbin ) { ibgbin=nbgbin-1; }
638 tcorr = m_p_offset_ec12[0][ibgbin][irbin];
641 tcorr = m_p_offset_ec12[1][ibgbin][irbin];
652 if( ispecies==0 || ispecies==1 ) {
return dt; }
654 double deltaT = -1000.0;
655 if( tofid<0 || tofid>=176 ) {
656 cout <<
"Particle::TofCorrPID: offsetTof for single layer: the input parameter are NOT correct! Please check them!" << endl;
659 int pmt[3] = { -9, -9, -9 };
660 if( tofid>=0 && tofid<=87 ) {
671 double sigmaCorr2 = m_p_common*m_p_common;
672 double sigmaLeft =
bSigma( 0, tofid, zrhit );
673 double sigmaLeft2 = sigmaLeft*sigmaLeft;
674 double sigmaRight =
bSigma( 1, tofid, zrhit );
675 double sigmaRight2 = sigmaRight*sigmaRight;
677 double fraction = ( sigmaRight2 - sigmaCorr2 )/( sigmaLeft2 + sigmaRight2 - 2.0*sigmaCorr2);
678 deltaT = fraction*m_dtCorr[ispecies][pmt[0]] + (1.0-fraction)*m_dtCorr[ispecies][pmt[1]];
682 unsigned int ipmt = 4;
683 if( tofid>=88 && tofid<176 ) {
ipmt = 5; }
684 if( ispecies==4 && betaGamma*
xmass(4)<0.8 ) {
690 double nbgbin = 20.0;
691 double bgbegin = 0.3;
694 bgstep = (bgend-bgbegin)/nbgbin;
696 int izbin =
static_cast<int>((zrhit-
zbegin)/zstep);
697 if( izbin<0 ) { izbin=0; }
698 else if( izbin>=nzbin ) { izbin=nzbin-1; }
699 int ibgbin =
static_cast<int>((betaGamma*
xmass(4)-bgbegin)/bgstep);
700 if( ibgbin<0 ) { ibgbin=0; }
701 else if( ibgbin>=nbgbin ) { ibgbin=nbgbin-1; }
704 tcorr = m_p_offset_12[0][
ipmt][ibgbin][izbin];
707 tcorr = m_p_offset_12[1][
ipmt][ibgbin][izbin];
710 deltaT = deltaT - tcorr;
716double TofCorrPID::offsetTof(
unsigned int ispecies,
int tofid1,
int tofid2,
double zrhit1,
double zrhit2,
double betaGamma,
int charge,
double dt ) {
717 if( ispecies==0 || ispecies==1 ) {
return dt; }
719 double deltaT = -1000.0;
720 if( tofid1<0 || tofid1>=88 || tofid2<88 || tofid2>=176 ) {
721 cout <<
"Particle::TofCorrPID: offsetTof for double layer: the input parameter are NOT correct! Please check them!" << endl;
725 double sigmaCorr2 = m_p_common*m_p_common;
726 double sigmaInner =
bSigma( 2, tofid1, zrhit1 );
727 double sigmaInner2 = sigmaInner*sigmaInner;
728 double sigmaOuter =
bSigma( 2, tofid2, zrhit2 );
729 double sigmaOuter2 = sigmaOuter*sigmaOuter;
730 double sigma = sqrt( (sigmaInner2*sigmaOuter2-sigmaCorr2*sigmaCorr2)/(sigmaInner2+sigmaOuter2-2.0*sigmaCorr2) );
735 double fraction = ( sigmaOuter2 - sigmaCorr2 )/( sigmaInner2 + sigmaOuter2 - 2.0*sigmaCorr2);
736 deltaT = fraction*m_dtCorr[ispecies][4] + (1.0-fraction)*m_dtCorr[ispecies][5];
740 if( ispecies==4 && betaGamma*
xmass(4)<0.8 ) {
746 double nbgbin = 20.0;
747 double bgbegin = 0.3;
750 bgstep = (bgend-bgbegin)/nbgbin;
752 int izbin =
static_cast<int>((zrhit1-
zbegin)/zstep);
753 if( izbin<0 ) { izbin=0; }
754 else if( izbin>=nzbin ) { izbin=nzbin-1; }
755 int ibgbin =
static_cast<int>((betaGamma*
xmass(4)-bgbegin)/bgstep);
756 if( ibgbin<0 ) { ibgbin=0; }
757 else if( ibgbin>=nbgbin ) { ibgbin=nbgbin-1; }
760 tcorr = m_p_offset_12[0][6][ibgbin][izbin];
763 tcorr = m_p_offset_12[1][6][ibgbin][izbin];
766 deltaT = deltaT - tcorr;
772double TofCorrPID::sigmaTof(
unsigned int ispecies,
int charge,
bool barrel,
unsigned int ipmt,
int tofid[2],
double zrhit[2],
double betaGamma ) {
774 double sigma = 1.0e-6;
776 if( ispecies==0 || ispecies==1 ) {
815double TofCorrPID::sigmaTof(
unsigned int ispecies,
int charge,
bool barrel,
unsigned int ipmt,
double zrhit,
double betaGamma ) {
820 if( ispecies==4 && (betaGamma*
xmass(4))<0.8 ) {
821 double nbgbin = 20.0;
822 double bgbegin = 0.3;
825 bgstep = (bgend-bgbegin)/nbgbin;
826 ibgbin =
static_cast<int>((betaGamma*
xmass(4)-bgbegin)/bgstep);
828 if( ibgbin<0 ) { ibgbin=0; }
829 else if( ibgbin>=nbgbin ) { ibgbin=nbgbin-1; }
837 izbin =
static_cast<int>((zrhit-
zbegin)/zstep);
838 if( izbin<0 ) { izbin=0; }
839 else if( izbin>=nzbin ) { izbin=nzbin-1; }
847 izbin =
static_cast<int>((zrhit-
zbegin)/zstep);
848 if( izbin<0 ) { izbin=0; }
849 else if( izbin>=nzbin ) { izbin=nzbin-1; }
853 unsigned int numParam = 4;
855 for(
unsigned int i=0; i<4; i++ ) {
856 if( i==0 ) { func[i] = 1.0; }
858 func[i] = func[i-1]*zrhit;
861 for(
unsigned int i=4; i<12; i++ ) {
867 if( ispecies==2 || ispecies==3 ) {
868 for(
unsigned int i=4; i<10; i++ ) {
869 func[i] = func[i-1]*zrhit;
871 func[10] = 1.0/(115.0-zrhit)/(115.0-zrhit);
872 func[11] = 1.0/(115.0+zrhit)/(115.0+zrhit);
875 else if( ispecies==4 ) {
876 for(
unsigned int i=4; i<12; i++ ) {
877 func[i] = func[i-1]*zrhit;
886 unsigned int inumber =
ipmt;
887 if( !barrel ) { inumber=7; }
890 if( ispecies==2 || ispecies==3 ) {
891 for(
unsigned int i=0; i<numParam; i++ ) {
892 sigma += m_par_sigma[ispecies-2][inumber][i]*func[i];
895 else if( ispecies==4 ) {
900 sigma = m_p_sigma_12[0][inumber][ibgbin][izbin];
903 sigma = m_p_sigma_12[1][inumber][ibgbin][izbin];
908 sigma = m_p_sigma_ec12[0][ibgbin][izbin];
911 sigma = m_p_sigma_ec12[1][ibgbin][izbin];
914 if( fabs(
sigma+999.0)<1.0e-6 ) {
919 for(
unsigned int i=0; i<numParam; i++ ) {
921 sigma += m_par_sigma[2][inumber][i]*func[i];
924 sigma += m_par_sigma[3][inumber][i]*func[i];
934 sigma =
sigma*(TMath::Exp((betaGamma-0.356345)/(-0.767124))+0.994072);
944 if( layer>=3 || betaGamma<0.0 ) {
945 cout <<
"Particle::TofCorrPID::qCurveFunc: the input parameter are NOT correct! Please check them!" << endl;
949 double beta = betaGamma/sqrt(1.0+betaGamma*betaGamma);
950 double logterm = log( m_q0_bg[layer][2]+pow((1.0/betaGamma), m_q0_bg[layer][4] ) );
951 q0 = m_q0_bg[layer][0]*( m_q0_bg[layer][1]-pow( beta, m_q0_bg[layer][3] ) - logterm )/pow( beta, m_q0_bg[layer][3] );
962 func[2] = zrhit*zrhit;
963 func[3] = zrhit*zrhit*zrhit;
964 func[4] = zrhit*zrhit*zrhit*zrhit;
967 for(
unsigned int i=0; i<5; i++ ) {
968 sigma += m_p_weight[tofid][end][i]*func[i];
977 double sigma1 =
bSigma( 2, tofid[0], zrhit[0] );
978 double sigma2 =
bSigma( 2, tofid[1], zrhit[1] );
979 double sigmaCorr2 = m_p_common*m_p_common;
980 double sigma = ( sigma1*sigma1*sigma2*sigma2 - sigmaCorr2*sigmaCorr2 )/( sigma1*sigma1 + sigma2*sigma2 - 2.0*sigmaCorr2 );
992 func[2] = zrhit*zrhit;
995 for(
unsigned int i=0; i<3; i++ ) {
996 sigma += m_ec_sigma[tofid][i]*func[i];
1004 bool chiCut =
false;
1007 for(
unsigned int i=0; i<5; i++ ) {
1010 if( fabs(ppp) > pdftemp) { pdftemp = fabs(ppp); }
1014 if( !good )
return chiCut;
const Hep3Vector tof1Position() const
const Hep3Vector tof2Position() const
static void setPidType(PidType pidType)
const HepLorentzVector p4() const
bool isMdcKalTrackValid()
SmartRefVector< RecTofTrack > tofTrack()
RecMdcKalTrack * mdcKalTrack()
EvtRecTrack * PidTrk() const
double probCalculate(double chi2, int n)
double pdfCalculate(double offset, double sigma)
double pdfMinSigmaCut() const
void inputParameter(int run)
double qCurveFunc(unsigned int layer, double betaGamma)
int particleIDCalculation()
double sigma(int n) const
double offset(int n) const
double sigmaTof(unsigned int ispecies, int charge, bool barrel, unsigned int ipmt, int tofid[2], double zrhit[2], double betaGamma)
double bSigma(unsigned int end, int tofid, double zrhit)
double offsetTof(unsigned int ispecies, bool barrel, unsigned int ipmt, double betaGamma, int charge, double zrhit, double dt)
static TofCorrPID * instance()
double eSigma(int tofid, double zrhit)
bool correlationCheck(unsigned int ipmt)
unsigned int layer() const
void setStatus(unsigned int status)