#include <TofEPID.h>
Inheritance diagram for TofEPID:
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 () |
int | part () const |
int | part () const |
double | pdfCalculate (double offset, double sigma) |
double | pdfCalculate (double offset, double sigma) |
double | pdfMinSigmaCut () const |
double | pdfMinSigmaCut () 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 () |
double | rhit () const |
double | rhit () const |
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 |
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) |
~TofEPID () | |
~TofEPID () | |
Static Public Member Functions | |
TofEPID * | instance () |
TofEPID * | instance () |
Protected Member Functions | |
int | LikelihoodCalculation () |
int | LikelihoodCalculation () |
int | neuronPIDCalculation () |
int | neuronPIDCalculation () |
double | offsetTofE (int n, int cntr, double ptrk, double rtof, double ph, double charge) |
double | offsetTofE (int n, int cntr, double ptrk, double rtof, double ph, double charge) |
int | particleIDCalculation () |
int | particleIDCalculation () |
double | sigmaTofE (int n, int cntr, double ptrk, double rtof, double ph, double charge) |
double | sigmaTofE (int n, int cntr, double ptrk, double rtof, double ph, double charge) |
Private Member Functions | |
TofEPID () | |
TofEPID () | |
Private Attributes | |
double | m_chi [5] |
double | m_chimin |
double | m_mass2 |
int | m_ndof |
double | m_offset [5] |
int | m_part |
double | m_pdfmin |
double | m_prob [5] |
double | m_rhit |
double | m_sigma [5] |
Static Private Attributes | |
TofEPID * | m_pointer |
TofEPID * | m_pointer = 0 |
|
00018 {;}
|
|
00015 :ParticleIDBase() { 00016 //readSigPar(); 00017 }
|
|
00018 {;}
|
|
|
|
00091 {return (IDENTIFY_ELECTRON | IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);}
|
|
00091 {return (IDENTIFY_ELECTRON | IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);}
|
|
Implements ParticleIDBase. |
|
Implements ParticleIDBase. 00033 { 00034 if(particleIDCalculation()==0) m_ndof=1; 00035 }
|
|
|
|
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. 00023 {return m_chi[n];}
|
|
Implements ParticleIDBase. 00023 {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. 00019 { 00020 for(int i = 0; i < 5; i++) { 00021 m_chi[i] = 99.0; 00022 m_prob[i] = -1.0; 00023 m_offset[i] = 99.0; 00024 m_sigma[i] = 1.0; 00025 } 00026 m_chimin = 99.; 00027 m_pdfmin =99.; 00028 m_ndof = 0; 00029 m_mass2 = -999; 00030 m_rhit = -99; 00031 }
|
|
|
|
|
|
|
|
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. 00022 {return (m_ndof > 0); }
|
|
Implements ParticleIDBase. 00022 {return (m_ndof > 0); }
|
|
Implements ParticleIDBase. 00036 {return -1;}
|
|
Implements ParticleIDBase. 00036 {return -1;}
|
|
00028 {return m_mass2;}
|
|
00028 {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. 00027 {return m_ndof;}
|
|
Implements ParticleIDBase. 00027 {return m_ndof;}
|
|
00031 {return -1;}
|
|
00031 {return -1;}
|
|
00034 { return -1;}
|
|
00034 { return -1;}
|
|
00026 {return m_offset[n];}
|
|
00026 {return m_offset[n];}
|
|
|
|
00128 { 00129 double offset; 00130 double gb = ptrk/xmass(n); 00131 switch(n) { 00132 case 0: { // Electron 00133 double ptemp = ptrk; 00134 if(ptrk<0.2) ptemp = 0.2; 00135 if(ptrk > 2.1) ptemp = 2.1; 00136 double plog = log(ptemp); 00137 offset = 0.001*(-28.8481+138.159*plog-249.334*plog*plog); 00138 break; 00139 } 00140 00141 case 1: { // Muon 00142 double ptemp = ptrk; 00143 if(ptrk<0.2) ptemp = 0.2; 00144 if(ptrk > 2.1) ptemp = 2.1; 00145 double plog = log(ptemp); 00146 offset = 0.001*(-33.6966+1.91915*plog-0.592320*plog*plog); 00147 break; 00148 } 00149 case 2: { // Pion 00150 double ptemp = ptrk; 00151 if(ptrk<0.2) ptemp = 0.2; 00152 if(ptrk > 2.1) ptemp = 2.1; 00153 double plog = log(ptemp); 00154 offset = 0.001*(-27.9965 + 1.213 * plog - 2.02740 * plog * plog); 00155 break; 00156 } 00157 case 3: { // Kaon 00158 double ptemp = ptrk; 00159 if(ptrk<0.3) ptemp = 0.3; 00160 if(ptrk > 2.1) ptemp = 2.1; 00161 double plog = log(ptemp); 00162 offset = 0.001*(-23.4842 -28.7569 * plog + 78.21* plog *plog); 00163 break; 00164 } 00165 00166 case 4: { // Proton 00167 double ptemp = ptrk; 00168 if(ptrk<0.4) ptemp = 0.4; 00169 if(ptrk > 2.1) ptemp = 2.1; 00170 double plog = log(ptemp); 00171 if(charge>0) 00172 offset = 0.001*(-4.854-110.540*plog+99.8732*plog*plog); 00173 if(charge<0) 00174 offset = 0.001*(27.047-145.120*plog+167.014*plog*plog); 00175 break; 00176 } 00177 00178 default: 00179 offset = 0.0; 00180 break; 00181 } 00182 // offset = 0.0; 00183 return offset; 00184 }
|
|
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 }
|
|
00029 {return m_part;}
|
|
00029 {return m_part;}
|
|
Implements ParticleIDBase. |
|
Implements ParticleIDBase. 00037 { 00038 int irc = -1; 00039 EvtRecTrack* recTrk = PidTrk(); 00040 if(!(recTrk->isMdcTrackValid())) return irc; 00041 RecMdcTrack* mdcTrk = recTrk->mdcTrack(); 00042 00043 double ptrk = mdcTrk->p(); 00044 double cost = cos(mdcTrk->theta()); 00045 double charge = mdcTrk->charge(); 00046 00047 if(!(recTrk->isTofTrackValid())) return irc; 00048 SmartRefVector<RecTofTrack> tofTrk = recTrk->tofTrack(); 00049 SmartRefVector<RecTofTrack>::iterator it;//=tofTrk.begin(); 00050 TofHitStatus *hitst = new TofHitStatus; 00051 std::vector<int> tofecount; 00052 int goodtofetrk=0; 00053 for(it = tofTrk.begin();it!=tofTrk.end();it++,goodtofetrk++){ 00054 unsigned int st = (*it)->status(); 00055 hitst->setStatus(st); 00056 if( (hitst->is_barrel()) ) continue; 00057 if( !(hitst->is_counter()) ) continue; 00058 if( hitst->layer()==1 ) tofecount.push_back(goodtofetrk); 00059 } 00060 delete hitst; 00061 if(tofecount.size()!=1) return irc;//not tof2 track or more than 1 tracks 00062 it = tofTrk.begin()+tofecount[0]; 00063 00064 00065 int qual = (*it)->quality(); 00066 // if(qual != 1) return irc; 00067 int cntr = (*it)->tofID(); 00068 double tof = (*it)->tof(); 00069 if(tof <=0 ) return irc; 00070 double path = (*it)->path(); 00071 double m_ph = (*it)->ph(); 00072 m_rhit = (*it)->zrhit(); 00073 // m_part = tofTrk->getPart(); 00074 00075 double beta2 = path*path/velc()/velc()/tof/tof; 00076 m_mass2 = ptrk * ptrk * (1/beta2 -1); 00077 // if ((m_mass2>20)||(m_mass2<-1)) return irc; 00078 00079 00080 double chitemp = 99.; 00081 double pdftemp = 0; 00082 for(int i = 0; i < 5; i++) { 00083 double gb = ptrk/xmass(i); 00084 double beta = gb/sqrt(1+gb*gb); 00085 double texp = (*it)->texp(i); 00086 // path /beta/velc(); 00087 m_offset[i] = tof - texp-(*it)->toffset(i);// - offsetTofE(i, cntr, ptrk, m_rhit, m_ph,charge); 00088 double sigma_tmp= (*it)->sigma(0); 00089 /* if(fabs(sigma_tmp/1000.)>0.3) { 00090 int tofid=(*it)->tofID(); 00091 // sigma_tmp=getSigbyRun(tofid)*0.1; 00092 }*/ 00093 00094 if(sigma_tmp!=0) { 00095 m_sigma[i] = 1.2*sigma_tmp; 00096 if(i<2) m_sigma[i]=sigma_tmp; 00097 } 00098 else m_sigma[i]=0.12; 00099 // m_chi[i] = m_offset[i]/m_sigma[i]; 00100 00101 // m_sigma[i]=sigma_tmp; 00102 // if(i!=0) m_sigma[i] = sigma_tmp*1.1; 00103 // m_sigma[i] = sigmaTofE(i, cntr,ptrk,m_rhit, m_ph,charge); 00104 m_chi[i] = m_offset[i]/m_sigma[i]; 00105 if(fabs(m_chi[i]) < chitemp) chitemp = fabs(m_chi[i]); 00106 double ppp = pdfCalculate(m_chi[i],1); 00107 if(fabs(ppp) > pdftemp) pdftemp = fabs(ppp); 00108 } 00109 m_chimin = chitemp; 00110 // if(m_chimin > chiMinCut() ) return irc; 00111 // if(pdftemp < pdfCalculate(pdfMinSigmaCut(),1.0)) return irc; 00112 00113 // calculate prob 00114 00115 for(int i = 0; i < 5; i++) 00116 m_prob[i] = probCalculate(m_chi[i]*m_chi[i], 1); 00117 00118 m_ndof = 1; 00119 irc = 0; 00120 return irc; 00121 }
|
|
|
|
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;}
|
|
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. 00024 {return m_prob[n];}
|
|
Implements ParticleIDBase. 00024 {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 }
|
|
00030 {return m_rhit;}
|
|
00030 {return m_rhit;}
|
|
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];}
|
|
|
|
00186 { 00187 00188 double sigma; 00189 double gb = ptrk/xmass(n); 00190 switch(n) { 00191 00192 case 0: { // Electron 00193 double ptemp = ptrk; 00194 if(ptrk < 0.2) ptemp = 0.2; 00195 if(ptrk > 2.1) ptemp = 2.1; 00196 double plog = log(ptemp); 00197 sigma = 0.001 * (109.974 +15.2457 * plog + 36.8139 * plog * plog); 00198 00199 break; 00200 } 00201 00202 case 1: { // Muon 00203 double ptemp = ptrk; 00204 if(ptrk < 0.2) ptemp = 0.2; 00205 if(ptrk > 2.1) ptemp = 2.1; 00206 double plog = log(ptemp); 00207 sigma = 0.001 * (96.5077 -2.96232 * plog + 3.12910 * plog * plog); 00208 break; 00209 } 00210 00211 case 2: { // pion 00212 double ptemp = ptrk; 00213 if(ptrk < 0.2) ptemp = 0.2; 00214 if(ptrk > 2.1) ptemp = 2.1; 00215 double plog = log(ptemp); 00216 sigma = 0.001 * (105.447 - 2.08044 * plog + 3.44846 * plog * plog); 00217 break; 00218 } 00219 00220 case 3: { // Kaon 00221 double ptemp = ptrk; 00222 if(ptrk < 0.3) ptemp = 0.3; 00223 if(ptrk > 2.1) ptemp = 2.1; 00224 double plog = log(ptemp); 00225 sigma = 0.001*(88.8806 - 26.8464 * plog + 113.672 * plog * plog); 00226 break; 00227 } 00228 case 4: { // Proton 00229 double ptemp = ptrk; 00230 if(ptrk < 0.5) ptemp = 0.5; 00231 if(ptrk > 2.1) ptemp = 2.1; 00232 double plog = log(ptemp); 00233 if(charge>0) 00234 sigma = 0.001 * (96.3534 -44.1139 * plog + 53.9805 * plog * plog); 00235 if(charge<0) 00236 sigma = 0.001 * (157.345 -98.7357 * plog + 55.1145 * plog * plog); 00237 break; 00238 } 00239 00240 default: 00241 sigma = 0.100; 00242 00243 break; 00244 } 00245 // sigma =1; 00246 return sigma; 00247 }
|
|
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 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|