BOSS 7.0.1
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 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)
 
 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 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 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-61/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-61/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-61/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-61/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-61/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-61/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-61/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-61/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 139 of file TofEPID.cxx.

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

◆ 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-61/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 if(!(recTrk->isTofTrackValid())) return irc;
48
49#ifndef BEAN
50 SmartRefVector<RecTofTrack> tofTrackCol = recTrk->tofTrack();
51 SmartRefVector<RecTofTrack>::iterator it;
52#else
53 const std::vector<TTofTrack* >& tofTrackCol = recTrk->tofTrack();
54 std::vector<TTofTrack* >::const_iterator it;
55#endif
56
57 bool isMRPC = false;
58 if( tofTrackCol.size()!=1 && tofTrackCol.size()!=3 ) { return irc; }
59 else {
60 TofHitStatus *hitst = new TofHitStatus;
61 if( tofTrackCol.size()==1 ) {
62 it = tofTrackCol.begin();
63 hitst->setStatus( (*it)->status() );
64 bool isRaw = hitst->is_raw();
65 if( isRaw ) { return irc; }
66 isMRPC = hitst->is_mrpc();
67 bool isReadout = hitst->is_readout();
68 bool isCounter = hitst->is_counter();
69 bool isCluster = hitst->is_cluster();
70 if( !isReadout || !isCounter || !isCluster ) { return irc; }
71 }
72 else if( tofTrackCol.size()==3 ) {
73 unsigned int icounter = -1;
74 unsigned int inumber = 0;
75 for( it = tofTrackCol.begin(); it != tofTrackCol.end(); it++, inumber++ ) {
76 hitst->setStatus( (*it)->status() );
77 bool isRaw = hitst->is_raw();
78 if( isRaw ) continue;
79 isMRPC = hitst->is_mrpc();
80 if( !isMRPC ) { return irc; } // MRPC is possible to have 3 record.
81 bool isReadout = hitst->is_readout();
82 bool isCounter = hitst->is_counter();
83 bool isCluster = hitst->is_cluster();
84 if( !isReadout && isCounter && isCluster ) { icounter = inumber; }
85 }
86 if( icounter == -1 ) { return irc; }
87 it = tofTrackCol.begin() + icounter;
88 }
89 }
90
91 double tof = (*it)->tof();
92 if( tof <= 0 ) { return irc; }
93 double path = (*it)->path();
94 m_rhit = (*it)->zrhit();
95 double beta = path/velc()/tof;
96 double beta2 = beta*beta;
97 RecMdcTrack* mdcTrk = recTrk->mdcTrack();
98 double ptrk = mdcTrk->p();
99 m_mass2 = ptrk*ptrk*(1.0/beta2 -1.0);
100
101 double chitemp = 99.;
102 double pdftemp = 0;
103 for( unsigned int i=0; i<5; i++ ) {
104 double texp = (*it)->texp(i);
105 m_offset[i] = tof - texp - (*it)->toffset(i);
106 double sigma_tmp = (*it)->sigma(0);
107 if( !isMRPC ) {
108 if( sigma_tmp>0 ) {
109 if( i<2 ) { m_sigma[i] = sigma_tmp; }
110 else { m_sigma[i] = 1.2*sigma_tmp; }
111 }
112 else { m_sigma[i] = 0.12; }
113 }
114 else {
115 m_sigma[i] = 0.065;
116 }
117 m_chi[i] = m_offset[i]/m_sigma[i];
118
119 if( fabs(m_chi[i]) < chitemp ) { chitemp = fabs(m_chi[i]); }
120 double ppp = pdfCalculate(m_chi[i],1);
121 if( fabs(ppp) > pdftemp ) { pdftemp = fabs(ppp); }
122 }
123 m_chimin = chitemp;
124 // if( pdftemp < pdfCalculate(pdfMinSigmaCut(),1) ) { return irc; }
125 // if( fabs(m_chimin) > chiMinCut() ) { return irc; }
126
127 for( unsigned int i=0; i<5; i++ ) {
128 m_prob[i] = probCalculate( m_chi[i]*m_chi[i], 1 );
129 }
130
131 irc = 0;
132 return irc;
133}
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-61/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-61/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-61/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 197 of file TofEPID.cxx.

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

◆ 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: