CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
TofPID Class Reference

#include <TofPID.h>

+ Inheritance diagram for TofPID:

Public Member Functions

 ~TofPID ()
 
void init ()
 
void calculate ()
 
bool IsPidInfoValid () const
 
double chi (int n) const
 
double prob (int n) const
 
double offset (int n) const
 
double sigma (int n) const
 
int ndof () const
 
double getweight1 () const
 
double getweight2 () const
 
double chilayer1 (int n) const
 
double chilayer2 (int n) const
 
- 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 TofPIDinstance ()
 

Protected Member Functions

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

Additional Inherited Members

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

Detailed Description

Definition at line 17 of file TofPID.h.

Constructor & Destructor Documentation

◆ ~TofPID()

TofPID::~TofPID ( )
inline

Definition at line 22 of file TofPID.h.

22{;}

Member Function Documentation

◆ calculate()

void TofPID::calculate ( )
virtual

Implements ParticleIDBase.

Definition at line 48 of file TofPID.cxx.

48 {
49 if(particleIDCalculation() == 0) m_ndof=1;
50}
int particleIDCalculation()
Definition TofPID.cxx:54

◆ chi()

double TofPID::chi ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 27 of file TofPID.h.

27{return m_chi[n];}
const Int_t n

◆ chilayer1()

double TofPID::chilayer1 ( int n) const

Definition at line 36 of file TofPID.cxx.

36 {
37 double chi = 99;
38 if(val_tof1) chi = m_tof1pid->chi(n);
39 return chi;
40}
double chi(int n) const
Definition Tof1PID.h:24
double chi(int n) const
Definition TofPID.h:27

◆ chilayer2()

double TofPID::chilayer2 ( int n) const

Definition at line 42 of file TofPID.cxx.

42 {
43 double chi = 99;
44 if(val_tof2) chi = m_tof2pid->chi(n);
45 return chi;
46}
double chi(int n) const
Definition Tof2PID.h:23

◆ getweight1()

double TofPID::getweight1 ( ) const
inline

Definition at line 32 of file TofPID.h.

32{ return weight1;}

◆ getweight2()

double TofPID::getweight2 ( ) const
inline

Definition at line 33 of file TofPID.h.

33{ return weight2;}

◆ init()

void TofPID::init ( )
virtual

Implements ParticleIDBase.

Definition at line 24 of file TofPID.cxx.

24 {
25 for(int i = 0; i < 5; i++) {
26 m_chi[i] = 99.0;
27 m_prob[i] = -1.0;
28 m_sigma[i] = 1;
29 m_offset[i] = 99.0;
30 }
31 m_chimin = 99.;
32 m_pdfmin = 99.;
33 m_ndof = 0;
34}

Referenced by ParticleID::init().

◆ instance()

TofPID * TofPID::instance ( )
static

Definition at line 15 of file TofPID.cxx.

15 {
16 if(!m_pointer) m_pointer = new TofPID();
17 return m_pointer;
18}

Referenced by ParticleID::init().

◆ IsPidInfoValid()

bool TofPID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 26 of file TofPID.h.

26{return (m_ndof > 0); }

◆ LikelihoodCalculation()

int TofPID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 41 of file TofPID.h.

41{return -1;}

◆ ndof()

int TofPID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 31 of file TofPID.h.

31{return m_ndof;}

◆ neuronPIDCalculation()

int TofPID::neuronPIDCalculation ( )
inlineprotected

Definition at line 40 of file TofPID.h.

40{ return -1;}

◆ offset()

double TofPID::offset ( int n) const
inline

Definition at line 29 of file TofPID.h.

29{return m_offset[n];}

◆ particleIDCalculation()

int TofPID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

Definition at line 54 of file TofPID.cxx.

