BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Analysis/ParticleID/include/ParticleID/ParticleIDBase.h
Go to the documentation of this file.
1#ifndef ParticleID_ParticleIDBase_H
2#define ParticleID_ParticleIDBase_H
3//
4// define the standard interface of ParticleID package
5// PID-sys includes: dE/dx, TOF endcap, TOF barrel inner, TOF barrel outer,
6// TOF Q, EMC energy deposition and Maybe Muon counter
7// the development of particle ID package should follow the rule defined
8// in this class.
9//
10// Author: K.L. He 11/11/2005, created
11//
12//
13#include <string>
14
15#ifndef BEAN
16# include "EvtRecEvent/EvtRecTrack.h"
17#else
18# include "DstEvtRecTracks.h"
19#endif
20
22
23public:
25 virtual ~ParticleIDBase() { ; }
26
27 virtual void init() = 0;
28 virtual void calculate() = 0;
29 virtual bool IsPidInfoValid() const = 0;
30 virtual double chi( int n ) const = 0;
31 virtual double prob( int n ) const = 0;
32 virtual int ndof() const = 0;
33 // virtual int neuronPID() const = 0; //neuron pid
34
35 EvtRecTrack* PidTrk() const { return m_trk; }
36 void setRecTrack( EvtRecTrack* trk ) { m_trk = trk; }
37 double chiMinCut() const { return m_chimin_cut; }
38 void setChiMinCut( const double chi = 4 ) { m_chimin_cut = chi; }
39 double chiMaxCut() const { return m_chimax_cut; }
40 void setChiMaxCut( const double chi = 6 ) { m_chimax_cut = chi; }
41 double pdfMinSigmaCut() const { return m_pdfsigmamin_cut; }
42 void setPdfMinSigmaCut( const double pdf = 4 ) { m_pdfsigmamin_cut = pdf; }
43 double getRunNo() const { return m_runno; }
44 void setRunNo( const double runh = 8093 ) { m_runno = runh; }
45
46 double p();
47 double pt();
48 double charge();
49
50public: // utilities
51 double xmass( int n );
52 double velc();
53 double probCalculate( double chi2, int n );
54 double pdfCalculate( double offset, double sigma );
55 double interpolation( double* x, double* y, double x1 );
56 double pol2( double x, double* par );
57 double pol3( double x, double* par );
58 double pol4( double x, double* par );
59
60public: // specific sub pid sys
61 int useDedx() const { return USE_DEDX; }
62 int useTof() const { return USE_TOF; }
63 int useTof1() const { return USE_TOF1; }
64 int useTof2() const { return USE_TOF2; }
65 int useTofE() const { return USE_TOFE; }
66 int useTofQ() const { return USE_TOFQ; }
67 int useTofC() const { return USE_TOFC; }
68 int useTofCorr() const { return USE_TOFCorr; }
69 int useEmc() const { return USE_EMC; }
70 int useMuc() const { return USE_MUC; }
71
72public: // identify which kind of particles
73 int onlyPionKaon() const { return ( IDENTIFY_PION | IDENTIFY_KAON ); }
74 int onlyPionKaonProton() const {
75 return ( IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON );
76 }
78 return ( IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_ELECTRON );
79 }
80 int all() const {
81 return ( IDENTIFY_ELECTRON | IDENTIFY_PION | IDENTIFY_KAON | IDENTIFY_PROTON );
82 }
83 int onlyElectron() const { return IDENTIFY_ELECTRON; }
84 int onlyMuon() const { return IDENTIFY_MUON; }
85 int onlyPion() const { return IDENTIFY_PION; }
86 int onlyKaon() const { return IDENTIFY_KAON; }
87 int onlyProton() const { return IDENTIFY_PROTON; }
88
89public: // Particle ID method
90 int methodLikelihood() const { return LIKELIHOOD_PID; }
91 int methodProbability() const { return PROBABILITY_PID; }
92 int methodNeuronNetwork() const { return NEURONNETWORK_PID; }
93
94public: //
95 int dedxValid() const { return DEDX_VALID; }
96 int tofValid() const { return TOF_VALID; }
97 int tofeValid() const { return TOFE_VALID; }
98 int tofqValid() const { return TOFQ_VALID; }
99 int tofcValid() const { return TOFC_VALID; }
100 int tofcorrValid() const { return TOFCorr_VALID; }
101 int emcValid() const { return EMC_VALID; }
102 int mucValid() const { return MUC_VALID; }
103
104protected:
105 // path to dir with calibration/configuration/etc data
106 static std::string path;
107
108public:
109 void set_path( const char* s_path = 0 );
110 void set_path( std::string s_path ) { path = s_path; }
111
112protected:
113 // PID calculation routines(include PID correction)
114 virtual int particleIDCalculation() = 0;
115 // virtual int neuronPIDCalculation() = 0;
116 // huangb add
117 virtual int LikelihoodCalculation() = 0;
118
119private:
120 EvtRecTrack* m_trk;
121 double m_runno;
122 double m_chimin_cut, m_chimax_cut;
123 double m_pdfsigmamin_cut; // the cut is multiple of the sigma. ie. if(m_pdfsigmamin_cut ==3),
124 // the cut is 3sigma
125 static const int USE_DEDX;
126 static const int USE_TOF1;
127 static const int USE_TOF2;
128 static const int USE_TOF;
129 static const int USE_TOFE;
130 static const int USE_TOFQ;
131 static const int USE_TOFC;
132 static const int USE_TOFCorr;
133 static const int USE_EMC;
134 static const int USE_MUC;
135
136 static const int IDENTIFY_ELECTRON;
137 static const int IDENTIFY_MUON;
138 static const int IDENTIFY_PION;
139 static const int IDENTIFY_KAON;
140 static const int IDENTIFY_PROTON;
141
142 static const int PROBABILITY_PID;
143 static const int LIKELIHOOD_PID;
144 static const int NEURONNETWORK_PID;
145
146 static const int DEDX_VALID;
147 static const int TOF_VALID;
148 static const int TOF1_VALID;
149 static const int TOF2_VALID;
150 static const int TOFE_VALID;
151 static const int TOFQ_VALID;
152 static const int TOFC_VALID;
153 static const int TOFCorr_VALID;
154 static const int EMC_VALID;
155 static const int MUC_VALID;
156};
157
158#endif
const Int_t n
const double xmass[5]
Definition Gam4pikp.cxx:35
double pol2(double x, double *par)
virtual int ndof() const =0
double interpolation(double *x, double *y, double x1)
virtual void init()=0
double probCalculate(double chi2, int n)
virtual double chi(int n) const =0
double pol4(double x, double *par)
double pol3(double x, double *par)
double pdfCalculate(double offset, double sigma)
virtual int LikelihoodCalculation()=0
virtual int particleIDCalculation()=0
virtual void calculate()=0
virtual bool IsPidInfoValid() const =0
virtual double prob(int n) const =0
void set_path(const char *s_path=0)