CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
ParticleID Class Reference

#include <ParticleID.h>

+ Inheritance diagram for ParticleID:

Public Member Functions

 ~ParticleID ()
 
void init ()
 
bool IsDedxInfoValid () const
 
bool IsTofInfoValid () const
 
bool IsTofEInfoValid () const
 
bool IsTofQInfoValid () const
 
bool IsTofCInfoValid () const
 
bool IsTofCorrInfoValid () const
 
bool IsEmcInfoValid () const
 
bool IsMucInfoValid () const
 
bool IsMrpcInfoValid () const
 
double chiDedx (int n) const
 
double chiTof (int n) const
 
double chiTof1 (int n) const
 
double chiTof2 (int n) const
 
double chiTofE (int n) const
 
double chiTofQ (int n) const
 
double chiTofC (int n) const
 
double chiTofCorr (int n) const
 
double chiEmc (int n) const
 
double chiMuc (int n) const
 
double chiMrpc (int n) const
 
double probDedx (int n) const
 
double probTof (int n) const
 
double probTofE (int n) const
 
double probTofQ (int n) const
 
double probTofC (int n) const
 
double probTofCorr (int n) const
 
double probEmc (int n) const
 
double probMuc (int n) const
 
double probMrpc (int n) const
 
double pdfDedx (int n)
 
double pdfTof (int n)
 
double pdfTofE (int n)
 
double pdfTofQ (int n)
 
double pdfTofC (int n)
 
double pdfTofCorr (int n)
 
double pdfEmc (int n)
 
double pdfMuc (int n)
 
double pdfMrpc (int n)
 
int getNhitCut () const
 
void setNhitCut (const int nhitcuth=5)
 
void setMethod (const int method)
 
void usePidSys (const int pidsys)
 
void identify (const int pidcase)
 
void calculate ()
 
bool IsPidInfoValid () const
 
double chi (int n) const
 
double prob (int n) const
 
int ndof () const
 
double pdf (int n) const
 
double lhf (int n) const
 
double probElectron () const
 
double probMuon () const
 
double probPion () const
 
double probKaon () const
 
double probProton () const
 
int discard () const
 
double pdfElectron () const
 
double pdfMuon () const
 
double pdfPion () const
 
double pdfKaon () const
 
double pdfProton () const
 
int neuronStat () const
 
double neuronVal () const
 
double offset (int i)
 
double sigma (int i)
 
- Public Member Functions inherited from ParticleIDBase
 ParticleIDBase ()
 
virtual ~ParticleIDBase ()
 
EvtRecTrackPidTrk () const
 
void setRecTrack (EvtRecTrack *trk)
 
double chiMinCut () const
 
void setChiMinCut (const double chi=4)
 
double pdfMinSigmaCut () const
 
void setPdfMinSigmaCut (const double pdf=4)
 
double getRunNo () const
 
void setRunNo (const double runh=8093)
 
double p ()
 
double pt ()
 
double charge ()
 
double xmass (int n)
 
double velc ()
 
double probCalculate (double chi2, int n)
 
double pdfCalculate (double offset, double sigma)
 
double interpolation (double *x, double *y, double x1)
 
double pol2 (double x, double *par)
 
double pol3 (double x, double *par)
 
double pol4 (double x, double *par)
 
int useDedx () const
 
int useTof () const
 
int useTof1 () const
 
int useTof2 () const
 
int useTofE () const
 
int useTofQ () const
 
int useTofC () const
 
int useTofCorr () const
 
int useEmc () const
 
int useMuc () const
 
int useMrpc () const
 
int onlyPionKaon () const
 
int onlyPionKaonProton () const
 
int onlyPionKaonElectron () const
 
int all () const
 
int onlyElectron () const
 
int onlyMuon () const
 
int onlyPion () const
 
int onlyKaon () const
 
int onlyProton () const
 
int methodLikelihood () const
 
int methodProbability () const
 
int methodNeuronNetwork () const
 
int dedxValid () const
 
int tofValid () const
 
int tofeValid () const
 
int tofqValid () const
 
int tofcValid () const
 
int tofcorrValid () const
 
int emcValid () const
 
int mucValid () const
 
int MrpcValid () const
 
void set_path (const char *s_path=0)
 
void set_path (std::string s_path)
 

Static Public Member Functions

static ParticleIDinstance ()
 

Protected Member Functions

int particleIDCalculation ()
 
int LikelihoodCalculation ()
 
int neuronPIDCalculation ()
 
- Protected Member Functions inherited from ParticleIDBase

Additional Inherited Members

- Static Protected Attributes inherited from ParticleIDBase
static std::string path = ""
 

Detailed Description

Definition at line 37 of file ParticleID.h.

Constructor & Destructor Documentation

◆ ~ParticleID()

ParticleID::~ParticleID ( )

Definition at line 92 of file ParticleID.cxx.

92 {
93 // if(m_dedxpid) delete m_dedxpid;
94 // if(m_tof1pid) delete m_tof1pid;
95 // if(m_tof2pid) delete m_tof2pid;
96 // if(m_tofepid) delete m_tofepid;
97 // if(m_tofqpid) delete m_tofqpid;
98 // if(m_emcpid) delete m_emcpid;
99}

Member Function Documentation

◆ calculate()

void ParticleID::calculate ( )
virtual

Implements ParticleIDBase.

Definition at line 101 of file ParticleID.cxx.

101 {
102#ifdef BEAN
103 cout << " please use ParticleID::calculate(run) ! " << endl;
104 exit(1);
105}
106
107
108void ParticleID::calculate(int run)
109{
110#endif
111 int nhitcutpid=getNhitCut();
112
113#ifndef BEAN
114 IDataProviderSvc* m_eventSvc;
115 Gaudi::svcLocator()->service("EventDataSvc", m_eventSvc, true);
116
117 SmartDataPtr<Event::EventHeader> eventHeaderpid(m_eventSvc,"/Event/EventHeader");
118 int runpid=eventHeaderpid->runNumber();
119 int eventpid=eventHeaderpid->eventNumber();
120 // cout<<"runpid="<<runpid<<endl;
121 // cout<<"eventpid="<<eventpid<<endl;
122#else
123 int runpid=run;
124#endif
125
126 EvtRecTrack* recTrk = PidTrk();
127 // int runnum=getRunNo();
128 // cout<<"runnum="<<runnum<<endl;
129 // if user did not specify sub sys, sepcify the default value
130 if(m_pidsys == 0) {
131 m_pidsys = useDedx() | useTof() | useTofE() | useEmc() | useMuc() | useTofQ() | useTofC() | useTofCorr() | useMrpc();
132 }
133 // if user did not set the seperate case, set the default value
134
135 if(m_pidcase == 0 ) {
136 m_pidcase = all();
137 }
138 //dedx sys
139 if(IsDedxInfoUsed()) {
140 if(!m_dedxpid) m_dedxpid = DedxPID::instance();
141 m_dedxpid->init();
142 m_dedxpid->setRunNo(runpid);
143 m_dedxpid->setNhitCutDx(nhitcutpid);
144 m_dedxpid->setRecTrack(recTrk);
145 m_dedxpid->setChiMinCut(chiMinCut());
146 m_dedxpid->setPdfMinSigmaCut(pdfMinSigmaCut());
147 m_dedxpid->calculate();
148 }
149
150 // tof1 and tof2 sys
151 if(IsTofInfoUsed()|IsTof1InfoUsed()|IsTof2InfoUsed()|IsTofCInfoUsed())
152 {
153 if(IsTofCInfoUsed())
154 {
155 if(!m_tofcpid) m_tofcpid = TofCPID::instance();
156 m_tofcpid->init();
157 m_tofcpid->setRunNo(runpid);
158 m_tofcpid->setRecTrack(recTrk);
159 m_tofcpid->setChiMinCut(chiMinCut());
160 m_tofcpid->setPdfMinSigmaCut(pdfMinSigmaCut());
161 m_tofcpid->calculate();
162 }
163 else
164 {
165 if(!m_tofpid) m_tofpid = TofPID::instance();
166 m_tofpid->init();
167 m_tofpid->setRecTrack(recTrk);
168 m_tofpid->setChiMinCut(chiMinCut());
170 m_tofpid->calculate();
171 }
172
173 }
174 // tof secondary correction sys
175 if(IsTofCorrInfoUsed()) {
176 if(!m_tofcorrpid) m_tofcorrpid = TofCorrPID::instance();
177 m_tofcorrpid->setRunNo(runpid);
178 m_tofcorrpid->init();
179 m_tofcorrpid->setRecTrack(recTrk);
180 m_tofcorrpid->setChiMinCut(chiMinCut());
181 m_tofcorrpid->setPdfMinSigmaCut(pdfMinSigmaCut());
182 m_tofcorrpid->calculate();
183 }
184
185 /*
186 // tof1 sys
187 if(IsTof1InfoUsed()){
188 if(!m_tof1pid) m_tof1pid = Tof1PID::instance();
189 m_tof1pid->init();
190 m_tof1pid->setRecTrack(recTrk);
191 m_tof1pid->setChiMinCut(4);
192 m_tof1pid->setPdfMinSigmaCut(4);
193 m_tof1pid->calculate();
194 }
195
196 // tof2 sys
197 if(IsTof2InfoUsed()){
198 if(!m_tof2pid) m_tof2pid = Tof2PID::instance();
199 m_tof2pid->init();
200 m_tof2pid->setRecTrack(recTrk);
201 m_tof2pid->setChiMinCut(4);
202 m_tof2pid->setPdfMinSigmaCut(4);
203 m_tof2pid->calculate();
204 }
205
206 */
207 // tofq sys
208 if(IsTofQInfoUsed()) {
209 if(!m_tofqpid) m_tofqpid = TofQPID::instance();
210 m_tofqpid->init();
211 m_tofqpid->setRecTrack(recTrk);
212 m_tofqpid->setChiMinCut(chiMinCut());
213 m_tofqpid->calculate();
214 }
215
216 // endcap tof sys
217 if(IsTofEInfoUsed()&&(!IsTofCorrInfoUsed())) {
218 if(!m_tofepid) m_tofepid = TofEPID::instance();
219 m_tofepid->init();
220 m_tofepid->setRecTrack(recTrk);
221 m_tofepid->setChiMinCut(chiMinCut());
222 m_tofepid->setPdfMinSigmaCut(pdfMinSigmaCut());
223 m_tofepid->calculate();
224 }
225 // emc sys
226 if(IsEmcInfoUsed()) {
227 if(!m_emcpid) m_emcpid = EmcPID::instance();
228 m_emcpid->init();
229 m_emcpid->setRecTrack(recTrk);
230 m_emcpid->setChiMinCut(chiMinCut());
231 m_emcpid->calculate();
232 }
233
234 // muc sys
235 if(IsMucInfoUsed()) {
236 if(!m_mucpid) m_mucpid = MucPID::instance();
237 m_mucpid->init();
238 m_mucpid->setRecTrack(recTrk);
239 m_mucpid->setChiMinCut(chiMinCut());
240 m_mucpid->calculate();
241 }
242 //mrpc sys
243 if(IsMrpcInfoUsed()) {
244 if(!m_mrpcpid) m_mrpcpid = MrpcPID::instance();
245 m_mrpcpid->init();
246 m_mrpcpid->setRecTrack(recTrk);
247 m_mrpcpid->setChiMinCut(chiMinCut());
248 m_mrpcpid->setPdfMinSigmaCut(pdfMinSigmaCut());
249 m_mrpcpid->calculate();
250 }
251
252
253
254 // probability method
255 if((m_method & methodProbability()) == methodProbability())
256 if(particleIDCalculation() < 0) m_ndof = 0;
257 // std::cout<<"m_ndof="<<m_ndof<<std::endl;
258
259 //likelihood method
260 if((m_method & methodLikelihood()) == methodLikelihood())
261 if(LikelihoodCalculation() < 0) m_discard =0;
262 // neuron network
263 if((m_method & methodNeuronNetwork()) == methodNeuronNetwork())
264 // m_neuronPid = neuronPIDCalculation();
265 if(LikelihoodCalculation() < 0) m_discard =0;
266
267}
void init()
Definition DedxPID.cxx:26
void setNhitCutDx(const int nhitcuthdx=5)
Definition DedxPID.h:35
void calculate()
Definition DedxPID.cxx:42
static DedxPID * instance()
Definition DedxPID.cxx:17
void calculate()
Definition EmcPID.cxx:153
void init()
Definition EmcPID.cxx:95
static EmcPID * instance()
Definition EmcPID.cxx:23
void calculate()
Definition MrpcPID.cxx:39
static MrpcPID * instance()
Definition MrpcPID.cxx:16
void init()
Definition MrpcPID.cxx:25
void init()
Definition MucPID.cxx:67
static MucPID * instance()
Definition MucPID.cxx:22
void calculate()
Definition MucPID.cxx:101
double chiMinCut() const
int useTofCorr() const
void setPdfMinSigmaCut(const double pdf=4)
EvtRecTrack * PidTrk() const
int useTofE() const
int useTof() const
int useTofQ() const
int methodProbability() const
int useDedx() const
int useTofC() const
int useMrpc() const
void setRunNo(const double runh=8093)
double pdfMinSigmaCut() const
int methodNeuronNetwork() const
int useEmc() const
void setChiMinCut(const double chi=4)
int all() const
int useMuc() const
int methodLikelihood() const
void setRecTrack(EvtRecTrack *trk)
int getNhitCut() const
Definition ParticleID.h:95
int LikelihoodCalculation()
int particleIDCalculation()
void calculate()
void calculate()
Definition TofCPID.cxx:55
void init()
Definition TofCPID.cxx:43
static TofCPID * instance()
Definition TofCPID.cxx:19
void init()
void calculate()
static TofCorrPID * instance()
void init()
Definition TofEPID.cxx:25
void calculate()
Definition TofEPID.cxx:39
static TofEPID * instance()
Definition TofEPID.cxx:16
void init()
Definition TofPID.cxx:24
void calculate()
Definition TofPID.cxx:48
static TofPID * instance()
Definition TofPID.cxx:15
void init()
Definition TofQPID.cxx:22
void calculate()
Definition TofQPID.cxx:34
static TofQPID * instance()
Definition TofQPID.cxx:13

