CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
TofEPID Class Reference

#include <TofEPID.h>

+ Inheritance diagram for TofEPID:

Public Member Functions

 ~TofEPID ()
 
void init ()
 
void calculate ()
 
bool IsPidInfoValid () const
 
double chi (int n) const
 
double prob (int n) const
 
double sigma (int n) const
 
double offset (int n) const
 
int ndof () const
 
double mass2 () const
 
int part () const
 
double rhit () const
 
int neuronPID () const
 
 ~TofEPID ()
 
void init ()
 
void calculate ()
 
bool IsPidInfoValid () const
 
double chi (int n) const
 
double prob (int n) const
 
double sigma (int n) const
 
double offset (int n) const
 
int ndof () const
 
double mass2 () const
 
int part () const
 
double rhit () const
 
int neuronPID () const
 
- Public Member Functions inherited from ParticleIDBase
 ParticleIDBase ()
 
virtual ~ParticleIDBase ()
 
virtual void init ()=0
 
virtual void calculate ()=0
 
virtual bool IsPidInfoValid () const =0
 
virtual double chi (int n) const =0
 
virtual double prob (int n) const =0
 
virtual int ndof () const =0
 
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)
 
 ParticleIDBase ()
 
virtual ~ParticleIDBase ()
 
virtual void init ()=0
 
virtual void calculate ()=0
 
virtual bool IsPidInfoValid () const =0
 
virtual double chi (int n) const =0
 
virtual double prob (int n) const =0
 
virtual int ndof () const =0
 
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 TofEPIDinstance ()
 
static TofEPIDinstance ()
 

Protected Member Functions

int neuronPIDCalculation ()
 
int particleIDCalculation ()
 
int LikelihoodCalculation ()
 
double offsetTofE (int n, int cntr, double ptrk, double rtof, double ph, double charge)
 
double sigmaTofE (int n, int cntr, double ptrk, double rtof, double ph, double charge)
 
int neuronPIDCalculation ()
 
int particleIDCalculation ()
 
int LikelihoodCalculation ()
 
double offsetTofE (int n, int cntr, double ptrk, double rtof, double ph, double charge)
 
double sigmaTofE (int n, int cntr, double ptrk, double rtof, double ph, double charge)
 
virtual int particleIDCalculation ()=0
 
virtual int LikelihoodCalculation ()=0
 
virtual int particleIDCalculation ()=0
 
virtual int LikelihoodCalculation ()=0
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ ~TofEPID() [1/2]

TofEPID::~TofEPID ( )
inline

◆ ~TofEPID() [2/2]

TofEPID::~TofEPID ( )
inline

Definition at line 17 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

17{;}

Member Function Documentation

◆ calculate() [1/2]

void TofEPID::calculate ( )
virtual

Implements ParticleIDBase.

Definition at line 39 of file TofEPID.cxx.

39 {
40 if(particleIDCalculation()==0) m_ndof=1;
41}
int particleIDCalculation()
Definition: TofEPID.cxx:43

◆ calculate() [2/2]

void TofEPID::calculate ( )
virtual

Implements ParticleIDBase.

◆ chi() [1/2]

