BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
TofPID.cxx
Go to the documentation of this file.
1#include <cmath>
2
3#include "ParticleID/TofPID.h"
4#include "ParticleID/Tof1PID.h"
5#include "ParticleID/Tof2PID.h"
6
7#ifndef BEAN
8#include "EvtRecEvent/EvtRecTrack.h"
9#include "MdcRecEvent/RecMdcTrack.h"
10#include "TofRecEvent/RecTofTrack.h"
11#endif
12
13
14TofPID * TofPID::m_pointer = 0;
16 if(!m_pointer) m_pointer = new TofPID();
17 return m_pointer;
18}
19
20TofPID::TofPID():ParticleIDBase() {
21 ;
22}
23
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}
35
36double TofPID :: chilayer1(int n) const {
37 double chi = 99;
38 if(val_tof1) chi = m_tof1pid->chi(n);
39 return chi;
40}
41
42double TofPID :: chilayer2(int n) const {
43 double chi = 99;
44 if(val_tof2) chi = m_tof2pid->chi(n);
45 return chi;
46}
47
49 if(particleIDCalculation() == 0) m_ndof=1;
50}
51
52
53
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}
117
118
119
const Int_t n
double probCalculate(double chi2, int n)
double pdfCalculate(double offset, double sigma)
void calculate()
Definition: Tof1PID.cxx:55
void init()
Definition: Tof1PID.cxx:40
static Tof1PID * instance()
Definition: Tof1PID.cxx:16
static Tof2PID * instance()
Definition: Tof2PID.cxx:17
void init()
Definition: Tof2PID.cxx:42
void calculate()
Definition: Tof2PID.cxx:58
int particleIDCalculation()
Definition: TofPID.cxx:54
void init()
Definition: TofPID.cxx:24
void calculate()
Definition: TofPID.cxx:48
static TofPID * instance()
Definition: TofPID.cxx:15