Referenced by BeamParams::execute(), DQAJpsi2PPbarAlg::execute(), DQAKsKpi::execute(), DQARhopi::execute(), DQASelBhabha::execute(), DQASelDimu::execute(), DQASelHadron::execute(), Gam4pikp::execute(), inclks::execute(), inclkstar::execute(), incllambda::execute(), inclphi::execute(), Rhopi::execute(), LocalKaonSelector::operator()(), and LocalPionSelector::operator()().

◆ chi()

double ParticleID::chi ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 120 of file ParticleID.h.

120{return m_chisq[n];}
const Int_t n

◆ chiDedx()

◆ chiEmc()

double ParticleID::chiEmc ( int n) const
inline

◆ chiMrpc()

double ParticleID::chiMrpc ( int n) const
inline

◆ chiMuc()

double ParticleID::chiMuc ( int n) const
inline

◆ chiTof()

double ParticleID::chiTof ( int n) const
inline

Referenced by LikelihoodCalculation().

◆ chiTof1()

◆ chiTof2()

◆ chiTofC()

double ParticleID::chiTofC ( int n) const
inline

◆ chiTofCorr()

double ParticleID::chiTofCorr ( int n) const
inline

Referenced by LikelihoodCalculation().

◆ chiTofE()

double ParticleID::chiTofE ( int n) const
inline