double TofEPID::chi ( int  n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 22 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

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

◆ chi() [2/2]

double TofEPID::chi ( int  n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 22 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

22{return m_chi[n];}

◆ init() [1/2]

void TofEPID::init ( )
virtual

Implements ParticleIDBase.

Definition at line 25 of file TofEPID.cxx.

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

◆ init() [2/2]

void TofEPID::init ( )
virtual

Implements ParticleIDBase.

◆ instance() [1/2]

TofEPID * TofEPID::instance ( )
static

Definition at line 16 of file TofEPID.cxx.

16 {
17 if(!m_pointer) m_pointer = new TofEPID();
18 return m_pointer;
19}

◆ instance() [2/2]

static TofEPID * TofEPID::instance ( )
static

◆ IsPidInfoValid() [1/2]

bool TofEPID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 21 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

21{return (m_ndof > 0); }

◆ IsPidInfoValid() [2/2]

bool TofEPID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 21 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

21{return (m_ndof > 0); }

◆ LikelihoodCalculation() [1/2]

int TofEPID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 35 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

35{return -1;}

◆ LikelihoodCalculation() [2/2]

int TofEPID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 35 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

35{return -1;}

◆ mass2() [1/2]

double TofEPID::mass2 ( ) const
inline

Definition at line 27 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

27{return m_mass2;}

◆ mass2() [2/2]

double TofEPID::mass2 ( ) const
inline

Definition at line 27 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

27{return m_mass2;}

◆ ndof() [1/2]

int TofEPID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 26 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

26{return m_ndof;}

◆ ndof() [2/2]

int TofEPID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 26 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

26{return m_ndof;}

◆ neuronPID() [1/2]

int TofEPID::neuronPID ( ) const
inline

Definition at line 30 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

30{return -1;}

◆ neuronPID() [2/2]

int TofEPID::neuronPID ( ) const
inline

Definition at line 30 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

30{return -1;}

◆ neuronPIDCalculation() [1/2]

int TofEPID::neuronPIDCalculation ( )
inlineprotected

Definition at line 33 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

33{ return -1;}

◆ neuronPIDCalculation() [2/2]

int TofEPID::neuronPIDCalculation ( )
inlineprotected

Definition at line 33 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

33{ return -1;}

◆ offset() [1/2]

double TofEPID::offset ( int  n) const
inline

Definition at line 25 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

25{return m_offset[n];}

Referenced by offsetTofE().

◆ offset() [2/2]

double TofEPID::offset ( int  n) const
inline

Definition at line 25 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

25{return m_offset[n];}

◆ offsetTofE() [1/2]

double TofEPID::offsetTofE ( int  n,
int  cntr,
double  ptrk,
double  rtof,
double  ph,
double  charge 
)
protected

Definition at line 141 of file TofEPID.cxx.

141 {
142 double offset;
143 // double gb = ptrk/xmass(n);
144 switch(n) {
145 case 0: { // Electron
146 double ptemp = ptrk;
147 if(ptrk<0.2) ptemp = 0.2;
148 if(ptrk > 2.1) ptemp = 2.1;
149 double plog = log(ptemp);
150 offset = 0.001*(-28.8481+138.159*plog-249.334*plog*plog);
151 break;
152 }
153
154 case 1: { // Muon
155 double ptemp = ptrk;
156 if(ptrk<0.2) ptemp = 0.2;
157 if(ptrk > 2.1) ptemp = 2.1;
158 double plog = log(ptemp);
159 offset = 0.001*(-33.6966+1.91915*plog-0.592320*plog*plog);
160 break;
161 }
162 case 2: { // Pion
163 double ptemp = ptrk;
164 if(ptrk<0.2) ptemp = 0.2;
165 if(ptrk > 2.1) ptemp = 2.1;
166 double plog = log(ptemp);
167 offset = 0.001*(-27.9965 + 1.213 * plog - 2.02740 * plog * plog);
168 break;
169 }
170 case 3: { // Kaon
171 double ptemp = ptrk;
172 if(ptrk<0.3) ptemp = 0.3;
173 if(ptrk > 2.1) ptemp = 2.1;
174 double plog = log(ptemp);
175 offset = 0.001*(-23.4842 -28.7569 * plog + 78.21* plog *plog);
176 break;
177 }
178
179 case 4: { // Proton
180 double ptemp = ptrk;
181 if(ptrk<0.4) ptemp = 0.4;
182 if(ptrk > 2.1) ptemp = 2.1;
183 double plog = log(ptemp);
184 if(charge>0)
185 offset = 0.001*(-4.854-110.540*plog+99.8732*plog*plog);
186 if(charge<0)
187 offset = 0.001*(27.047-145.120*plog+167.014*plog*plog);
188 break;
189 }
190
191 default:
192 offset = 0.0;
193 break;
194 }
195 // offset = 0.0;
196 return offset;
197}

◆ offsetTofE() [2/2]

double TofEPID::offsetTofE ( int  n,
int  cntr,
double  ptrk,
double  rtof,
double  ph,
double  charge 
)
protected

◆ part() [1/2]

int TofEPID::part ( ) const
inline

Definition at line 28 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

28{return m_part;}

◆ part() [2/2]

int TofEPID::part ( ) const
inline

Definition at line 28 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

28{return m_part;}

◆ particleIDCalculation() [1/2]

int TofEPID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

Definition at line 43 of file TofEPID.cxx.

43 {
44 int irc = -1;
45 EvtRecTrack* recTrk = PidTrk();
46 if(!(recTrk->isMdcTrackValid())) return irc;
47 RecMdcTrack* mdcTrk = recTrk->mdcTrack();
48
49 double ptrk = mdcTrk->p();
50 // double cost = cos(mdcTrk->theta());
51 // double charge = mdcTrk->charge();
52
53 if(!(recTrk->isTofTrackValid())) return irc;
54
55#ifndef BEAN
56 SmartRefVector<RecTofTrack> tofTrk = recTrk->tofTrack();
57 SmartRefVector<RecTofTrack>::iterator it;//=tofTrk.begin();
58#else
59 const std::vector<TTofTrack* >& tofTrk = recTrk->tofTrack();
60 std::vector<TTofTrack* >::const_iterator it;//=tofTrk.begin();
61#endif
62
63 TofHitStatus *hitst = new TofHitStatus;
64 std::vector<int> tofecount;
65 int goodtofetrk=0;
66 for(it = tofTrk.begin(); it!=tofTrk.end(); it++,goodtofetrk++) {
67 unsigned int st = (*it)->status();
68 hitst->setStatus(st);
69 if( (hitst->is_barrel()) ) continue;
70 if( !(hitst->is_counter()) ) continue;
71 if( hitst->layer()==1 ) tofecount.push_back(goodtofetrk);
72 }
73 delete hitst;
74 if(tofecount.size()!=1) return irc;//not tof2 track or more than 1 tracks
75 it = tofTrk.begin()+tofecount[0];
76
77
78 // int qual = (*it)->quality();
79 // if(qual != 1) return irc;
80 // int cntr = (*it)->tofID();
81 double tof = (*it)->tof();
82 if(tof <=0 ) return irc;
83 double path = (*it)->path();
84 // double m_ph = (*it)->ph();
85 m_rhit = (*it)->zrhit();
86 // m_part = tofTrk->getPart();
87
88 double beta2 = path*path/velc()/velc()/tof/tof;
89 m_mass2 = ptrk * ptrk * (1/beta2 -1);
90 // if ((m_mass2>20)||(m_mass2<-1)) return irc;
91
92
93 double chitemp = 99.;
94 double pdftemp = 0;
95 for(int i = 0; i < 5; i++) {
96 // double gb = ptrk/xmass(i);
97 // double beta = gb/sqrt(1+gb*gb);
98 double texp = (*it)->texp(i);
99 // path /beta/velc();
100 m_offset[i] = tof - texp-(*it)->toffset(i);// - offsetTofE(i, cntr, ptrk, m_rhit, m_ph,charge);
101 double sigma_tmp= (*it)->sigma(0);
102 /* if(fabs(sigma_tmp/1000.)>0.3) {
103 int tofid=(*it)->tofID();
104 // sigma_tmp=getSigbyRun(tofid)*0.1;
105 }*/
106
107 if(sigma_tmp!=0) {
108 m_sigma[i] = 1.2*sigma_tmp;
109 if(i<2) m_sigma[i]=sigma_tmp;
110 }
111 else m_sigma[i]=0.12;
112 // m_chi[i] = m_offset[i]/m_sigma[i];
113
114 // m_sigma[i]=sigma_tmp;
115 // if(i!=0) m_sigma[i] = sigma_tmp*1.1;
116 // m_sigma[i] = sigmaTofE(i, cntr,ptrk,m_rhit, m_ph,charge);
117 m_chi[i] = m_offset[i]/m_sigma[i];
118 if(fabs(m_chi[i]) < chitemp) chitemp = fabs(m_chi[i]);
119 double ppp = pdfCalculate(m_chi[i],1);
120 if(fabs(ppp) > pdftemp) pdftemp = fabs(ppp);
121 }
122 m_chimin = chitemp;
123 // if(m_chimin > chiMinCut() ) return irc;
124 // if(pdftemp < pdfCalculate(pdfMinSigmaCut(),1.0)) return irc;
125
126 // calculate prob
127
128 for(int i = 0; i < 5; i++)
129 m_prob[i] = probCalculate(m_chi[i]*m_chi[i], 1);
130
131 m_ndof = 1;
132 irc = 0;
133 return irc;
134}
double probCalculate(double chi2, int n)
double pdfCalculate(double offset, double sigma)
void setStatus(unsigned int status)

Referenced by calculate().

◆ particleIDCalculation() [2/2]

int TofEPID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

◆ prob() [1/2]

double TofEPID::prob ( int  n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 23 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

23{return m_prob[n];}

◆ prob() [2/2]

double TofEPID::prob ( int  n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 23 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

23{return m_prob[n];}

◆ rhit() [1/2]

double TofEPID::rhit ( ) const
inline

Definition at line 29 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

29{return m_rhit;}

◆ rhit() [2/2]

double TofEPID::rhit ( ) const
inline

Definition at line 29 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

29{return m_rhit;}

◆ sigma() [1/2]

double TofEPID::sigma ( int  n) const
inline

Definition at line 24 of file Analysis/ParticleID/ParticleID-00-04-55/ParticleID/TofEPID.h.

24{return m_sigma[n];}

Referenced by sigmaTofE().

◆ sigma() [2/2]

double TofEPID::sigma ( int  n) const
inline

Definition at line 24 of file InstallArea/include/ParticleID/ParticleID/TofEPID.h.

24{return m_sigma[n];}

◆ sigmaTofE() [1/2]

double TofEPID::sigmaTofE ( int  n,
int  cntr,
double  ptrk,
double  rtof,
double  ph,
double  charge 
)
protected

Definition at line 199 of file TofEPID.cxx.

199 {
200
201 double sigma;
202 // double gb = ptrk/xmass(n);
203 switch(n) {
204
205 case 0: { // Electron
206 double ptemp = ptrk;
207 if(ptrk < 0.2) ptemp = 0.2;
208 if(ptrk > 2.1) ptemp = 2.1;
209 double plog = log(ptemp);
210 sigma = 0.001 * (109.974 +15.2457 * plog + 36.8139 * plog * plog);
211
212 break;
213 }
214
215 case 1: { // Muon
216 double ptemp = ptrk;
217 if(ptrk < 0.2) ptemp = 0.2;
218 if(ptrk > 2.1) ptemp = 2.1;
219 double plog = log(ptemp);
220 sigma = 0.001 * (96.5077 -2.96232 * plog + 3.12910 * plog * plog);
221 break;
222 }
223
224 case 2: { // pion
225 double ptemp = ptrk;
226 if(ptrk < 0.2) ptemp = 0.2;
227 if(ptrk > 2.1) ptemp = 2.1;
228 double plog = log(ptemp);
229 sigma = 0.001 * (105.447 - 2.08044 * plog + 3.44846 * plog * plog);
230 break;
231 }
232
233 case 3: { // Kaon
234 double ptemp = ptrk;
235 if(ptrk < 0.3) ptemp = 0.3;
236 if(ptrk > 2.1) ptemp = 2.1;
237 double plog = log(ptemp);
238 sigma = 0.001*(88.8806 - 26.8464 * plog + 113.672 * plog * plog);
239 break;
240 }
241 case 4: { // Proton
242 double ptemp = ptrk;
243 if(ptrk < 0.5) ptemp = 0.5;
244 if(ptrk > 2.1) ptemp = 2.1;
245 double plog = log(ptemp);
246 if(charge>0)
247 sigma = 0.001 * (96.3534 -44.1139 * plog + 53.9805 * plog * plog);
248 if(charge<0)
249 sigma = 0.001 * (157.345 -98.7357 * plog + 55.1145 * plog * plog);
250 break;
251 }
252
253 default:
254 sigma = 0.100;
255
256 break;
257 }
258 // sigma =1;
259 return sigma;
260}

◆ sigmaTofE() [2/2]

double TofEPID::sigmaTofE ( int  n,
int  cntr,
double  ptrk,
double  rtof,
double  ph,
double  charge 
)
protected

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