54 {
55 int irc=-1;
56 EvtRecTrack* recTrk = PidTrk();
57 m_tof1pid = Tof1PID::instance();
58 m_tof1pid->init();
59 m_tof1pid->setRecTrack(recTrk);
60 m_tof1pid->setChiMinCut(chiMinCut());
62 m_tof1pid->calculate();
63 val_tof1 = m_tof1pid->IsPidInfoValid();
64 m_tof2pid = Tof2PID::instance();
65 m_tof2pid->init();
66 m_tof2pid->setRecTrack(recTrk);
67 m_tof2pid->setChiMinCut(chiMinCut());
69 m_tof2pid->calculate();
70 val_tof2 = m_tof2pid->IsPidInfoValid();
71 double chitemp = 99.;
72 double pdftemp = 0;
73 for(int i=0; i<5; i++) {
74 double t_tof1 = m_tof1pid->offset(i);
75 double t_tof2 = m_tof2pid->offset(i);
76 double m_sigma1 = m_tof1pid->sigma(i);
77 double m_sigma2 = m_tof2pid->sigma(i);
78 // double weight1,weight2;
79 if(val_tof1==1&&val_tof2==1) {
80 weight1 = (m_sigma2*m_sigma2-0.041*0.041)/(m_sigma1*m_sigma1+m_sigma2*m_sigma2-2*0.041*0.041);
81 weight2 = (m_sigma1*m_sigma1-0.041*0.041)/(m_sigma1*m_sigma1+m_sigma2*m_sigma2-2*0.041*0.041);
82 m_sigma[i] = sqrt((m_sigma1*m_sigma1*m_sigma2*m_sigma2 - 0.041*0.041*0.041*0.041)/(m_sigma1*m_sigma1+m_sigma2*m_sigma2-2*0.041*0.041));
83 m_offset[i] = weight1*t_tof1+weight2*t_tof2;
84 m_chi[i] = m_offset[i]/m_sigma[i];
85 }
86 if(val_tof1==1&&val_tof2==0) {
87 weight1=1;
88 weight2=0;
89 m_sigma[i] = m_tof1pid->sigma(i);
90 m_offset[i] = t_tof1;
91 m_chi[i] = m_tof1pid->chi(i);
92 }
93
94 if(val_tof1==0&&val_tof2==1) {
95 weight1=0;
96 weight2=1;
97 m_sigma[i] = m_tof2pid->sigma(i);
98 m_offset[i] = t_tof2;
99 m_chi[i] = m_tof2pid->chi(i);
100 }
101
102 if(val_tof1==0&&val_tof2==0) return irc;
103 if(fabs(m_chi[i]) < chitemp) chitemp = fabs(m_chi[i]);
104 double ppp = pdfCalculate(m_chi[i],1);
105 if(fabs(ppp) > pdftemp) pdftemp = fabs(ppp);
106 }
107
108 m_chimin = chitemp;
109 m_pdfmin = pdftemp;
110 if(pdftemp < pdfCalculate(pdfMinSigmaCut(),1)) return irc;
111 if(m_chimin > chiMinCut()) return irc;
112 for(int i = 0; i < 5; i++)
113 m_prob[i] = probCalculate(m_chi[i]*m_chi[i], 1);
114 irc = 0;
115 return irc;
116}
double chiMinCut() const
void setPdfMinSigmaCut(const double pdf=4)
EvtRecTrack * PidTrk() const
double probCalculate(double chi2, int n)
double pdfCalculate(double offset, double sigma)
double pdfMinSigmaCut() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
double sigma(int n) const
Definition Tof1PID.h:27
bool IsPidInfoValid() const
Definition Tof1PID.h:23
void calculate()
Definition Tof1PID.cxx:55
void init()
Definition Tof1PID.cxx:40
static Tof1PID * instance()
Definition Tof1PID.cxx:16
double offset(int n) const
Definition Tof1PID.h:26
double offset(int n) const
Definition Tof2PID.h:25
static Tof2PID * instance()
Definition Tof2PID.cxx:17
void init()
Definition Tof2PID.cxx:42
double sigma(int n) const
Definition Tof2PID.h:24
void calculate()
Definition Tof2PID.cxx:58
bool IsPidInfoValid() const
Definition Tof2PID.h:22

Referenced by calculate().

◆ prob()

double TofPID::prob ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 28 of file TofPID.h.

28{return m_prob[n];}

◆ sigma()

double TofPID::sigma ( int n) const
inline

Definition at line 30 of file TofPID.h.

30{return m_sigma[n];}

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