BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/ParticleID/ParticleID/ParticleID.h
Go to the documentation of this file.
1#ifndef ParticleID_ParticleID_H
2#define ParticleID_ParticleID_H
3
4//
5// ParticleID package: particle identification with combined info from
6// dE/dx, TOF, TOFQ ,Muc and Emc system.
7//
8// How to Use:
9// +++++++++++++++++++++++++++++++++++++++++
10// ParticleID *pid = 0;
11// for (int i = 0; i < ncharg; i++) {
12// if(pid) delete pid;
13// pid = new ParticleID(dstTrk);
14// pid->usePidSys(pid->useDedx() | pid->useTof1() | pid->useTof2() | ...);
15// pid->identify(pid->onlyPionKaon()); // pid->onlyPionKaonProton(), etc
16// pid->calculate();
17// if(!(pid->IsPidInfoValid())) continue;
18// // user's selections
19// }
20// if(pid) delete pid;
21// -----------------------------------------
22//
23// Author: K.L.He & L.L. Wang & Gang.Qin 01/07/2007, created
24//
25
26#include "ParticleID/ParticleIDBase.h"
27#include "ParticleID/DedxPID.h"
28#include "ParticleID/TofPID.h"
29#include "ParticleID/TofEPID.h"
30#include "ParticleID/TofQPID.h"
31#include "ParticleID/TofCPID.h"
32#include "ParticleID/TofCorrPID.h"
33#include "ParticleID/EmcPID.h"
34#include "ParticleID/MucPID.h"
35
36class ParticleID : public ParticleIDBase{
37
38 public:
39
42
43 void init();
44 //
45 // PID info from each sub system
46 //
47 // Is Pid subsys info Valid
48 inline bool IsDedxInfoValid() const;
49 inline bool IsTofInfoValid() const;
50 inline bool IsTofEInfoValid() const;
51 inline bool IsTofQInfoValid() const;
52 inline bool IsTofCInfoValid() const;
53 inline bool IsTofCorrInfoValid() const;
54 inline bool IsEmcInfoValid() const;
55 inline bool IsMucInfoValid() const;
56 // get subsys Chi
57 inline double chiDedx(int n) const;
58 inline double chiTof(int n) const;
59 inline double chiTof1(int n) const;
60 inline double chiTof2(int n) const;
61 inline double chiTofE(int n) const;
62 inline double chiTofQ(int n) const;
63 inline double chiTofC(int n) const;
64 inline double chiTofCorr(int n) const;
65 inline double chiEmc(int n) const;
66 inline double chiMuc(int n) const;
67 // get subsys Prob
68 inline double probDedx(int n) const;
69 inline double probTof(int n) const;
70 inline double probTofE(int n) const;
71 inline double probTofQ(int n) const;
72 inline double probTofC(int n) const;
73 inline double probTofCorr(int n) const;
74 inline double probEmc(int n) const;
75 inline double probMuc(int n) const;
76 //huangb add
77// get the subsys Pdf
78 inline double pdfDedx(int n);
79 inline double pdfTof(int n);
80 inline double pdfTofE(int n);
81 inline double pdfTofQ(int n);
82 inline double pdfTofC(int n);
83 inline double pdfTofCorr(int n);
84 inline double pdfEmc(int n);
85 inline double pdfMuc(int n);
86
87
88 int getNhitCut() const {return m_nhitcut;}
89 void setNhitCut(const int nhitcuth = 5) {m_nhitcut = nhitcuth;}
90
91 // setMethod(methodProbability());
92 // setMethod(methodLikelihood());
93 // setMethod(methodNeuronNetwork());
94 void setMethod(const int method) {m_method = (m_method | method);}
95 // specify sub pid sys
96 // accessed by useDedx() | useTof1() | useTof2() | useTofE() | useTofQ() | useEmc()
97 void usePidSys(const int pidsys) {m_pidsys = (m_pidsys | pidsys);}
98 // identify pi/K accessed by onlyPionKaon() or onlyPion() | onlyKaon()
99 // identify pi/K/p accessed by onlyPionKaonProton() or onlyPion() | onlyKaon() | onlyProton()
100 // identify pi/K/e accessed by onlyPionKaonElectron() or onlyPion() | onlyKaon() | onlyElectron()
101 // identify pi/K/e/p accessed by all()
102 // identify muon accessed by onlyMuon()
103 void identify(const int pidcase) {m_pidcase = (m_pidcase | pidcase);}
104 // Calculation
105 void calculate();
106#ifdef BEAN
107 void calculate(int run); // BEAN: use this instead of calculate()
108#endif
109
110 // output of ParticleID
111
112 inline bool IsPidInfoValid() const;
113 double chi(int n) const {return m_chisq[n];}
114 double prob(int n) const { return m_prob[n];}
115 int ndof() const {return m_ndof;}
116 // huangb add
117 //---------------------------------------
118 double pdf(int n) const { return m_pdf[n];}
119 double lhf(int n) const {return m_likelihoodfraction[n];}
120
121 double probElectron() const {return m_prob[0];}
122 double probMuon() const {return m_prob[1];}
123 double probPion() const {return m_prob[2];}
124 double probKaon() const {return m_prob[3];}
125 double probProton() const {return m_prob[4];}
126 int discard() const {return m_discard;}
127 //huangb add
128 //-------------------------------------------------------
129 double pdfElectron() const {return m_pdf[0];}
130 double pdfMuon() const {return m_pdf[1];}
131 double pdfPion() const {return m_pdf[2];}
132 double pdfKaon() const {return m_pdf[3];}
133 double pdfProton() const {return m_pdf[4];}
134 // Neuron Network PID
135/* int neuronPID() const {return m_neuronPid;}
136 int neuronStat() const {return m_neuronStat;}
137 double neuronVal() const {return m_neuronVal;}
138 void setCutEm_mu(double cut1, double cut2) {m_cut_em_mu[0]=cut1; m_cut_em_mu[1]=cut2;}
139
140 void setNeuronPidCuts();
141*/
142 //tricks for nn
143 //int neuronPID() const {return m_neuronPid;}
144 int neuronStat() const {return IsPidInfoValid();}
145 double neuronVal() const {
146 if(lhf(0)>0.02) return 1.0;
147 if(lhf(1)>0.02) return 8.5;
148 if(lhf(2)>0.02) return 2.0;
149 if(lhf(3)>0.02) return 4.0;
150 if(lhf(4)>0.02) return 5.0;
151 }
152// void setCutEm_mu(double cut1, double cut2) {m_cut_em_mu[0]=cut1; m_cut_em_mu[1]=cut2;}
153 int ipmt() {
154 return m_tofcorrpid->ipmt();
155 }
156 double dt(int ipar, int ipmt) {
157 return m_tofcorrpid->dt(ipar, ipmt);
158 }
159 double dtCorr(int ipar, int ipmt) {
160 return m_tofcorrpid->dtCorr(ipar, ipmt);
161 }
162 double sigCorr(int ipar, int ipmt) {
163 return m_tofcorrpid->sigCorr(ipar, ipmt);
164 }
165 double chiCorr(int ipar, int ipmt) {
166 return m_tofcorrpid->chiCorr(ipar, ipmt);
167 }
168 double offset(int ipar) {
169 return m_tofcorrpid->offset(ipar);
170 }
171 double sigma(int ipar) {
172 return m_tofcorrpid->sigma(ipar);
173 }
174
175 protected:
176
179 // Neuron Network PID
181 private:
182
183 bool IsDedxInfoUsed() const {return ((m_pidsys & useDedx()) == useDedx());}
184 bool IsTofInfoUsed() const {return ((m_pidsys & useTof()) == useTof());}
185 bool IsTof1InfoUsed() const {return ((m_pidsys & useTof1()) == useTof1());}
186 bool IsTof2InfoUsed() const {return ((m_pidsys & useTof2()) == useTof2());}
187 bool IsTofEInfoUsed() const {return ((m_pidsys & useTofE()) == useTofE());}
188 bool IsTofQInfoUsed() const {return ((m_pidsys & useTofQ()) == useTofQ());}
189 bool IsTofCInfoUsed() const {return ((m_pidsys & useTofC()) == useTofC());}
190 bool IsTofCorrInfoUsed() const {return ((m_pidsys & useTofCorr()) == useTofCorr());}
191 bool IsEmcInfoUsed() const {return ((m_pidsys & useEmc()) == useEmc());}
192 bool IsMucInfoUsed() const {return ((m_pidsys & useMuc()) == useMuc());}
193
194 private:
195
196 DedxPID* m_dedxpid;
197 TofEPID* m_tofepid;
198 TofPID* m_tofpid;
199 TofQPID* m_tofqpid;
200 TofCPID* m_tofcpid;
201 TofCorrPID* m_tofcorrpid;
202 EmcPID* m_emcpid;
203 MucPID* m_mucpid;
204 double m_chisq[5];
205 double m_prob[5];
206 //huangb add
207 double m_pdf[5];
208 double m_likelihoodfraction[5];
209 double m_TotalLikelihood;
210
211 int m_nhitcut;
212 double m_chicut;
213 int m_ndof;
214 int m_pidsys;
215 int m_pidcase;
216 int m_method;
217 int m_discard;
218
219
220
221 private:
222 //constructor & desconstructor
223 ParticleID();
224 static ParticleID *m_pointer;
225
226};
227
228#include "ParticleID/ParticleID.icc"
229
230#endif
const Int_t n
double chiMuc(int n) const
double pdfEmc(int n)
int neuronPIDCalculation()
double pdfTofC(int n)
double probEmc(int n) const
double probTof(int n) const
double chiTof2(int n) const
bool IsTofEInfoValid() const
bool IsEmcInfoValid() const
double pdfTofE(int n)
double pdfDedx(int n)
int LikelihoodCalculation()
double chiTofE(int n) const
double probTofCorr(int n) const
bool IsTofCorrInfoValid() const
bool IsTofCInfoValid() const
static ParticleID * instance()
bool IsTofInfoValid() const
double pdfTof(int n)
double chiTofQ(int n) const
double probTofC(int n) const
bool IsTofQInfoValid() const
int particleIDCalculation()
double probTofQ(int n) const
bool IsPidInfoValid() const
bool IsDedxInfoValid() const
double probDedx(int n) const
double chiTofC(int n) const
double pdfMuc(int n)
double chiTof1(int n) const
double pdfTofCorr(int n)
void calculate()
double chiEmc(int n) const
void init()
bool IsMucInfoValid() const
double chiTof(int n) const
double probTofE(int n) const
double pdfTofQ(int n)
double chiTofCorr(int n) const
double probMuc(int n) const
double chiDedx(int n) const