#include <Tof1PID.h>
Inheritance diagram for Tof1PID:
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 | path1 () const |
double | path1 () const |
double | pdfCalculate (double offset, double sigma) |
double | pdfCalculate (double offset, double sigma) |
double | pdfMinSigmaCut () const |
double | pdfMinSigmaCut () const |
double | ph1 () const |
double | ph1 () 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 | tof1 () const |
double | tof1 () 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 | zhit1 () const |
double | zhit1 () const |
~Tof1PID () | |
~Tof1PID () | |
Static Public Member Functions | |
Tof1PID * | instance () |
Tof1PID * | instance () |
Protected Member Functions | |
int | LikelihoodCalculation () |
int | LikelihoodCalculation () |
int | neuronPIDCalculation () |
int | neuronPIDCalculation () |
double | offsetTof1 (int n, int cntr, double ptrk, double ztof, double m_ph1, double charge) |
double | offsetTof1 (int n, int cntr, double ptrk, double ztof, double m_ph1, double charge) |
int | particleIDCalculation () |
int | particleIDCalculation () |
double | sampleQ0 (double betagamma, double beta) |
double | sampleQ0 (double betagamma, double beta) |
double | sigmaTof1 (int n, int cntr, double ptrk, double ztof, double m_ph1, double charge) |
double | sigmaTof1 (int n, int cntr, double ptrk, double ztof, double m_ph1, double charge) |
Private Member Functions | |
Tof1PID () | |
Tof1PID () | |
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_path1 |
double | m_pdfmin |
double | m_ph1 |
double | m_prob [5] |
double | m_sigma [5] |
double | m_tof1 |
double | m_zhit1 |
Static Private Attributes | |
Tof1PID * | m_pointer |
Tof1PID * | m_pointer = 0 |
|
00020 {;}
|
|
00014 :ParticleIDBase() { 00015 m_pars[0]= -0.208289; 00016 m_pars[1]= 1.63092; 00017 m_pars[2]= -0.0733139; 00018 m_pars[3]= 1.02385; 00019 m_pars[4]= 0.00145052; 00020 m_pars[5]= -1.72471e-06; 00021 m_pars[6]= 5.92726e-10; 00022 m_pars[7]= -0.0645428; 00023 m_pars[8]= -0.00143637; 00024 m_pars[9]= -0.133817; 00025 m_pars[10]= 0.0101188; 00026 m_pars[11]= -5.07622; 00027 m_pars[12]= 5.31472; 00028 m_pars[13]= -0.443142; 00029 m_pars[14]= -12.1083; 00030 00031 }
|
|
00020 {;}
|
|
|
|
00091 {return (IDENTIFY_ELECTRON | IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);}
|
|
00091 {return (IDENTIFY_ELECTRON | IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);}
|
|
Implements ParticleIDBase. |
|
Implements ParticleIDBase. 00048 { 00049 if(particleIDCalculation() == 0) m_ndof=1; 00050 }
|
|
|
|
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. 00025 {return m_chi[n];}
|
|
Implements ParticleIDBase. 00025 {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. 00033 { 00034 for(int i = 0; i < 5; i++) { 00035 m_chi[i] = 99.0; 00036 m_prob[i] = -1.0; 00037 m_sigma[i] = 1; 00038 m_offset[i] = 99.0; 00039 } 00040 m_chimin = 99.; 00041 m_pdfmin = 99.; 00042 m_ndof = 0; 00043 m_mass2 = -999; 00044 m_ph1 = -99; 00045 m_zhit1 = -99; 00046 }
|
|
|
|
|
|
|
|
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. 00024 {return (m_ndof > 0); }
|
|
Implements ParticleIDBase. 00024 {return (m_ndof > 0); }
|
|
Implements ParticleIDBase. 00041 {return -1;}
|
|
Implements ParticleIDBase. 00041 {return -1;}
|
|
00030 {return m_mass2;}
|
|
00030 {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. 00029 {return m_ndof;}
|
|
Implements ParticleIDBase. 00029 {return m_ndof;}
|
|
00035 {return -1;}
|
|
00035 {return -1;}
|
|
00040 { return -1;}
|
|
00040 { return -1;}
|
|
00027 {return m_offset[n];}
|
|
00027 {return m_offset[n];}
|
|
|
|
00123 { 00124 double offset; 00125 double gb = ptrk/xmass(n); 00126 double betagamma; 00127 switch(n) { 00128 00129 case 0: { // Electron 00130 offset = 0.0; 00131 return offset; 00132 } 00133 00134 case 1: { // Muon 00135 offset = 0.0; 00136 return offset; 00137 } 00138 00139 case 2: { // Pion 00140 betagamma=ptrk/139.57; 00141 break; 00142 } 00143 case 3: { // Kaon 00144 betagamma=ptrk/493.68; 00145 break; 00146 } 00147 00148 case 4: { // Proton 00149 betagamma=ptrk/938.27; 00150 break; 00151 } 00152 00153 default:{ 00154 offset = 0.0; 00155 return offset;} 00156 break; 00157 } 00158 double Q = ph1; 00159 z=z/1000.0; 00160 double beta = betagamma / TMath::Sqrt(1 + betagamma*betagamma); 00161 double Q0 = sampleQ0(betagamma,beta); 00162 double func[15]={0.}; 00163 func[0]=1.;func[1]=1./sqrt(Q);func[2]=z/sqrt(Q); 00164 func[3]=z*z/sqrt(Q);func[4]=Q;func[5]=Q*Q; 00165 func[6]=Q*Q*Q;func[7]=1./(0.84*0.84+z*z);func[8]=z; 00166 func[9]=z*z;func[10]=z*z*z;func[11]=1./sqrt(Q0); 00167 func[12]=z/sqrt(Q0);func[13]=z*z/sqrt(Q0);func[14]=z*z*z/sqrt(Q0); 00168 offset=0.; 00169 for(int i=0;i<15;i++){ 00170 offset+= m_pars[i]*func[i]; 00171 } 00172 00173 return offset; 00174 }
|
|
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. 00052 { 00053 int irc = -1; 00054 00055 EvtRecTrack* recTrk = PidTrk(); 00056 if(!(recTrk->isMdcTrackValid())) return irc; 00057 RecMdcTrack* mdcTrk = recTrk->mdcTrack(); 00058 double ptrk = mdcTrk->p(); 00059 double charge = mdcTrk->charge(); 00060 double cost = cos(mdcTrk->theta()); 00061 if(!(recTrk->isTofTrackValid())) return irc; 00062 SmartRefVector<RecTofTrack> tofTrk = recTrk->tofTrack(); 00063 SmartRefVector<RecTofTrack>::iterator it;//=tofTrk.begin(); 00064 TofHitStatus *hitst = new TofHitStatus; 00065 std::vector<int> tof1count; 00066 int goodtof1trk=0; 00067 for(it = tofTrk.begin();it!=tofTrk.end();it++,goodtof1trk++){ 00068 unsigned int st = (*it)->status(); 00069 hitst->setStatus(st); 00070 if( !(hitst->is_barrel()) ) continue; 00071 if( !(hitst->is_counter()) ) continue; 00072 if( hitst->layer()==1 ) tof1count.push_back(goodtof1trk); 00073 } 00074 delete hitst; 00075 if(tof1count.size()!=1) return irc;//not tof2 track or more than 1 tracks 00076 it = tofTrk.begin()+tof1count[0]; 00077 double tof = (*it)->tof(); 00078 m_tof1 = tof; 00079 int qual = (*it)->quality(); 00080 // if(qual != 1) return irc; 00081 int cntr = (*it)->tofID(); 00082 double path = ((*it)->path())*10.0;//the unit from mm to cm 00083 m_path1 = path; 00084 m_ph1 = (*it)->ph(); //no change 00085 m_zhit1 = ((*it)->zrhit())*10;//the unit from mm to cm 00086 double beta2 = path*path/velc()/velc()/tof/tof; 00087 m_mass2 = ptrk * ptrk * (1/beta2 -1); 00088 if ((m_mass2>20)||(m_mass2<-1)) return irc; 00089 if(tof <=0 ) return irc; 00090 double chitemp = 99.; 00091 double pdftemp = 0; 00092 double sigma_tmp= (*it)->sigma(0); 00093 for(int i = 0; i < 5; i++) { 00094 00095 m_offset[i] = tof - (*it)->texp(i)-(*it)->toffset(i);//- offsetTof1(i, cntr, ptrk, m_zhit1, m_ph1,charge); 00096 if(sigma_tmp!=0) { 00097 m_sigma[i] = 1.2*sigma_tmp; 00098 if(i<2) m_sigma[i]=sigma_tmp; 00099 } 00100 else m_sigma[i]=sigmaTof1(i, cntr,ptrk,m_zhit1, m_ph1,charge); 00101 m_chi[i] = m_offset[i]/m_sigma[i]; 00102 00103 if(fabs(m_chi[i]) < chitemp) chitemp = fabs(m_chi[i]); 00104 double ppp = pdfCalculate(m_chi[i],1); 00105 if(fabs(ppp) > pdftemp) pdftemp = fabs(ppp); 00106 } 00107 m_chimin = chitemp; 00108 m_pdfmin = pdftemp; 00109 if(pdftemp < pdfCalculate(pdfMinSigmaCut(),1)) return irc; 00110 if(fabs(m_chimin) > chiMinCut()) return irc; 00111 for(int i = 0; i < 5; i++){ 00112 m_prob[i] = probCalculate(m_chi[i]*m_chi[i], 1); 00113 } 00114 irc = 0; 00115 return irc; 00116 }
|
|
00033 {return m_path1;}
|
|
00033 {return m_path1;}
|
|
|
|
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;}
|
|
00031 {return m_ph1;}
|
|
00031 {return m_ph1;}
|
|
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. 00026 {return m_prob[n];}
|
|
Implements ParticleIDBase. 00026 {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 }
|
|
|
|
00217 { 00218 double val = 0.261/ TMath::Power(beta, 1.96) *( 5.43- TMath::Power(beta, 1.96) -TMath::Log(1.12 + TMath::Power(1/betagamma, 0.386))); 00219 return val*100.; 00220 }
|
|
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;}
|
|
00028 {return m_sigma[n];}
|
|
00028 {return m_sigma[n];}
|
|
|
|
00176 { 00177 double sigma; 00178 double gb = ptrk/xmass(n); 00179 double cosz = cos(ztof/1000.0); 00180 00181 switch(n) { 00182 00183 case 0: { // Electron 00184 sigma = 0.132405-0.135638*cosz+0.105528*cosz*cosz; 00185 break; 00186 } 00187 00188 case 1: { // Muon 00189 sigma = 0.164057 -0.199648*cosz+ 0.139481*cosz*cosz; 00190 break; 00191 } 00192 00193 case 2: { // Pion 00194 sigma = 0.132943-0.0996678*cosz+0.0785578*cosz*cosz; 00195 break; 00196 } 00197 case 3: { // Kaon 00198 sigma = 0.146572 -0.124672*cosz+0.0920656*cosz*cosz; 00199 break; 00200 } 00201 00202 case 4: { // Proton 00203 sigma = 0.1513 -0.0806081*cosz+0.0607409*cosz*cosz; 00204 break; 00205 } 00206 00207 default: 00208 sigma = 0.100; 00209 break; 00210 } 00211 sigma = 0.110; 00212 //sigma = 1.0; 00213 return sigma; 00214 }
|
|
00034 {return m_tof1;}
|
|
00034 {return m_tof1;}
|
|
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 }
|
|
00032 {return m_zhit1;}
|
|
00032 {return m_zhit1;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|