CGEM BOSS 6.6.5.i
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#include "ParticleID/MrpcPID.h"
36
38
39 public:
40
41 static ParticleID *instance();
43
44 void init();
45 //
46 // PID info from each sub system
47 //
48 // Is Pid subsys info Valid
49 inline bool IsDedxInfoValid() const;
50 inline bool IsTofInfoValid() const;
51 inline bool IsTofEInfoValid() const;
52 inline bool IsTofQInfoValid() const;
53 inline bool IsTofCInfoValid() const;
54 inline bool IsTofCorrInfoValid() const;
55 inline bool IsEmcInfoValid() const;
56 inline bool IsMucInfoValid() const;
57 inline bool IsMrpcInfoValid() const;
58 // get subsys Chi
59 inline double chiDedx(int n) const;
60 inline double chiTof(int n) const;
61 inline double chiTof1(int n) const;
62 inline double chiTof2(int n) const;
63 inline double chiTofE(int n) const;
64 inline double chiTofQ(int n) const;
65 inline double chiTofC(int n) const;
66 inline double chiTofCorr(int n) const;
67 inline double chiEmc(int n) const;
68 inline double chiMuc(int n) const;
69 inline double chiMrpc(int n) const;
70
71 // get subsys Prob
72 inline double probDedx(int n) const;
73 inline double probTof(int n) const;
74 inline double probTofE(int n) const;
75 inline double probTofQ(int n) const;
76 inline double probTofC(int n) const;
77 inline double probTofCorr(int n) const;
78 inline double probEmc(int n) const;
79 inline double probMuc(int n) const;
80 inline double probMrpc(int n) const;
81
82 //huangb add
83// get the subsys Pdf
84 inline double pdfDedx(int n);
85 inline double pdfTof(int n);
86 inline double pdfTofE(int n);
87 inline double pdfTofQ(int n);
88 inline double pdfTofC(int n);
89 inline double pdfTofCorr(int n);
90 inline double pdfEmc(int n);
91 inline double pdfMuc(int n);
92 inline double pdfMrpc(int n);
93
94
95 int getNhitCut() const {return m_nhitcut;}
96 void setNhitCut(const int nhitcuth = 5) {m_nhitcut = nhitcuth;}
97
98 // setMethod(methodProbability());
99 // setMethod(methodLikelihood());
100 // setMethod(methodNeuronNetwork());
101 void setMethod(const int method) {m_method = (m_method | method);}
102 // specify sub pid sys
103 // accessed by useDedx() | useTof1() | useTof2() | useTofE() | useTofQ() | useEmc()
104 void usePidSys(const int pidsys) {m_pidsys = (m_pidsys | pidsys);}
105 // identify pi/K accessed by onlyPionKaon() or onlyPion() | onlyKaon()
106 // identify pi/K/p accessed by onlyPionKaonProton() or onlyPion() | onlyKaon() | onlyProton()
107 // identify pi/K/e accessed by onlyPionKaonElectron() or onlyPion() | onlyKaon() | onlyElectron()
108 // identify pi/K/e/p accessed by all()
109 // identify muon accessed by onlyMuon()
110 void identify(const int pidcase) {m_pidcase = (m_pidcase | pidcase);}
111 // Calculation
112 void calculate();
113#ifdef BEAN
114 void calculate(int run); // BEAN: use this instead of calculate()
115#endif
116
117 // output of ParticleID
118
119 inline bool IsPidInfoValid() const;
120 double chi(int n) const {return m_chisq[n];}
121 double prob(int n) const { return m_prob[n];}
122 int ndof() const {return m_ndof;}
123 // huangb add
124 //---------------------------------------
125 double pdf(int n) const { return m_pdf[n];}
126 double lhf(int n) const {return m_likelihoodfraction[n];}
127
128 double probElectron() const {return m_prob[0];}
129 double probMuon() const {return m_prob[1];}
130 double probPion() const {return m_prob[2];}
131 double probKaon() const {return m_prob[3];}
132 double probProton() const {return m_prob[4];}
133 int discard() const {return m_discard;}
134 //huangb add
135 //-------------------------------------------------------
136 double pdfElectron() const {return m_pdf[0];}
137 double pdfMuon() const {return m_pdf[1];}
138 double pdfPion() const {return m_pdf[2];}
139 double pdfKaon() const {return m_pdf[3];}
140 double pdfProton() const {return m_pdf[4];}
141 // Neuron Network PID
142/* int neuronPID() const {return m_neuronPid;}
143 int neuronStat() const {return m_neuronStat;}
144 double neuronVal() const {return m_neuronVal;}
145 void setCutEm_mu(double cut1, double cut2) {m_cut_em_mu[0]=cut1; m_cut_em_mu[1]=cut2;}
146
147 void setNeuronPidCuts();
148*/
149 //tricks for nn
150 //int neuronPID() const {return m_neuronPid;}
151 int neuronStat() const {return IsPidInfoValid();}
152 double neuronVal() const {
153 if(lhf(0)>0.02) return 1.0;
154 if(lhf(1)>0.02) return 8.5;
155 if(lhf(2)>0.02) return 2.0;
156 if(lhf(3)>0.02) return 4.0;
157 if(lhf(4)>0.02) return 5.0;
158 }
159// void setCutEm_mu(double cut1, double cut2) {m_cut_em_mu[0]=cut1; m_cut_em_mu[1]=cut2;}
160 double offset(int i) {
161 return m_tofcorrpid->offset(i);
162 }
163 double sigma(int i) {
164 return m_tofcorrpid->sigma(i);
165 }
166
167 protected:
168
171 // Neuron Network PID
173 private:
174
175 bool IsDedxInfoUsed() const {return ((m_pidsys & useDedx()) == useDedx());}
176 bool IsTofInfoUsed() const {return ((m_pidsys & useTof()) == useTof());}
177 bool IsTof1InfoUsed() const {return ((m_pidsys & useTof1()) == useTof1());}
178 bool IsTof2InfoUsed() const {return ((m_pidsys & useTof2()) == useTof2());}
179 bool IsTofEInfoUsed() const {return ((m_pidsys & useTofE()) == useTofE());}
180 bool IsTofQInfoUsed() const {return ((m_pidsys & useTofQ()) == useTofQ());}
181 bool IsTofCInfoUsed() const {return ((m_pidsys & useTofC()) == useTofC());}
182 bool IsTofCorrInfoUsed() const {return ((m_pidsys & useTofCorr()) == useTofCorr());}
183 bool IsEmcInfoUsed() const {return ((m_pidsys & useEmc()) == useEmc());}
184 bool IsMucInfoUsed() const {return ((m_pidsys & useMuc()) == useMuc());}
185 bool IsMrpcInfoUsed() const {return ((m_pidsys & useMrpc()) == useMrpc());}
186
187 private:
188
189 DedxPID* m_dedxpid;
190 TofEPID* m_tofepid;
191 TofPID* m_tofpid;
192 TofQPID* m_tofqpid;
193 TofCPID* m_tofcpid;
194 TofCorrPID* m_tofcorrpid;
195 EmcPID* m_emcpid;
196 MucPID* m_mucpid;
197 MrpcPID* m_mrpcpid;
198
199 double m_chisq[5];
200 double m_prob[5];
201 //huangb add
202 double m_pdf[5];
203 double m_likelihoodfraction[5];
204 double m_TotalLikelihood;
205
206 int m_nhitcut;
207 double m_chicut;
208 int m_ndof;
209 int m_pidsys;
210 int m_pidcase;
211 int m_method;
212 int m_discard;
213
214
215
216 private:
217 //constructor & desconstructor
218 ParticleID();
219 static ParticleID *m_pointer;
220
221};
222
223#include "ParticleID/ParticleID.icc"
224
225#endif
const Int_t n
int useTofCorr() const
int useTof2() const
int useTofE() const
int useTof() const
int useTofQ() const
int useDedx() const
int useTofC() const
int useMrpc() 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:131
double pdfTofC(int n)
void setMethod(const int method)
Definition ParticleID.h:101
int discard() const
Definition ParticleID.h:133
double probEmc(int n) const
double chiMrpc(int n) const
double prob(int n) const
Definition ParticleID.h:121
double probTof(int n) const
double chiTof2(int n) const
int getNhitCut() const
Definition ParticleID.h:95
double offset(int i)
Definition ParticleID.h:160
double chi(int n) const
Definition ParticleID.h:120
bool IsTofEInfoValid() const
double pdfProton() const
Definition ParticleID.h:140
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 IsMrpcInfoValid() const
double neuronVal() const
Definition ParticleID.h:152
bool IsTofCInfoValid() const
double sigma(int i)
Definition ParticleID.h:163
bool IsTofInfoValid() const
void identify(const int pidcase)
Definition ParticleID.h:110
double pdfPion() const
Definition ParticleID.h:138
double probMuon() const
Definition ParticleID.h:129
double probElectron() const
Definition ParticleID.h:128
int ndof() const
Definition ParticleID.h:122
void usePidSys(const int pidsys)
Definition ParticleID.h:104
double pdfTof(int n)
void setNhitCut(const int nhitcuth=5)
Definition ParticleID.h:96
double chiTofQ(int n) const
double probTofC(int n) const
bool IsTofQInfoValid() const
int particleIDCalculation()
static ParticleID * instance()
double probTofQ(int n) const
bool IsPidInfoValid() const
bool IsDedxInfoValid() const
double probDedx(int n) const
double probPion() const
Definition ParticleID.h:130
double chiTofC(int n) const
double pdfMrpc(int n)
int neuronStat() const
Definition ParticleID.h:151
double pdfMuc(int n)
double lhf(int n) const
Definition ParticleID.h:126
double chiTof1(int n) const
double probMrpc(int n) const
double pdfTofCorr(int n)
void calculate()
double chiEmc(int n) const
double pdfKaon() const
Definition ParticleID.h:139
void init()
double probProton() const
Definition ParticleID.h:132
bool IsMucInfoValid() const
double pdfElectron() const
Definition ParticleID.h:136
double pdf(int n) const
Definition ParticleID.h:125
double chiTof(int n) const
double pdfMuon() const
Definition ParticleID.h:137
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