Referenced by LikelihoodCalculation().

◆ chiTofQ()

double ParticleID::chiTofQ ( int n) const
inline

◆ discard()

int ParticleID::discard ( ) const
inline

Definition at line 133 of file ParticleID.h.

133{return m_discard;}

◆ getNhitCut()

int ParticleID::getNhitCut ( ) const
inline

Definition at line 95 of file ParticleID.h.

95{return m_nhitcut;}

◆ identify()

◆ init()

void ParticleID::init ( )
virtual

Implements ParticleIDBase.

Definition at line 27 of file ParticleID.cxx.

27 {
28
29 if(IsDedxInfoUsed()) {
30 if(!m_dedxpid) m_dedxpid = DedxPID::instance();
31 m_dedxpid->init();
32 }
33
34 if(IsTofInfoUsed()|IsTof1InfoUsed()|IsTof2InfoUsed()) {
35 if(!m_tofpid) m_tofpid = TofPID::instance();
36 m_tofpid->init();
37 }
38
39 if(IsTofCorrInfoUsed()) {
40 if(!m_tofcorrpid) m_tofcorrpid = TofCorrPID::instance();
41 // m_tofcorrpid->init();
42 }
43
44 if(IsEmcInfoUsed()) {
45 if(!m_emcpid) m_emcpid = EmcPID::instance();
46 m_emcpid->init();
47 }
48
49 if(IsMucInfoUsed()) {
50 if(!m_mucpid) m_mucpid = MucPID::instance();
51 m_mucpid->init();
52 }
53
54
55 if(IsMrpcInfoUsed()) {
56 if(!m_mrpcpid) m_mrpcpid = MrpcPID::instance();
57 m_mrpcpid->init();
58 }
59
60
61 // global info.
62 m_pidsys = 0;
63 m_pidcase = 0;
64 m_method = 0;
65 m_TotalLikelihood =0;
66 m_discard =1;
67 // probability
68 m_ndof = 0;
69 m_nhitcut=5;
70 for(int i = 0; i < 4; i++) {
71 m_chisq[i] = 9999.;
72 m_prob[i] = -1.0;
73 }
74}

Referenced by BeamParams::execute(), DQAJpsi2PPbarAlg::execute(), DQAKsKpi::execute(), DQARhopi::execute(), DQASelBhabha::execute(), DQASelDimu::execute(), DQASelHadron::execute(), Gam4pikp::execute(), inclks::execute(), inclkstar::execute(), incllambda::execute(), inclphi::execute(), Rhopi::execute(), LocalKaonSelector::operator()(), and LocalPionSelector::operator()().

◆ instance()

◆ IsDedxInfoValid()

bool ParticleID::IsDedxInfoValid ( ) const
inline

Referenced by LikelihoodCalculation().

◆ IsEmcInfoValid()

bool ParticleID::IsEmcInfoValid ( ) const
inline

Referenced by LikelihoodCalculation().

◆ IsMrpcInfoValid()

bool ParticleID::IsMrpcInfoValid ( ) const
inline

Referenced by LikelihoodCalculation().

◆ IsMucInfoValid()

bool ParticleID::IsMucInfoValid ( ) const
inline

Referenced by LikelihoodCalculation().

◆ IsPidInfoValid()

◆ IsTofCInfoValid()

bool ParticleID::IsTofCInfoValid ( ) const
inline

Referenced by LikelihoodCalculation().

◆ IsTofCorrInfoValid()

bool ParticleID::IsTofCorrInfoValid ( ) const
inline

Referenced by LikelihoodCalculation().

◆ IsTofEInfoValid()

bool ParticleID::IsTofEInfoValid ( ) const
inline

Referenced by LikelihoodCalculation().

◆ IsTofInfoValid()

bool ParticleID::IsTofInfoValid ( ) const
inline

Referenced by LikelihoodCalculation().

◆ IsTofQInfoValid()

bool ParticleID::IsTofQInfoValid ( ) const
inline

Referenced by LikelihoodCalculation().

◆ lhf()

double ParticleID::lhf ( int n) const
inline

