00001 #ifndef ParticleID_ParticleIDBase_H 00002 #define ParticleID_ParticleIDBase_H 00003 // 00004 // define the standard interface of ParticleID package 00005 // PID-sys includes: dE/dx, TOF endcap, TOF barrel inner, TOF barrel outer, 00006 // TOF Q, EMC energy deposition and Maybe Muon counter 00007 // the development of particle ID package should follow the rule defined 00008 // in this class. 00009 // 00010 // Author: K.L. He 11/11/2005, created 00011 // 00012 // 00013 #include <string> 00014 00015 #ifndef BEAN 00016 #include "EvtRecEvent/EvtRecTrack.h" 00017 #else 00018 #include "DstEvtRecTracks.h" 00019 #endif 00020 00021 class ParticleIDBase { 00022 00023 public: 00024 00025 ParticleIDBase(); 00026 virtual ~ParticleIDBase(){;} 00027 00028 virtual void init() = 0; 00029 virtual void calculate() = 0; 00030 virtual bool IsPidInfoValid() const = 0; 00031 virtual double chi(int n) const = 0; 00032 virtual double prob(int n) const = 0; 00033 virtual int ndof() const = 0; 00034 // virtual int neuronPID() const = 0; //neuron pid 00035 00036 EvtRecTrack* PidTrk() const {return m_trk;} 00037 void setRecTrack(EvtRecTrack* trk) {m_trk = trk;} 00038 double chiMinCut() const {return m_chimin_cut;} 00039 void setChiMinCut(const double chi = 4) {m_chimin_cut = chi;} 00040 double chiMaxCut() const {return m_chimax_cut;} 00041 void setChiMaxCut(const double chi = 6) {m_chimax_cut = chi;} 00042 double pdfMinSigmaCut() const {return m_pdfsigmamin_cut;} 00043 void setPdfMinSigmaCut(const double pdf =4) {m_pdfsigmamin_cut= pdf;} 00044 double getRunNo() const {return m_runno;} 00045 void setRunNo(const double runh = 8093) {m_runno = runh;} 00046 00047 double p(); 00048 double pt(); 00049 double charge(); 00050 00051 public: // utilities 00052 00053 double xmass(int n); 00054 double velc(); 00055 double probCalculate(double chi2, int n); 00056 double pdfCalculate(double offset,double sigma); 00057 double interpolation(double* x, double* y,double x1); 00058 double pol2(double x,double* par); 00059 double pol3(double x,double* par); 00060 double pol4(double x,double* par); 00061 00062 public: // specific sub pid sys 00063 00064 int useDedx() const {return USE_DEDX;} 00065 int useTof() const {return USE_TOF;} 00066 int useTof1() const {return USE_TOF1;} 00067 int useTof2() const {return USE_TOF2;} 00068 int useTofE() const {return USE_TOFE;} 00069 int useTofQ() const {return USE_TOFQ;} 00070 int useTofC() const {return USE_TOFC;} 00071 int useTofCorr() const {return USE_TOFCorr;} 00072 int useEmc() const {return USE_EMC;} 00073 int useMuc() const {return USE_MUC;} 00074 00075 public: // identify which kind of particles 00076 int onlyPionKaon() const {return (IDENTIFY_PION | IDENTIFY_KAON);} 00077 int onlyPionKaonProton() const {return (IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);} 00078 int onlyPionKaonElectron() const {return (IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_ELECTRON);} 00079 int all() const {return (IDENTIFY_ELECTRON | IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON);} 00080 int onlyElectron() const {return IDENTIFY_ELECTRON;} 00081 int onlyMuon() const {return IDENTIFY_MUON;} 00082 int onlyPion() const {return IDENTIFY_PION;} 00083 int onlyKaon() const {return IDENTIFY_KAON;} 00084 int onlyProton() const {return IDENTIFY_PROTON;} 00085 00086 public: // Particle ID method 00087 int methodLikelihood() const {return LIKELIHOOD_PID;} 00088 int methodProbability() const {return PROBABILITY_PID;} 00089 int methodNeuronNetwork() const {return NEURONNETWORK_PID;} 00090 public: // 00091 int dedxValid() const {return DEDX_VALID;} 00092 int tofValid() const {return TOF_VALID;} 00093 int tofeValid() const {return TOFE_VALID;} 00094 int tofqValid() const {return TOFQ_VALID;} 00095 int tofcValid() const {return TOFC_VALID;} 00096 int tofcorrValid() const {return TOFCorr_VALID;} 00097 int emcValid() const {return EMC_VALID;} 00098 int mucValid() const {return MUC_VALID;} 00099 00100 protected: 00101 // path to dir with calibration/configuration/etc data 00102 static std::string path; 00103 public: 00104 void set_path(const char* s_path = 0); 00105 void set_path(std::string s_path) {path = s_path;} 00106 00107 protected: 00108 // PID calculation routines(include PID correction) 00109 virtual int particleIDCalculation() = 0; 00110 // virtual int neuronPIDCalculation() = 0; 00111 //huangb add 00112 virtual int LikelihoodCalculation() =0; 00113 00114 private: 00115 EvtRecTrack* m_trk; 00116 double m_runno; 00117 double m_chimin_cut, m_chimax_cut; 00118 double m_pdfsigmamin_cut; //the cut is multiple of the sigma. ie. if(m_pdfsigmamin_cut ==3), the cut is 3sigma 00119 static const int USE_DEDX; 00120 static const int USE_TOF1; 00121 static const int USE_TOF2; 00122 static const int USE_TOF; 00123 static const int USE_TOFE; 00124 static const int USE_TOFQ; 00125 static const int USE_TOFC; 00126 static const int USE_TOFCorr; 00127 static const int USE_EMC; 00128 static const int USE_MUC; 00129 00130 static const int IDENTIFY_ELECTRON; 00131 static const int IDENTIFY_MUON; 00132 static const int IDENTIFY_PION; 00133 static const int IDENTIFY_KAON; 00134 static const int IDENTIFY_PROTON; 00135 00136 static const int PROBABILITY_PID; 00137 static const int LIKELIHOOD_PID; 00138 static const int NEURONNETWORK_PID; 00139 00140 static const int DEDX_VALID; 00141 static const int TOF_VALID; 00142 static const int TOF1_VALID; 00143 static const int TOF2_VALID; 00144 static const int TOFE_VALID; 00145 static const int TOFQ_VALID; 00146 static const int TOFC_VALID; 00147 static const int TOFCorr_VALID; 00148 static const int EMC_VALID; 00149 static const int MUC_VALID; 00150 }; 00151 00152 #endif