BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
Tof2PID Class Reference

#include <Tof2PID.h>

+ Inheritance diagram for Tof2PID:

Public Member Functions

 ~Tof2PID ()
 
void init ()
 
void calculate ()
 
bool IsPidInfoValid () const
 
double chi (int n) const
 
double sigma (int n) const
 
double offset (int n) const
 
double prob (int n) const
 
int ndof () const
 
double mass2 () const
 
double ph2 () const
 
double zhit2 () const
 
double path2 () const
 
double tof2 () const
 
int neuronPID () 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 chiMaxCut () const
 
void setChiMaxCut (const double chi=6)
 
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 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
 
void set_path (const char *s_path=0)
 
void set_path (std::string s_path)
 

Static Public Member Functions

static Tof2PIDinstance ()
 

Protected Member Functions

int particleIDCalculation ()
 
int neuronPIDCalculation ()
 
int LikelihoodCalculation ()
 
double offsetTof2 (int n, int cntr, double ptrk, double ztof, double m_ph2, double charge)
 
double sigmaTof2 (int n, int cntr, double ptrk, double ztof, double m_ph2, double charge)
 
double sampleQ0 (double betagamma, double beta)
 
- Protected Member Functions inherited from ParticleIDBase

Additional Inherited Members

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

Detailed Description

Definition at line 14 of file Tof2PID.h.

Constructor & Destructor Documentation

◆ ~Tof2PID()

Tof2PID::~Tof2PID ( )
inline

Definition at line 18 of file Tof2PID.h.

18{;}

Member Function Documentation

◆ calculate()

void Tof2PID::calculate ( )
virtual

Implements ParticleIDBase.

Definition at line 58 of file Tof2PID.cxx.

58 {
59 if(particleIDCalculation() == 0) m_ndof=1;
60}
int particleIDCalculation()
Definition Tof2PID.cxx:62

Referenced by TofPID::particleIDCalculation().

◆ chi()

double Tof2PID::chi ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 23 of file Tof2PID.h.

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

Referenced by TofPID::particleIDCalculation().

◆ init()

void Tof2PID::init ( )
virtual

Implements ParticleIDBase.

Definition at line 42 of file Tof2PID.cxx.

42 {
43
44 for(int i = 0; i < 5; i++) {
45 m_chi[i] = 99.0;
46 m_prob[i] = -1.0;
47 m_sigma[i] = 1.0;
48 m_offset[i] =99.0;
49 }
50 m_chimin = 99.;
51 m_pdfmin =99.;
52 m_ndof = 0;
53 m_mass2 = -999;
54 m_ph2 = -99;
55 m_zhit2 = -99;
56}

Referenced by TofPID::particleIDCalculation().

◆ instance()

Tof2PID * Tof2PID::instance ( )
static

Definition at line 17 of file Tof2PID.cxx.

17 {
18 if(!m_pointer) m_pointer = new Tof2PID();
19 return m_pointer;
20}

Referenced by TofPID::particleIDCalculation().

◆ IsPidInfoValid()

bool Tof2PID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 22 of file Tof2PID.h.

22{return (m_ndof > 0); }

Referenced by TofPID::particleIDCalculation().

◆ LikelihoodCalculation()

int Tof2PID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 38 of file Tof2PID.h.

38{return -1;}

◆ mass2()

double Tof2PID::mass2 ( ) const
inline

Definition at line 28 of file Tof2PID.h.

28{return m_mass2;}

◆ ndof()

int Tof2PID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 27 of file Tof2PID.h.

27{return m_ndof;}

◆ neuronPID()

int Tof2PID::neuronPID ( ) const
inline

Definition at line 33 of file Tof2PID.h.

33{return -1;}

◆ neuronPIDCalculation()

int Tof2PID::neuronPIDCalculation ( )
inlineprotected

Definition at line 37 of file Tof2PID.h.

37{return -1;}

◆ offset()

double Tof2PID::offset ( int n) const
inline

Definition at line 25 of file Tof2PID.h.

25{return m_offset[n];}

Referenced by offsetTof2(), and TofPID::particleIDCalculation().

◆ offsetTof2()

double Tof2PID::offsetTof2 ( int n,
int cntr,
double ptrk,
double ztof,
double m_ph2,
double charge )
protected

Definition at line 153 of file Tof2PID.cxx.

