#include <Tof2PID.h>
Inheritance diagram for Tof2PID:
Public Member Functions | |
int | all () const |
int | all () const |
void | calculate () |
void | calculate () |
double | charge () |
double | charge () |
double | chi (int n) const |
double | chi (int n) const |
double | chiMinCut () const |
double | chiMinCut () const |
int | dedxValid () const |
int | dedxValid () const |
int | emcValid () const |
int | emcValid () const |
double | getRunNo () const |
double | getRunNo () const |
void | init () |
void | init () |
double | interpolation (double *x, double *y, double x1) |
double | interpolation (double *x, double *y, double x1) |
bool | IsPidInfoValid () const |
bool | IsPidInfoValid () const |
double | mass2 () const |
double | mass2 () const |
int | methodLikelihood () const |
int | methodLikelihood () const |
int | methodNeuronNetwork () const |
int | methodNeuronNetwork () const |
int | methodProbability () const |
int | methodProbability () const |
int | mucValid () const |
int | mucValid () const |
int | ndof () const |
int | ndof () const |
int | neuronPID () const |
int | neuronPID () const |
double | offset (int n) const |
double | offset (int n) const |
int | onlyElectron () const |
int | onlyElectron () const |
int | onlyKaon () const |
int | onlyKaon () const |
int | onlyMuon () const |
int | onlyMuon () const |
int | onlyPion () const |
int | onlyPion () const |
int | onlyPionKaon () const |
int | onlyPionKaon () const |
int | onlyPionKaonElectron () const |
int | onlyPionKaonElectron () const |
int | onlyPionKaonProton () const |
int | onlyPionKaonProton () const |
int | onlyProton () const |
int | onlyProton () const |
double | p () |
double | p () |
double | path2 () const |
double | path2 () const |
double | pdfCalculate (double offset, double sigma) |
double | pdfCalculate (double offset, double sigma) |
double | pdfMinSigmaCut () const |
double | pdfMinSigmaCut () const |
double | ph2 () const |
double | ph2 () const |
EvtRecTrack * | PidTrk () const |
EvtRecTrack * | PidTrk () const |
double | pol2 (double x, double *par) |
double | pol2 (double x, double *par) |
double | pol3 (double x, double *par) |
double | pol3 (double x, double *par) |
double | pol4 (double x, double *par) |
double | pol4 (double x, double *par) |
double | prob (int n) const |
double | prob (int n) const |
double | probCalculate (double chi2, int n) |
double | probCalculate (double chi2, int n) |
double | pt () |
double | pt () |
void | setChiMinCut (const double chi=4) |
void | setChiMinCut (const double chi=4) |
void | setPdfMinSigmaCut (const double pdf=4) |
void | setPdfMinSigmaCut (const double pdf=4) |
void | setRecTrack (EvtRecTrack *trk) |
void | setRecTrack (EvtRecTrack *trk) |
void | setRunNo (const double runh=8093) |
void | setRunNo (const double runh=8093) |
double | sigma (int n) const |
double | sigma (int n) const |
double | tof2 () const |
double | tof2 () const |
int | tofcValid () const |
int | tofcValid () const |
int | tofeValid () const |
int | tofeValid () const |
int | tofqValid () const |
int | tofqValid () const |
int | tofValid () const |
int | tofValid () const |
int | useDedx () const |
int | useDedx () const |
int | useEmc () const |
int | useEmc () const |
int | useMuc () const |
int | useMuc () const |
int | useTof () const |
int | useTof () const |
int | useTof1 () const |
int | useTof1 () const |
int | useTof2 () const |
int | useTof2 () const |
int | useTofC () const |
int | useTofC () const |
int | useTofE () const |
int | useTofE () const |
int | useTofQ () const |
int | useTofQ () const |
double | velc () |
double | velc () |
double | xmass (int n) |
double | xmass (int n) |
double | zhit2 () const |
double | zhit2 () const |
~Tof2PID () | |
~Tof2PID () | |
Static Public Member Functions | |
Tof2PID * | instance () |
Tof2PID * | instance () |
Protected Member Functions | |
int | LikelihoodCalculation () |
int | LikelihoodCalculation () |
int | neuronPIDCalculation () |
int | neuronPIDCalculation () |
double | offsetTof2 (int n, int cntr, double ptrk, double ztof, double m_ph2, double charge) |
double | offsetTof2 (int n, int cntr, double ptrk, double ztof, double m_ph2, double charge) |
int | particleIDCalculation () |
int | particleIDCalculation () |
double | sampleQ0 (double betagamma, double beta) |
double | sampleQ0 (double betagamma, double beta) |
double | sigmaTof2 (int n, int cntr, double ptrk, double ztof, double m_ph2, double charge) |
double | sigmaTof2 (int n, int cntr, double ptrk, double ztof, double m_ph2, double charge) |
Private Member Functions | |
Tof2PID () | |
Tof2PID () | |
Private Attributes | |
double | m_chi [5] |
double | m_chimin |
double | m_mass2 |
int | m_ndof |
double | m_offset [5] |
double | m_pars [15] |
double | m_path2 |
double | m_pdfmin |
double | m_ph2 |
double | m_prob [5] |
double | m_sigma [5] |
double | m_tof2 |
double | m_zhit2 |
Static Private Attributes | |
Tof2PID * | m_pointer |
Tof2PID * | m_pointer = 0 |
|
00019 {;}
|
|
00016 :ParticleIDBase() { 00017 m_pars[0]=-0.237207; 00018 m_pars[1]= 1.90436; 00019 m_pars[2]= -0.210625; 00020 m_pars[3]= 0.664667; 00021 m_pars[4]= 0.00165226; 00022 m_pars[5]= -1.86503e-06; 00023 m_pars[6]= 6.07045e-10; 00024 m_pars[7]=-0.0882228; 00025 m_pars[8]= 0.0125708; 00026 m_pars[9]= -0.117157; 00027 m_pars[10]= 0.00252878; 00028 m_pars[11]= 0.254343; 00029 m_pars[12]= -5.74886; 00030 m_pars[13]= 5.20507; 00031 m_pars[14]= 1.86515; 00032 00033 }
|
|
00019 {;}
|
|
|
|
00091 {return (IDENTIFY_ELECTRON | IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);}
|
|
00091 {return (IDENTIFY_ELECTRON | IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);}
|
|
Implements ParticleIDBase. |
|
Implements ParticleIDBase. 00051 { 00052 if(particleIDCalculation() == 0) m_ndof=1; 00053 }
|
|
|
|
00077 { 00078 double val = 999; 00079 if(!m_trk) return val; 00080 if(!m_trk->isMdcTrackValid()) return val; 00081 RecMdcTrack *mdcTrk = m_trk->mdcTrack(); 00082 val = mdcTrk->charge() + 0.0; 00083 }
|
|
Implements ParticleIDBase. 00024 {return m_chi[n];}
|
|
Implements ParticleIDBase. 00024 {return m_chi[n];}
|
|
00052 {return m_chimin_cut;}
|
|
00052 {return m_chimin_cut;}
|
|
00103 {return DEDX_VALID;}
|
|
00103 {return DEDX_VALID;}
|
|
00108 {return EMC_VALID;}
|
|
00108 {return EMC_VALID;}
|
|
00056 {return m_runno;}
|
|
00056 {return m_runno;}
|
|
Implements ParticleIDBase. |
|
Implements ParticleIDBase. 00035 { 00036 00037 for(int i = 0; i < 5; i++) { 00038 m_chi[i] = 99.0; 00039 m_prob[i] = -1.0; 00040 m_sigma[i] = 1.0; 00041 m_offset[i] =99.0; 00042 } 00043 m_chimin = 99.; 00044 m_pdfmin =99.; 00045 m_ndof = 0; 00046 m_mass2 = -999; 00047 m_ph2 = -99; 00048 m_zhit2 = -99; 00049 }
|
|
|
|
|
|
|
|
00085 { 00086 double c1 = (y[0]-y[1])*(x[1]-x[2])-(x[0]-x[1])*(y[1]-y[2]); 00087 double c2 = (x[0]*x[0]-x[1]*x[1])*(x[1]-x[2])-(x[1]*x[1]-x[2]*x[2])*(x[0]-x[1]); 00088 double c = c1/c2; 00089 double b1 = (y[0]-y[1])*(x[1]*x[1]-x[2]*x[2])-(x[0]*x[0]-x[1]*x[1])*(y[1]-y[2]); 00090 double b2 = (x[0]-x[1])*(x[1]*x[1]-x[2]*x[2])-(x[1]-x[2])*(x[0]*x[0]-x[1]*x[1]); 00091 double b = b1/b2; 00092 double a = y[0] - b*x[0]-c*x[0]*x[0]; 00093 double y1 = a + b*x1 +c*x1*x1; 00094 return y1; 00095 }
|
|
Implements ParticleIDBase. 00023 {return (m_ndof > 0); }
|
|
Implements ParticleIDBase. 00023 {return (m_ndof > 0); }
|
|
Implements ParticleIDBase. 00039 {return -1;}
|
|
Implements ParticleIDBase. 00039 {return -1;}
|
|
00029 {return m_mass2;}
|
|
00029 {return m_mass2;}
|
|
00099 {return LIKELIHOOD_PID;}
|
|
00099 {return LIKELIHOOD_PID;}
|
|
00101 {return NEURONNETWORK_PID;}
|
|
00101 {return NEURONNETWORK_PID;}
|
|
00100 {return PROBABILITY_PID;}
|
|
00100 {return PROBABILITY_PID;}
|
|
00109 {return MUC_VALID;}
|
|
00109 {return MUC_VALID;}
|
|
Implements ParticleIDBase. 00028 {return m_ndof;}
|
|
Implements ParticleIDBase. 00028 {return m_ndof;}
|
|
00034 {return -1;}
|
|
00034 {return -1;}
|
|
00038 {return -1;}
|
|
00038 {return -1;}
|
|
00026 {return m_offset[n];}
|
|
00026 {return m_offset[n];}
|
|
|
|
00139 { 00140 double offset; 00141 double gb = ptrk/xmass(n); 00142 double betagamma; 00143 switch(n) { 00144 00145 case 0: { // Electron 00146 offset = 0.0; 00147 return offset; 00148 } 00149 00150 case 1: { // Muon 00151 offset = 0.0; 00152 return offset; 00153 } 00154 00155 case 2: { // Pion 00156 betagamma=ptrk/139.57; 00157 break; 00158 } 00159 case 3: { // Kaon 00160 betagamma=ptrk/493.68; 00161 break; 00162 } 00163 00164 case 4: { // Proton 00165 betagamma=ptrk/938.27; 00166 break; 00167 } 00168 00169 default:{ 00170 offset = 0.0; 00171 return offset;} 00172 break; 00173 } 00174 z=z/1000.0; 00175 double Q = ph; 00176 double beta = betagamma / TMath::Sqrt(1 + betagamma*betagamma); 00177 double Q0 = sampleQ0(betagamma,beta); 00178 double func[15]={0.}; 00179 func[0]=1.;func[1]=1./sqrt(Q);func[2]=z/sqrt(Q); 00180 func[3]=z*z/sqrt(Q);func[4]=Q;func[5]=Q*Q; 00181 func[6]=Q*Q*Q;func[7]=1./(0.89*0.89+z*z);func[8]=z; 00182 func[9]=z*z;func[10]=z*z*z;func[11]=1./sqrt(Q0); 00183 func[12]=z/sqrt(Q0);func[13]=z*z/sqrt(Q0);func[14]=z*z*z/sqrt(Q0); 00184 offset=0.; 00185 for(int i=0;i<15;i++){ 00186 offset+= m_pars[i]*func[i]; 00187 } 00188 00189 return offset; 00190 }
|
|
00092 {return IDENTIFY_ELECTRON;}
|
|
00092 {return IDENTIFY_ELECTRON;}
|
|
00095 {return IDENTIFY_KAON;}
|
|
00095 {return IDENTIFY_KAON;}
|
|
00093 {return IDENTIFY_MUON;}
|
|
00093 {return IDENTIFY_MUON;}
|
|
00094 {return IDENTIFY_PION;}
|
|
00094 {return IDENTIFY_PION;}
|
|
00088 {return (IDENTIFY_PION | IDENTIFY_KAON);}
|
|
00088 {return (IDENTIFY_PION | IDENTIFY_KAON);}
|
|
00090 {return (IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_ELECTRON);}
|
|
00090 {return (IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_ELECTRON);}
|
|
00089 {return (IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);}
|
|
00089 {return (IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);}
|
|
00096 {return IDENTIFY_PROTON;}
|
|
00096 {return IDENTIFY_PROTON;}
|
|
|
|
00063 { 00064 double val = 999; 00065 if(!m_trk) return val; 00066 if(!m_trk->isMdcTrackValid()) return val; 00067 RecMdcTrack *mdcTrk = m_trk->mdcTrack(); 00068 val = mdcTrk->p(); 00069 }
|
|
Implements ParticleIDBase. |
|
Implements ParticleIDBase. 00055 { 00056 int irc = -1; 00057 EvtRecTrack* recTrk = PidTrk(); 00058 if(!(recTrk->isMdcTrackValid())) return irc; 00059 RecMdcTrack* mdcTrk = recTrk->mdcTrack(); 00060 00061 double ptrk = mdcTrk->p(); 00062 double cost = cos(mdcTrk->theta()); 00063 double charge = mdcTrk->charge(); 00064 00065 if(!(recTrk->isTofTrackValid())) return irc; 00066 SmartRefVector<RecTofTrack> tofTrk = recTrk->tofTrack(); 00067 SmartRefVector<RecTofTrack>::iterator it;//=tofTrk.begin(); 00068 TofHitStatus *hitst = new TofHitStatus; 00069 std::vector<int> tof2count; 00070 int goodtof2trk=0; 00071 for(it = tofTrk.begin();it!=tofTrk.end();it++,goodtof2trk++){ 00072 unsigned int st = (*it)->status(); 00073 hitst->setStatus(st); 00074 00075 if( !(hitst->is_barrel()) ) continue; 00076 if( !(hitst->is_counter()) ) continue; 00077 if( hitst->layer()==2 ) tof2count.push_back(goodtof2trk); 00078 } 00079 delete hitst; 00080 00081 if(tof2count.size()!=1) return irc;//not tof2 track or more than 1 tracks 00082 it = tofTrk.begin()+tof2count[0]; 00083 double tof = (*it)->tof(); 00084 m_tof2 = tof; 00085 00086 if(tof <=0 ) return irc; 00087 int qual = (*it)->quality(); 00088 // if(qual != 1) return irc; 00089 int cntr = (*it)->tofID(); 00090 double path = ((*it)->path())*10.0;//the unit from mm to cm 00091 00092 m_path2 = path; 00093 // m_path2 = path; 00094 // fix the bugs the 6.0.0, He K.L. 00095 // double path = tofTrk->getPath1(); 00096 // 00097 m_ph2 = (*it)->ph(); 00098 m_zhit2 = ((*it)->zrhit())*10; //the unit from mm to cm 00099 00100 double beta2 = path*path/velc()/velc()/tof/tof; 00101 m_mass2 = ptrk * ptrk * (1/beta2 -1); 00102 if ((m_mass2>20)||(m_mass2<-1)) return irc; 00103 00104 double chitemp = 99.; 00105 double pdftemp = 0; 00106 double sig_tmp = (*it)->sigma(0); 00107 for(int i = 0; i < 5; i++) { 00108 m_offset[i] = tof - (*it)->texp(i)-(*it)->toffset(i);//- offsetTof1(i, cntr, ptrk, m_zhit1, m_ph1,charge); 00109 if(sig_tmp!=0) { 00110 m_sigma[i] = 1.2*sig_tmp; 00111 if(i<2) m_sigma[i]=sig_tmp; 00112 } 00113 else m_sigma[i]= sigmaTof2(i, cntr,ptrk,m_zhit2, m_ph2,charge); 00114 m_chi[i] = m_offset[i]/m_sigma[i]; 00115 if(fabs(m_chi[i]) < chitemp) chitemp = fabs(m_chi[i]); 00116 double ppp = pdfCalculate(m_chi[i],1); 00117 if(fabs(ppp) > pdftemp) pdftemp = fabs(ppp); 00118 } 00119 // if(ptrk<0.65) m_chi[2]=m_chi[3]; 00120 m_chimin = chitemp; 00121 m_pdfmin = pdftemp; 00122 if(pdftemp < pdfCalculate(pdfMinSigmaCut(),1)) return irc; 00123 if(fabs(m_chimin) > chiMinCut()) return irc; 00124 00125 // calculate prob 00126 00127 for(int i = 0; i < 5; i++){ 00128 m_prob[i] = probCalculate(m_chi[i]*m_chi[i], 1); 00129 } 00130 irc = 0; 00131 return irc; 00132 }
|
|
00032 {return m_path2;}
|
|
00032 {return m_path2;}
|
|
|
|
00055 { 00056 const double pi = 3.141592653589793238; 00057 const double twoPi = 2*pi; 00058 double chi2 = -0.5*offset*offset/(sigma*sigma); 00059 double pdf = exp(chi2)/(sigma*sqrt(twoPi)); 00060 return pdf; 00061 }
|
|
00054 {return m_pdfsigmamin_cut;}
|
|
00054 {return m_pdfsigmamin_cut;}
|
|
00030 {return m_ph2;}
|
|
00030 {return m_ph2;}
|
|
00050 {return m_trk;}
|
|
00050 {return m_trk;}
|
|
|
|
00097 { 00098 double y=x; 00099 return par[0] + (par[1] * y) +(par[2] * y * y); 00100 }
|
|
|
|
00102 { 00103 double y=x; 00104 return par[0] + (par[1] * y) +(par[2] * y * y)+(par[3] * y * y*y); 00105 }
|
|
|
|
00107 { 00108 double y=x; 00109 return par[0] + (par[1] * y) +(par[2] * y * y)+(par[3] * y * y*y) + (par[4] * y * y*y*y); 00110 }
|
|
Implements ParticleIDBase. 00027 {return m_prob[n];}
|
|
Implements ParticleIDBase. 00027 {return m_prob[n];}
|
|
|
|
00047 { 00048 double p = -1.0; 00049 if(chi2 < 0) return p; 00050 p = TMath::Prob(chi2, ndof); 00051 return p; 00052 }
|
|
|
|
00070 { 00071 double val = 999; 00072 if(!m_trk) return val; 00073 if(!m_trk->isMdcTrackValid()) return val; 00074 RecMdcTrack *mdcTrk = m_trk->mdcTrack(); 00075 val = mdcTrk->pxy(); 00076 }
|
|
|
|
00233 { 00234 double p1 = 0.261; 00235 double p2 = 5.43; 00236 double p3 = 1.12; 00237 double p4 = 1.96; 00238 double p5 = 0.386; 00239 double val = p1 / TMath::Power(beta, p4) * 00240 ( p2- TMath::Power(beta, p4) - 00241 TMath::Log(p3 + TMath::Power(1/betagamma, p5))); 00242 00243 return val*100.; 00244 }
|
|
00053 {m_chimin_cut = chi;}
|
|
00053 {m_chimin_cut = chi;}
|
|
00055 {m_pdfsigmamin_cut= pdf;}
|
|
00055 {m_pdfsigmamin_cut= pdf;}
|
|
00051 {m_trk = trk;}
|
|
00051 {m_trk = trk;}
|
|
00057 {m_runno = runh;}
|
|
00057 {m_runno = runh;}
|
|
00025 {return m_sigma[n];}
|
|
00025 {return m_sigma[n];}
|
|
|
|
00192 { 00193 double sigma; 00194 double gb = ptrk/xmass(n); 00195 double cosz = cos(ztof/1000.0); 00196 // double phtemp=ph; 00197 switch(n) { 00198 00199 case 0: { // Electron 00200 sigma = 0.115816 -0.0933215*cosz+ 0.0788252*cosz*cosz; 00201 break; 00202 } 00203 00204 case 1: { // Muon 00205 sigma = 0.121536 -0.0935898*cosz+0.0748771*cosz*cosz; 00206 break; 00207 } 00208 00209 case 2: { // Pion 00210 sigma = 0.106882-0.0147375*cosz+0.027491*cosz*cosz; 00211 break; 00212 } 00213 case 3: { // Kaon 00214 sigma =0.106882 -0.0147375*cosz +0.027491 *cosz*cosz; 00215 break; 00216 } 00217 00218 case 4: { // Proton 00219 sigma = 0.168489 -0.131762*cosz+ 0.105708*cosz*cosz; 00220 break; 00221 } 00222 00223 default: 00224 sigma = 0.100; 00225 break; 00226 } 00227 sigma = 0.110; 00228 //sigma = 1.0; 00229 return sigma; 00230 }
|
|
00033 {return m_tof2;}
|
|
00033 {return m_tof2;}
|
|
00107 {return TOFC_VALID;}
|
|
00107 {return TOFC_VALID;}
|
|
00105 {return TOFE_VALID;}
|
|
00105 {return TOFE_VALID;}
|
|
00106 {return TOFQ_VALID;}
|
|
00106 {return TOFQ_VALID;}
|
|
00104 {return TOF_VALID;}
|
|
00104 {return TOF_VALID;}
|
|
00077 {return USE_DEDX;}
|
|
00077 {return USE_DEDX;}
|
|
00084 {return USE_EMC;}
|
|
00084 {return USE_EMC;}
|
|
00085 {return USE_MUC;}
|
|
00085 {return USE_MUC;}
|
|
00078 {return USE_TOF;}
|
|
00078 {return USE_TOF;}
|
|
00079 {return USE_TOF1;}
|
|
00079 {return USE_TOF1;}
|
|
00080 {return USE_TOF2;}
|
|
00080 {return USE_TOF2;}
|
|
00083 {return USE_TOFC;}
|
|
00083 {return USE_TOFC;}
|
|
00081 {return USE_TOFE;}
|
|
00081 {return USE_TOFE;}
|
|
00082 {return USE_TOFQ;}
|
|
00082 {return USE_TOFQ;}
|
|
|
|
00041 { 00042 // double vel = 29.9792458; // tof_path unit in cm. 00043 double vel = 299.792458; // tof path unit in mm 00044 return vel; 00045 }
|
|
|
|
00035 { 00036 double mass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272}; 00037 if(n < 0 || n >=5) return 0.0; 00038 return mass[n]; 00039 }
|
|
00031 {return m_zhit2;}
|
|
00031 {return m_zhit2;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|