#include <MucPID.h>
Inheritance diagram for MucPID:
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 | chi2 () const |
double | chi2 () const |
double | chiMinCut () const |
double | chiMinCut () const |
int | dedxValid () const |
int | dedxValid () const |
double | delta_phi () const |
double | delta_phi () const |
double | depth () const |
double | depth () const |
double | distance () const |
double | distance () const |
int | emcValid () const |
int | emcValid () const |
double | getRunNo () const |
double | getRunNo () const |
double | hits () const |
double | hits () 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 |
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 |
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 | 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 () |
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) |
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 | val_muc1 () const |
double | val_muc1 () const |
double | velc () |
double | velc () |
double | xmass (int n) |
double | xmass (int n) |
Static Public Member Functions | |
MucPID * | instance () |
MucPID * | instance () |
Protected Member Functions | |
int | LikelihoodCalculation () |
int | LikelihoodCalculation () |
int | neuronPIDCalculation () |
int | neuronPIDCalculation () |
int | particleIDCalculation () |
int | particleIDCalculation () |
Private Member Functions | |
MucPID () | |
MucPID () | |
Private Attributes | |
double | m_chi [5] |
double | m_chi2 |
double | m_chimin |
double | m_depth |
double | m_distance |
double | m_hits |
double | m_m_h [13][400] |
TMultiLayerPerceptron * | m_mlp_muc |
TMultiLayerPerceptron * | m_mlp_muc |
TMLPAnalyzer * | m_mlpa_muc |
TMLPAnalyzer * | m_mlpa_muc |
double | m_muc_delta_phi |
int | m_ndof |
double | m_p_h [13][400] |
double | m_prob [5] |
TFile * | m_trainFile_muc |
TFile * | m_trainFile_muc |
TTree * | m_trainTree_muc |
TTree * | m_trainTree_muc |
double | m_val_muc |
double | params_muc1 [8] |
Static Private Attributes | |
MucPID * | m_pointer |
MucPID * | m_pointer |
|
00025 :ParticleIDBase(){ 00026 m_trainFile_muc = 0; 00027 m_trainTree_muc = 0; 00028 m_mlp_muc = 0; 00029 m_mlpa_muc = 0; 00030 //std::string pi_muc_file = "$PARTICLEIDROOT/share/pion_muc_hist.txt"; 00031 // std::string pi_muc_file = "/ihepbatch/bes/huangb/boss610/Analysis/ParticleID/ParticleID-00-02-03/share/pion_muc_hist.txt"; 00032 std::string pi_muc_file = string(getenv("PARTICLEIDROOT"))+"/share/pion_muc_hist.txt"; 00033 00034 ifstream input1(pi_muc_file.c_str(),std::ios_base::in); 00035 for(int i=0;i<13;i++){ 00036 for(int j=0;j<300;j++){ 00037 input1>>m_p_h[i][j]; 00038 } 00039 } 00040 00041 std::string mu_muc_file = string(getenv("PARTICLEIDROOT"))+"/share/muon_muc_hist.txt"; 00042 //std::string mu_muc_file = "$PARTICLEIDROOT/share/muon_muc_hist.txt"; 00043 // std::string mu_muc_file = "/ihepbatch/bes/huangb/boss610/Analysis/ParticleID/ParticleID-00-02-03/share/muon_muc_hist.txt"; 00044 ifstream input2(mu_muc_file.c_str(),std::ios_base::in); 00045 for(int i=0;i<13;i++){ 00046 for(int j=0;j<300;j++){ 00047 input2>>m_m_h[i][j]; 00048 } 00049 } 00050 00051 00052 00053 00054 }
|
|
|
|
00091 {return (IDENTIFY_ELECTRON | IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);}
|
|
00091 {return (IDENTIFY_ELECTRON | IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);}
|
|
Implements ParticleIDBase. |
|
Implements ParticleIDBase. 00090 { 00091 if(particleIDCalculation() == 0) m_ndof = 1; 00092 }
|
|
|
|
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];}
|
|
00029 {return m_chi2;}
|
|
00029 {return m_chi2;}
|
|
00052 {return m_chimin_cut;}
|
|
00052 {return m_chimin_cut;}
|
|
00103 {return DEDX_VALID;}
|
|
00103 {return DEDX_VALID;}
|
|
00031 {return m_muc_delta_phi;}
|
|
00031 {return m_muc_delta_phi;}
|
|
00028 {return m_depth;}
|
|
00028 {return m_depth;}
|
|
00030 {return m_distance;}
|
|
00030 {return m_distance;}
|
|
00108 {return EMC_VALID;}
|
|
00108 {return EMC_VALID;}
|
|
00056 {return m_runno;}
|
|
00056 {return m_runno;}
|
|
00027 {return m_hits;}
|
|
00027 {return m_hits;}
|
|
Implements ParticleIDBase. |
|
Implements ParticleIDBase. 00056 { 00057 for(int i = 0; i < 5; i++) { 00058 m_chi[i] = 99.0; 00059 m_prob[i] = -1.0; 00060 } 00061 m_chimin = 99.; 00062 m_ndof = 0; 00063 m_hits = -99; 00064 m_depth = -999; 00065 m_val_muc=-99; 00066 00067 std::string neural = string(getenv("PARTICLEIDROOT"))+"/share/neural.root"; 00068 std::string muc = string(getenv("PARTICLEIDROOT"))+"/share/muc.txt"; 00069 double ptrk,phi,theta,depth,hits,chi2,distance,muc_delta_phi; 00070 int type; 00071 if(!m_trainTree_muc){ 00072 m_trainTree_muc = new TTree("m_trainTree_muc","m_trainTree_muc"); 00073 m_trainTree_muc->Branch("ptrk",&ptrk,"ptrk/D"); 00074 m_trainTree_muc->Branch("phi",&phi,"phi/D"); 00075 m_trainTree_muc->Branch("theta",&theta,"theta/D"); 00076 m_trainTree_muc->Branch("depth",&depth,"depth/D"); 00077 m_trainTree_muc->Branch("hits",&hits,"hits/D"); 00078 m_trainTree_muc->Branch("chi2",&chi2,"chi2/D"); 00079 m_trainTree_muc->Branch("distance",&distance,"distance/D"); 00080 m_trainTree_muc->Branch("muc_delta_phi",&muc_delta_phi,"muc_delta_phi/D"); 00081 m_trainTree_muc->Branch("type",&type,"type/I"); 00082 } 00083 if(!m_mlp_muc) { 00084 m_mlp_muc = new TMultiLayerPerceptron("@ptrk,@phi,@theta,@depth,@hits,@chi2,@distance,@muc_delta_phi:16:type",m_trainTree_muc); 00085 m_mlp_muc->LoadWeights(muc.c_str()); 00086 } 00087 }
|
|
|
|
|
|
|
|
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. 00041 {return -1;}
|
|
Implements ParticleIDBase. 00041 {return -1;}
|
|
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. 00026 {return m_ndof;}
|
|
Implements ParticleIDBase. 00026 {return m_ndof;}
|
|
00034 {return -1;}
|
|
00034 {return -1;}
|
|
00040 {return -1;}
|
|
00040 {return -1;}
|
|
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. 00094 { 00095 int irc = -1; 00096 EvtRecTrack* recTrk = PidTrk(); 00097 if(!(recTrk->isMdcTrackValid())) return irc; 00098 RecMdcTrack* mdcTrk = recTrk->mdcTrack(); 00099 00100 m_depth = -99; 00101 m_hits = -99; 00102 m_chi2 =-99; 00103 m_distance =-99; 00104 m_muc_delta_phi =-99; 00105 00106 double ptrk = mdcTrk->p(); 00107 double m_ptrk = ptrk; 00108 double m_pt = mdcTrk->pxy(); 00109 double phi = mdcTrk->phi(); 00110 double theta = mdcTrk->theta(); 00111 double cost = cos(mdcTrk->theta()); 00112 if(ptrk<0.5) return irc; 00113 if(fabs(cost)>0.83) return irc; 00114 if(!(recTrk->isExtTrackValid())) return irc; 00115 RecExtTrack* extTrk = recTrk->extTrack(); 00116 if(extTrk->mucVolumeNumber() == -1) return irc; 00117 if (!(recTrk->isMucTrackValid())) return irc; 00118 RecMucTrack* mucTrk = recTrk->mucTrack(); 00119 00120 // if(mucTrk->maxHitsInLayer()< 0) return irc; 00121 if(mucTrk->depth()>100000) return irc; 00122 00123 m_hits = mucTrk->maxHitsInLayer(); 00124 m_depth = mucTrk->depth(); 00125 m_distance = mucTrk->distance(); 00126 m_chi2 = mucTrk->chi2(); 00127 /* Hep3Vector phi_muc; 00128 phi_muc.set(mucTrk->xPos(),mucTrk->yPos(),0); 00129 Hep3Vector phi_mdc; 00130 phi_mdc.set(mdcTrk->px(),mdcTrk->py(),0); 00131 m_muc_delta_phi = phi_muc.angle(phi_mdc); 00132 if(m_muc_delta_phi<0) m_muc_delta_phi = -m_muc_delta_phi; */ 00133 m_muc_delta_phi= mucTrk->deltaPhi(); 00134 m_muc_delta_phi=3.14159-m_muc_delta_phi; 00135 theta = cos(theta); 00136 params_muc1[0] = m_ptrk; 00137 params_muc1[1] = phi; 00138 params_muc1[2] = theta; 00139 params_muc1[3] = m_depth; 00140 params_muc1[4] = m_hits; 00141 params_muc1[5] = m_chi2; 00142 params_muc1[6] = m_distance; 00143 params_muc1[7] = m_muc_delta_phi; 00144 00145 m_val_muc = m_mlp_muc->Evaluate(0,params_muc1); 00146 if(m_pt<0) m_pt = -m_pt; 00147 int pindex = int((m_ptrk-0.5)/0.1); 00148 int bindex = int((m_val_muc-0.5)/0.01); 00149 if(bindex>300||bindex<0) return irc; 00150 if(pindex>11) pindex=11; 00151 if(pindex<0) pindex=0; 00152 m_prob[0] = m_p_h[pindex][bindex];; 00153 m_prob[1] = m_m_h[pindex][bindex]; 00154 m_prob[2] = m_p_h[pindex][bindex]; 00155 m_prob[3] = m_p_h[pindex][bindex]; 00156 m_prob[4] = m_p_h[pindex][bindex]; 00157 for(int i =0;i<5;i++){ 00158 if(m_prob[i]==0) m_prob[i] = 0.001; 00159 } 00160 float ppp[5]; 00161 for(int i =0;i<5;i++){ 00162 ppp[i] = 0.0; 00163 } 00164 00165 for(int j=0;j<bindex;j++){ 00166 ppp[1]+= m_m_h[pindex][j]*0.01; 00167 ppp[2]+= m_p_h[pindex][j]*0.01; 00168 } 00169 if(ppp[1]>0&&ppp[1]<1) 00170 CALG(ppp[1],m_chi[1]); 00171 if(ppp[2]>0&&ppp[2]<1) 00172 CALG(ppp[2],m_chi[2]); 00173 if(ppp[1]<=0||ppp[1]>=1) 00174 m_chi[1]=-99; 00175 if(ppp[2]<=0||ppp[2]>=1) 00176 m_chi[2]=-99; 00177 00178 m_chi[3]=m_chi[2]; 00179 m_chi[4]=m_chi[2]; 00180 m_chi[0] =m_chi[2]; 00181 m_ndof = 1; 00182 irc = 0; 00183 return irc; 00184 }
|
|
|
|
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. 00025 {return m_prob[n];}
|
|
Implements ParticleIDBase. 00025 {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 }
|
|
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;}
|
|
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;}
|
|
00032 {return m_val_muc;}
|
|
00032 {return m_val_muc;}
|
|
|
|
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 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|