153 {
154 double offset;
155 // double gb = ptrk/xmass(n);
156 double betagamma;
157 switch(n) {
158
159 case 0: { // Electron
160 offset = 0.0;
161 return offset;
162 }
163
164 case 1: { // Muon
165 offset = 0.0;
166 return offset;
167 }
168
169 case 2: { // Pion
170 betagamma=ptrk/139.57;
171 break;
172 }
173 case 3: { // Kaon
174 betagamma=ptrk/493.68;
175 break;
176 }
177
178 case 4: { // Proton
179 betagamma=ptrk/938.27;
180 break;
181 }
182
183 default: {
184 offset = 0.0;
185 return offset;
186 }
187 break;
188 }
189 z=z/1000.0;
190 double Q = ph;
191 double beta = betagamma / TMath::Sqrt(1 + betagamma*betagamma);
192 double Q0 = sampleQ0(betagamma,beta);
193 double func[15]= {0.};
194 func[0]=1.;
195 func[1]=1./sqrt(Q);
196 func[2]=z/sqrt(Q);
197 func[3]=z*z/sqrt(Q);
198 func[4]=Q;
199 func[5]=Q*Q;
200 func[6]=Q*Q*Q;
201 func[7]=1./(0.89*0.89+z*z);
202 func[8]=z;
203 func[9]=z*z;
204 func[10]=z*z*z;
205 func[11]=1./sqrt(Q0);
206 func[12]=z/sqrt(Q0);
207 func[13]=z*z/sqrt(Q0);
208 func[14]=z*z*z/sqrt(Q0);
209 offset=0.;
210 for(int i=0; i<15; i++) {
211 offset+= m_pars[i]*func[i];
212 }
213
214 return offset;
215}
double offset(int n) const
Definition Tof2PID.h:25
double sampleQ0(double betagamma, double beta)
Definition Tof2PID.cxx:258
float ptrk

◆ particleIDCalculation()

int Tof2PID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

Definition at line 62 of file Tof2PID.cxx.

62 {
63 int irc = -1;
64 EvtRecTrack* recTrk = PidTrk();
65 if(!(recTrk->isMdcTrackValid())) return irc;
66 RecMdcTrack* mdcTrk = recTrk->mdcTrack();
67
68 double ptrk = mdcTrk->p();
69 // double cost = cos(mdcTrk->theta());
70 double charge = mdcTrk->charge();
71
72 if(!(recTrk->isTofTrackValid())) return irc;
73
74#ifndef BEAN
75 SmartRefVector<RecTofTrack> tofTrk = recTrk->tofTrack();
76 SmartRefVector<RecTofTrack>::iterator it;//=tofTrk.begin();
77#else
78 const std::vector<TTofTrack* >& tofTrk = recTrk->tofTrack();
79 std::vector<TTofTrack* >::const_iterator it;//=tofTrk.begin();
80#endif
81
82 TofHitStatus *hitst = new TofHitStatus;
83 std::vector<int> tof2count;
84 int goodtof2trk=0;
85 for(it = tofTrk.begin(); it!=tofTrk.end(); it++,goodtof2trk++) {
86 unsigned int st = (*it)->status();
87 hitst->setStatus(st);
88
89 if( !(hitst->is_barrel()) ) continue;
90 if( !(hitst->is_counter()) ) continue;
91 if( hitst->layer()==2 ) tof2count.push_back(goodtof2trk);
92 }
93 delete hitst;
94
95 if(tof2count.size()!=1) return irc;//not tof2 track or more than 1 tracks
96 it = tofTrk.begin()+tof2count[0];
97 double tof = (*it)->tof();
98 m_tof2 = tof;
99
100 if(tof <=0 ) return irc;
101 // int qual = (*it)->quality();
102 // if(qual != 1) return irc;
103 int cntr = (*it)->tofID();
104 double path = ((*it)->path())*10.0;//the unit from mm to cm
105
106 m_path2 = path;
107 // m_path2 = path;
108 // fix the bugs the 6.0.0, He K.L.
109 // double path = tofTrk->getPath1();
110 //
111 m_ph2 = (*it)->ph();
112 m_zhit2 = ((*it)->zrhit())*10; //the unit from mm to cm
113
114 double beta2 = path*path/velc()/velc()/tof/tof;
115 m_mass2 = ptrk * ptrk * (1/beta2 -1);
116 if ((m_mass2>20)||(m_mass2<-1)) return irc;
117
118 double chitemp = 99.;
119 double pdftemp = 0;
120 double sig_tmp = (*it)->sigma(0);
121 for(int i = 0; i < 5; i++) {
122 m_offset[i] = tof - (*it)->texp(i)-(*it)->toffset(i);//- offsetTof1(i, cntr, ptrk, m_zhit1, m_ph1,charge);
123 if(sig_tmp!=0) {
124 m_sigma[i] = 1.2*sig_tmp;
125 if(i<2) m_sigma[i]=sig_tmp;
126 }
127 else m_sigma[i]= sigmaTof2(i, cntr,ptrk,m_zhit2, m_ph2,charge);
128 m_chi[i] = m_offset[i]/m_sigma[i];
129 if(fabs(m_chi[i]) < chitemp) chitemp = fabs(m_chi[i]);
130 double ppp = pdfCalculate(m_chi[i],1);
131 if(fabs(ppp) > pdftemp) pdftemp = fabs(ppp);
132 }
133 // if(ptrk<0.65) m_chi[2]=m_chi[3];
134 m_chimin = chitemp;
135 m_pdfmin = pdftemp;
136 if(pdftemp < pdfCalculate(pdfMinSigmaCut(),1)) return irc;
137 if(fabs(m_chimin) > chiMinCut()) return irc;
138
139 // calculate prob
140
141 for(int i = 0; i < 5; i++) {
142 m_prob[i] = probCalculate(m_chi[i]*m_chi[i], 1);
143 }
144 irc = 0;
145 return irc;
146}
const int charge() const
Definition DstMdcTrack.h:53
const double p() const
Definition DstMdcTrack.h:58
SmartRefVector< RecTofTrack > tofTrack()
Definition EvtRecTrack.h:57
bool isTofTrackValid()
Definition EvtRecTrack.h:46
bool isMdcTrackValid()
Definition EvtRecTrack.h:43
RecMdcTrack * mdcTrack()
Definition EvtRecTrack.h:53
double chiMinCut() const
EvtRecTrack * PidTrk() const
double probCalculate(double chi2, int n)
double pdfCalculate(double offset, double sigma)
double pdfMinSigmaCut() const
static std::string path
double sigmaTof2(int n, int cntr, double ptrk, double ztof, double m_ph2, double charge)
Definition Tof2PID.cxx:217
bool is_barrel() const
unsigned int layer() const
void setStatus(unsigned int status)
bool is_counter() const