Definition at line 126 of file ParticleID.h.

126{return m_likelihoodfraction[n];}

Referenced by neuronVal().

◆ LikelihoodCalculation()

int ParticleID::LikelihoodCalculation ( )
protectedvirtual

Implements ParticleIDBase.

Definition at line 460 of file ParticleID.cxx.

460 {
461 int irc = -1;
462
464 if(!valid) return irc;
465 double pdf[5];
466 bool pidcase[5];
467 for(int i = 0; i < 5; i++) {
468 pdf[i] = 1;
469 pidcase[i] = false;
470 }
471
472 if((m_pidcase & onlyElectron()) == onlyElectron()) pidcase[0] = true;
473 if((m_pidcase & onlyMuon()) == onlyMuon()) pidcase[1] = true;
474 if((m_pidcase & onlyPion()) == onlyPion()) pidcase[2] = true;
475 if((m_pidcase & onlyKaon()) == onlyKaon()) pidcase[3] = true;
476 if((m_pidcase & onlyProton()) == onlyProton()) pidcase[4] = true;
477
478 for(int i = 0; i < 5; i++) {
479 if(pidcase[i]==0)
480 pdf[i]=0;
481 }
482
483 //
484 // dEdx PID
485 //
486 if(IsDedxInfoUsed()) {
487 if(IsDedxInfoValid()) {
488 bool okpid = false;
489 for(int i = 0; i < 5; i++) {
490 if(pidcase[i] && pdfCalculate(chiDedx(i),1) > pdfCalculate(m_dedxpid->pdfMinSigmaCut(),1.5))
491 if(!okpid) okpid = true;
492 }
493 if(okpid) {
494 m_ndof++;
495 for(int i = 0; i < 5; i++) {
496 pdf[i] *= pdfDedx(i);
497 }
498 }
499 } // dE/dx
500 }
501
502
503 //
504 // Barrel TOF
505 //
506 if(IsTofInfoUsed()|IsTof1InfoUsed()|IsTof2InfoUsed()|IsTofCInfoUsed())
507 { if(IsTofCInfoUsed())
508 {
509
510 if(IsTofCInfoValid()) {
511 bool okpid = false;
512 for(int i = 0; i < 5; i++) {
513 if(pidcase[i] && pdfCalculate(chiTof(i),1) > pdfCalculate(m_tofcpid->pdfMinSigmaCut(),1.5))
514 if(!okpid) okpid = true;
515 }
516 if(okpid) {
517 m_ndof++;
518 for(int i = 0; i < 5; i++) {
519 pdf[i] *= pdfTofC(i);
520 }
521 }
522 } // TOF
523 }
524
525 else {
526 if(IsTofInfoValid()) {
527 bool okpid = false;
528 for(int i = 0; i < 5; i++) {
529 if(pidcase[i] && pdfCalculate(chiTof(i),1) > pdfCalculate(m_tofpid->pdfMinSigmaCut(),1.5))
530 if(!okpid) okpid = true;
531 }
532 if(okpid) {
533 m_ndof++;
534 for(int i = 0; i < 5; i++) {
535 pdf[i] *= pdfTof(i);
536 }
537 }
538 } // TOF
539
540
541
542 //
543 // EndCap Tof
544 //
545
546 if(IsTofEInfoUsed()) {
547 if(IsTofEInfoValid()) {
548 bool okpid = false;
549 for(int i = 0; i < 5; i++) {
550 if(pidcase[i]&& pdfCalculate(chiTofE(i),1) > pdfCalculate(m_tofepid->pdfMinSigmaCut(),1.5))
551 if(!okpid) okpid = true;
552 }
553 if(okpid) {
554 // m_ndof++;
555 // for(int i = 0; i < 5; i++) pdf[i] *= pdfTofE(i);
556 }
557 } // EndCap TOF
558 }
559 }
560
561 }
562
563 // Secondary TOF correction
564 if(IsTofCorrInfoUsed()) {
565 if(IsTofCorrInfoValid()) {
566 bool okpid = false;
567 for(int i = 0; i < 5; i++) {
568 if(pidcase[i] && pdfCalculate(chiTofCorr(i),1) > pdfCalculate(m_tofcorrpid->pdfMinSigmaCut(),1.5))
569 if(!okpid) okpid = true;
570 }
571 if(okpid) {
572 m_ndof++;
573 for(int i = 0; i < 5; i++) {
574 pdf[i] *= pdfTofCorr(i);
575 }
576 }
577 }
578 }
579
580
581 //
582 // Barrel TOF Q
583 //
584
585 if(IsTofQInfoValid()) {
586 bool okpid = false;
587 for(int i = 0; i < 5; i++) {
588 if(pidcase[i])
589 if(!okpid) okpid = true;
590 }
591 if(okpid) {
592 // m_ndof++;
593 for(int i = 0; i < 5; i++) pdf[i] *= pdfTofQ(i);
594 }
595 } // TofQ
596
597 //
598 // Emc PID
599 //
600 if(IsEmcInfoUsed()) {
601 if(IsEmcInfoValid()) {
602 bool okpid = false;
603 for(int i = 0; i < 5; i++) {
604 if(pidcase[i]&&pdfEmc(i)>0)
605 if(!okpid) okpid = true;
606 }
607 if(okpid) {
608 m_ndof++;
609 for(int i = 0; i < 5; i++) {
610 pdf[i] *= pdfEmc(i);
611 }
612 } // Emc Pid
613 }
614 }
615 if(IsMucInfoUsed()) {
616 if(IsMucInfoValid()) {
617 bool okpid = false;
618 for(int i = 0; i < 5; i++) {
619 if(pidcase[i]&&pdfMuc(i)>0)
620 if(!okpid) okpid = true;
621 }
622 if(okpid) {
623 m_ndof++;
624 for(int i = 0; i < 5; i++) {
625 pdf[i] *= pdfMuc(i);
626 }
627 }
628 } // Emc Pid
629 }
630 if(IsMrpcInfoUsed()) {
631 if(IsMrpcInfoValid()) {
632 bool okpid = false;
633 for(int i = 0; i < 5; i++) {
634 if(pidcase[i]&&pdfMrpc(i)>0)
635 if(!okpid) okpid = true;
636 }
637 if(okpid) {
638 m_ndof++;
639 for(int i = 0; i < 5; i++) {
640 pdf[i] *= pdfMrpc(i);
641 }
642 }
643 } // Emc Pid
644 }
645
646
647
648
649 if(m_ndof <= 0) return irc;
650 for(int i = 0; i < 5; i++) {
651 m_pdf[i] = pdf[i];
652 m_TotalLikelihood += pdf[i];
653 }
654 for(int i = 0; i < 5; i++) {
655 m_likelihoodfraction[i] = pdf[i]/m_TotalLikelihood;
656 }
657
658
659 irc = 0;
660 return irc;
661}
int onlyProton() const
double pdfCalculate(double offset, double sigma)
int onlyMuon() const
int onlyKaon() const
int onlyElectron() const
int onlyPion() const
double pdfEmc(int n)
double pdfTofC(int n)
bool IsTofEInfoValid() const
bool IsEmcInfoValid() const
double pdfDedx(int n)
double chiTofE(int n) const
bool IsTofCorrInfoValid() const
bool IsMrpcInfoValid() const
bool IsTofCInfoValid() const
bool IsTofInfoValid() const
double pdfTof(int n)
bool IsTofQInfoValid() const
bool IsDedxInfoValid() const
double pdfMrpc(int n)
double pdfMuc(int n)
double pdfTofCorr(int n)
bool IsMucInfoValid() const
double pdf(int n) const
Definition ParticleID.h:125
double chiTof(int n) const
double pdfTofQ(int n)
double chiTofCorr(int n) const
double chiDedx(int n) const

