BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
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
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"
33#include "ParticleID/EmcPID.h"
34#include "ParticleID/MucPID.h"
35
37
38 public:
39
40 static ParticleID *instance();
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 double offset(int i) {
154 return m_tofcorrpid->offset(i);
155 }
156 double sigma(int i) {
157 return m_tofcorrpid->sigma(i);
158 }
159
160 protected:
161
164 // Neuron Network PID
166 private:
167
168 bool IsDedxInfoUsed() const {return ((m_pidsys & useDedx()) == useDedx());}
169 bool IsTofInfoUsed() const {return ((m_pidsys & useTof()) == useTof());}
170 bool IsTof1InfoUsed() const {return ((m_pidsys & useTof1()) == useTof1());}
171 bool IsTof2InfoUsed() const {return ((m_pidsys & useTof2()) == useTof2());}
172 bool IsTofEInfoUsed() const {return ((m_pidsys & useTofE()) == useTofE());}
173 bool IsTofQInfoUsed() const {return ((m_pidsys & useTofQ()) == useTofQ());}
174 bool IsTofCInfoUsed() const {return ((m_pidsys & useTofC()) == useTofC());}
175 bool IsTofCorrInfoUsed() const {return ((m_pidsys & useTofCorr()) == useTofCorr());}
176 bool IsEmcInfoUsed() const {return ((m_pidsys & useEmc()) == useEmc());}
177 bool IsMucInfoUsed() const {return ((m_pidsys & useMuc()) == useMuc());}
178
179 private:
180
181 DedxPID* m_dedxpid;
182 TofEPID* m_tofepid;
183 TofPID* m_tofpid;
184 TofQPID* m_tofqpid;
185 TofCPID* m_tofcpid;
186 TofCorrPID* m_tofcorrpid;
187 EmcPID* m_emcpid;
188 MucPID* m_mucpid;
189 double m_chisq[5];
190 double m_prob[5];
191 //huangb add
192 double m_pdf[5];
193 double m_likelihoodfraction[5];
194 double m_TotalLikelihood;
195
196 int m_nhitcut;
197 double m_chicut;
198 int m_ndof;
199 int m_pidsys;
200 int m_pidcase;
201 int m_method;
202 int m_discard;
203
204
205
206 private:
207 //constructor & desconstructor
208 ParticleID();
209 static ParticleID *m_pointer;
210
211};
212
213#include "ParticleID/ParticleID.icc"
214
215#endif
const Int_t n
Definition: EmcPID.h:16
Definition: MucPID.h:20
int useTofCorr() const
int useTof2() const
int useTofE() const
int useTof() const
int useTofQ() const
int useDedx() const
int useTofC() const
int useTof1() const
int useEmc() const
int useMuc() const
double chiMuc(int n) const
double pdfEmc(int n)
int neuronPIDCalculation()
double probKaon() const
Definition: ParticleID.h:124
double pdfTofC(int n)
void setMethod(const int method)
Definition: ParticleID.h:94
int discard() const
Definition: ParticleID.h:126
double probEmc(int n) const
double prob(int n) const
Definition: ParticleID.h:114
double probTof(int n) const
double chiTof2(int n) const
int getNhitCut() const
Definition: ParticleID.h:88
double offset(int i)
Definition: ParticleID.h:153
double chi(int n) const
Definition: ParticleID.h:113
bool IsTofEInfoValid() const
double pdfProton() const
Definition: ParticleID.h:133
bool IsEmcInfoValid() const
double pdfTofE(int n)
double pdfDedx(int n)
int LikelihoodCalculation()
Definition: ParticleID.cxx:426
double chiTofE(int n) const
double probTofCorr(int n) const
bool IsTofCorrInfoValid() const
double neuronVal() const
Definition: ParticleID.h:145
bool IsTofCInfoValid() const
double sigma(int i)
Definition: ParticleID.h:156
bool IsTofInfoValid() const
void identify(const int pidcase)
Definition: ParticleID.h:103
double pdfPion() const
Definition: ParticleID.h:131
double probMuon() const
Definition: ParticleID.h:122
double probElectron() const
Definition: ParticleID.h:121
int ndof() const
Definition: ParticleID.h:115
void usePidSys(const int pidsys)
Definition: ParticleID.h:97
double pdfTof(int n)
void setNhitCut(const int nhitcuth=5)
Definition: ParticleID.h:89
double chiTofQ(int n) const
double probTofC(int n) const
bool IsTofQInfoValid() const
int particleIDCalculation()
Definition: ParticleID.cxx:250
static ParticleID * instance()
Definition: ParticleID.cxx:22
double probTofQ(int n) const
bool IsPidInfoValid() const
bool IsDedxInfoValid() const
double probDedx(int n) const
double probPion() const
Definition: ParticleID.h:123
double chiTofC(int n) const
int neuronStat() const
Definition: ParticleID.h:144
double pdfMuc(int n)
double lhf(int n) const
Definition: ParticleID.h:119
double chiTof1(int n) const
double pdfTofCorr(int n)
void calculate()
Definition: ParticleID.cxx:94
double chiEmc(int n) const
double pdfKaon() const
Definition: ParticleID.h:132
void init()
Definition: ParticleID.cxx:27
double probProton() const
Definition: ParticleID.h:125
bool IsMucInfoValid() const
double pdfElectron() const
Definition: ParticleID.h:129
double pdf(int n) const
Definition: ParticleID.h:118
double chiTof(int n) const
double pdfMuon() const
Definition: ParticleID.h:130
double probTofE(int n) const
double pdfTofQ(int n)
double chiTofCorr(int n) const
double probMuc(int n) const
double chiDedx(int n) const
double sigma(int n) const
Definition: TofCorrPID.h:27
double offset(int n) const
Definition: TofCorrPID.h:26
Definition: TofPID.h:17