Referenced by calculate().

◆ path2()

double Tof2PID::path2 ( ) const
inline

Definition at line 31 of file Tof2PID.h.

31{return m_path2;}

◆ ph2()

double Tof2PID::ph2 ( ) const
inline

Definition at line 29 of file Tof2PID.h.

29{return m_ph2;}

◆ prob()

double Tof2PID::prob ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 26 of file Tof2PID.h.

26{return m_prob[n];}

◆ sampleQ0()

double Tof2PID::sampleQ0 ( double betagamma,
double beta )
protected

Definition at line 258 of file Tof2PID.cxx.

258 {
259 double p1 = 0.261;
260 double p2 = 5.43;
261 double p3 = 1.12;
262 double p4 = 1.96;
263 double p5 = 0.386;
264 double val = p1 / TMath::Power(beta, p4) *
265 ( p2- TMath::Power(beta, p4) -
266 TMath::Log(p3 + TMath::Power(1/betagamma, p5)));
267
268 return val*100.;
269}
double p1[4]
double p2[4]
double double double * p4
Definition qcdloop1.h:77
double double * p3
Definition qcdloop1.h:76

Referenced by offsetTof2().

◆ sigma()

double Tof2PID::sigma ( int n) const
inline

Definition at line 24 of file Tof2PID.h.

24{return m_sigma[n];}

Referenced by TofPID::particleIDCalculation().

◆ sigmaTof2()

double Tof2PID::sigmaTof2 ( int n,
int cntr,
double ptrk,
double ztof,
double m_ph2,
double charge )
protected

Definition at line 217 of file Tof2PID.cxx.

217 {
218 double sigma;
219 // double gb = ptrk/xmass(n);
220 double cosz = cos(ztof/1000.0);
221 // double phtemp=ph;
222 switch(n) {
223
224 case 0: { // Electron
225 sigma = 0.115816 -0.0933215*cosz+ 0.0788252*cosz*cosz;
226 break;
227 }
228
229 case 1: { // Muon
230 sigma = 0.121536 -0.0935898*cosz+0.0748771*cosz*cosz;
231 break;
232 }
233
234 case 2: { // Pion
235 sigma = 0.106882-0.0147375*cosz+0.027491*cosz*cosz;
236 break;
237 }
238 case 3: { // Kaon
239 sigma =0.106882 -0.0147375*cosz +0.027491 *cosz*cosz;
240 break;
241 }
242
243 case 4: { // Proton
244 sigma = 0.168489 -0.131762*cosz+ 0.105708*cosz*cosz;
245 break;
246 }
247
248 default:
249 sigma = 0.100;
250 break;
251 }
252 sigma = 0.110;
253 //sigma = 1.0;
254 return sigma;
255}
double cos(const BesAngle a)
Definition BesAngle.h:213
TTree * sigma

Referenced by particleIDCalculation().

◆ tof2()

double Tof2PID::tof2 ( ) const
inline

Definition at line 32 of file Tof2PID.h.

32{return m_tof2;}

◆ zhit2()

double Tof2PID::zhit2 ( ) const
inline

Definition at line 30 of file Tof2PID.h.

30{return m_zhit2;}

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