◆ ndof()

int ParticleID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 122 of file ParticleID.h.

122{return m_ndof;}

◆ neuronPIDCalculation()

int ParticleID::neuronPIDCalculation ( )
protected

◆ neuronStat()

int ParticleID::neuronStat ( ) const
inline

Definition at line 151 of file ParticleID.h.

151{return IsPidInfoValid();}
bool IsPidInfoValid() const

◆ neuronVal()

double ParticleID::neuronVal ( ) const
inline

Definition at line 152 of file ParticleID.h.

152 {
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 }
double lhf(int n) const
Definition ParticleID.h:126

◆ offset()

double ParticleID::offset ( int i)
inline

Definition at line 160 of file ParticleID.h.

160 {
161 return m_tofcorrpid->offset(i);
162 }
double offset(int n) const
Definition TofCorrPID.h:26

◆ particleIDCalculation()

int ParticleID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

Definition at line 269 of file ParticleID.cxx.

269 {
270 int irc = -1;
271 bool valid = IsDedxInfoValid() || IsTofInfoValid()||IsTofEInfoValid()
274
275 if(!valid) return irc;
276
277 double chisq[5];
278 bool pidcase[5];
279 for(int i = 0; i < 5; i++) {
280 chisq[i] = 0;
281 pidcase[i] = false;
282 }
283
284 if((m_pidcase & onlyElectron()) == onlyElectron()) pidcase[0] = true;
285 if((m_pidcase & onlyMuon()) == onlyMuon()) pidcase[1] = true;
286 if((m_pidcase & onlyPion()) == onlyPion()) pidcase[2] = true;
287 if((m_pidcase & onlyKaon()) == onlyKaon()) pidcase[3] = true;
288 if((m_pidcase & onlyProton()) == onlyProton()) pidcase[4] = true;
289
290 //
291 // dEdx PID
292 //
293 if(IsDedxInfoUsed()) {
294 if(IsDedxInfoValid()) {
295 bool okpid = false;
296 for(int i = 0; i < 5; i++) {
297 if(pidcase[i] && (fabs(chiDedx(i)) < m_dedxpid->chiMinCut()))
298 if(!okpid) okpid = true;
299 }
300 if(okpid) {
301 m_ndof++;
302 for(int i = 0; i < 5; i++) chisq[i] += chiDedx(i)*chiDedx(i);
303
304
305 }
306 } // dE/dx
307 }
308 //
309 // Barrel TOF
310 //
311
312 if(IsTofInfoUsed()|IsTof1InfoUsed()|IsTof2InfoUsed() | IsTofCInfoUsed())
313 { if(IsTofCInfoUsed())
314 {
315 if(IsTofCInfoValid()) {
316 bool okpid = false;
317 for(int i = 0; i < 5; i++) {
318 if(pidcase[i] && (fabs(chiTofC(i)) < m_tofcpid->chiMinCut()))
319 if(!okpid) okpid = true;
320 }
321 if(okpid) {
322 m_ndof++;
323 for(int i = 0; i < 5; i++) chisq[i] += chiTofC(i)*chiTofC(i);
324 }
325 } // TOF1
326 }
327 else {
328 if(IsTofInfoValid()) {
329 bool okpid = false;
330 for(int i = 0; i < 5; i++) {
331 if(pidcase[i] && (fabs(chiTof(i)) < m_tofpid->chiMinCut()))
332 if(!okpid) okpid = true;
333 }
334 if(okpid) {
335 m_ndof++;
336 for(int i = 0; i < 5; i++) chisq[i] += chiTof(i)*chiTof(i);
337 }
338 } // TOF1
339
340
341 //
342 // EndCap Tof
343 //
344
345 if(IsTofEInfoUsed()) {
346 if(IsTofEInfoValid()) {
347 bool okpid = false;
348 for(int i = 0; i < 5; i++) {
349 if(pidcase[i] && (fabs(chiTofE(i)) < m_tofepid->chiMinCut()))
350 if(!okpid) okpid = true;
351 }
352 if(okpid) {
353 m_ndof++;
354 for(int i = 0; i < 5; i++) chisq[i] += chiTofE(i)*chiTofE(i);
355 }
356 } // EndCap TOF
357 }
358
359 }
360 }
361
362 // Secondary TOF correction
363 if(IsTofCorrInfoUsed()) {
364 if(IsTofCorrInfoValid()) {
365 bool okpid = false;
366 for(int i = 0; i < 5; i++) {
367 // if(pidcase[i] && (fabs(chiTofCorr(i)) < m_tofcorrpid->chiMinCut()))
368 if(pidcase[i] && ( chiTofCorr(i) < 6.0 && chiTofCorr(i) > -4.0 ) )
369 if(!okpid) okpid = true;
370 }
371 if(okpid) {
372 m_ndof++;
373 for(int i = 0; i < 5; i++) chisq[i] += chiTofCorr(i)*chiTofCorr(i);
374 }
375 }
376 }
377
378 //
379 // Barrel TOF Q
380 //
381
382 if(IsTofQInfoUsed()) {
383 if(IsTofQInfoValid()) {
384 bool okpid = false;
385 for(int i = 0; i < 5; i++) {
386 if(pidcase[i] && (fabs(chiTofQ(i)) < m_tofqpid->chiMinCut()))
387 if(!okpid) okpid = true;
388 }
389 if(okpid) {
390 m_ndof++;
391 for(int i = 0; i < 5; i++) chisq[i] += chiTofQ(i)*chiTofQ(i);
392 }
393 } // TofQ
394 }
395
396 // Muc Pid
397 if(IsMucInfoUsed()) {
398 if(IsMucInfoValid()) {
399 bool okpid = false;
400 for(int i = 0; i < 5; i++) {
401 if(pidcase[i] && (fabs(chiMuc(i)) < m_mucpid->chiMinCut()))
402 if(!okpid) okpid = true;
403 }
404 if(okpid) {
405 m_ndof++;
406 for(int i = 0; i < 5; i++) chisq[i] += chiMuc(i)*chiMuc(i);
407 }
408 } // Muc Pid
409 }
410
411
412 // Emc PID
413 if(IsEmcInfoUsed()) {
414 if(IsEmcInfoValid()) {
415 bool okpid = false;
416 for(int i = 0; i < 5; i++) {
417 if(pidcase[i] && (fabs(chiEmc(i)) < m_emcpid->chiMinCut()))
418 if(!okpid) okpid = true;
419 }
420 if(okpid) {
421 m_ndof++;
422 for(int i = 0; i < 5; i++) chisq[i] += chiEmc(i)*chiEmc(i);
423 }
424 } // Emc Pid
425 }
426
427 // Mrpc PID
428 if(IsMrpcInfoUsed()) {
429 if(IsMrpcInfoValid()) {
430 bool okpid = false;
431 for(int i = 0; i < 5; i++) {
432 if(pidcase[i] && (fabs(chiMrpc(i)) < m_mrpcpid->chiMinCut()))
433 if(!okpid) okpid = true;
434 }
435 if(okpid) {
436 m_ndof++;
437 for(int i = 0; i < 5; i++) chisq[i] += chiMrpc(i)*chiMrpc(i);
438 }
439 } // Mrpc Pid
440 }
441
442
443 if(m_ndof <= 0) return irc;
444
445
446 for(int i = 0; i < 5; i++) {
447 m_chisq[i] = chisq[i];
448 m_prob[i] = probCalculate(chisq[i], m_ndof);
449 }
450
451
452 irc = 0;
453 return irc;
454}
double probCalculate(double chi2, int n)
double chiMuc(int n) const
double chiMrpc(int n) const
double chiTofQ(int n) const
double chiTofC(int n) const
double chiEmc(int n) const

◆ pdf()

double ParticleID::pdf ( int n) const
inline

Definition at line 125 of file ParticleID.h.

125{ return m_pdf[n];}

Referenced by LikelihoodCalculation().

◆ pdfDedx()

double ParticleID::pdfDedx ( int n)
inline

Referenced by LikelihoodCalculation().

◆ pdfElectron()

double ParticleID::pdfElectron ( ) const
inline

Definition at line 136 of file ParticleID.h.

136{return m_pdf[0];}

◆ pdfEmc()

double ParticleID::pdfEmc ( int n)
inline

Referenced by LikelihoodCalculation().

◆ pdfKaon()

double ParticleID::pdfKaon ( ) const
inline

Definition at line 139 of file ParticleID.h.

139{return m_pdf[3];}

◆ pdfMrpc()

double ParticleID::pdfMrpc ( int n)
inline

Referenced by LikelihoodCalculation().

◆ pdfMuc()

double ParticleID::pdfMuc ( int n)
inline

Referenced by LikelihoodCalculation().

◆ pdfMuon()

double ParticleID::pdfMuon ( ) const
inline

Definition at line 137 of file ParticleID.h.

137{return m_pdf[1];}

◆ pdfPion()

double ParticleID::pdfPion ( ) const
inline

Definition at line 138 of file ParticleID.h.

138{return m_pdf[2];}

◆ pdfProton()

double ParticleID::pdfProton ( ) const
inline

Definition at line 140 of file ParticleID.h.

140{return m_pdf[4];}

◆ pdfTof()

double ParticleID::pdfTof ( int n)
inline

Referenced by LikelihoodCalculation().

◆ pdfTofC()

double ParticleID::pdfTofC ( int n)
inline

Referenced by LikelihoodCalculation().

◆ pdfTofCorr()

double ParticleID::pdfTofCorr ( int n)
inline

Referenced by LikelihoodCalculation().

◆ pdfTofE()

double ParticleID::pdfTofE ( int n)
inline

◆ pdfTofQ()

double ParticleID::pdfTofQ ( int n)
inline

Referenced by LikelihoodCalculation().

◆ prob()

double ParticleID::prob ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 121 of file ParticleID.h.

121{ return m_prob[n];}

Referenced by DQAKsKpi::execute(), DQASelBhabha::execute(), DQASelDimu::execute(), and DQASelHadron::execute().

◆ probDedx()

double ParticleID::probDedx ( int n) const
inline

◆ probElectron()

double ParticleID::probElectron ( ) const
inline

Definition at line 128 of file ParticleID.h.

128{return m_prob[0];}

Referenced by BeamParams::execute(), DQASelBhabha::execute(), DQASelDimu::execute(), DQASelHadron::execute(), and Gam4pikp::execute().

◆ probEmc()

double ParticleID::probEmc ( int n) const
inline

◆ probKaon()

◆ probMrpc()

double ParticleID::probMrpc ( int n) const
inline

◆ probMuc()

double ParticleID::probMuc ( int n) const
inline

◆ probMuon()

double ParticleID::probMuon ( ) const
inline

Definition at line 129 of file ParticleID.h.

129{return m_prob[1];}

Referenced by BeamParams::execute(), DQASelBhabha::execute(), DQASelDimu::execute(), DQASelHadron::execute(), and Gam4pikp::execute().

◆ probPion()

◆ probProton()

double ParticleID::probProton ( ) const
inline

◆ probTof()

double ParticleID::probTof ( int n) const
inline

◆ probTofC()

double ParticleID::probTofC ( int n) const
inline

◆ probTofCorr()

double ParticleID::probTofCorr ( int n) const
inline

◆ probTofE()

double ParticleID::probTofE ( int n) const
inline

◆ probTofQ()

double ParticleID::probTofQ ( int n) const
inline

◆ setMethod()

◆ setNhitCut()

void ParticleID::setNhitCut ( const int nhitcuth = 5)
inline

Definition at line 96 of file ParticleID.h.

96{m_nhitcut = nhitcuth;}

◆ sigma()

double ParticleID::sigma ( int i)
inline

Definition at line 163 of file ParticleID.h.

163 {
164 return m_tofcorrpid->sigma(i);
165 }
double sigma(int n) const
Definition TofCorrPID.h:27

◆ usePidSys()


The documentation for this class was generated from the following files: