BOSS 7.1.2
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
 
- 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 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)
 
- Protected Member Functions inherited from ParticleIDBase

Additional Inherited Members

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

Detailed Description

Definition at line 13 of file TofEPID.h.

Constructor & Destructor Documentation

◆ ~TofEPID()

TofEPID::~TofEPID ( )
inline

Definition at line 17 of file TofEPID.h.

17{;}

Member Function Documentation

◆ calculate()

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

◆ chi()

double TofEPID::chi ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 22 of file TofEPID.h.

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

◆ init()

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}

◆ instance()

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}

◆ IsPidInfoValid()

bool TofEPID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 21 of file TofEPID.h.

21{return (m_ndof > 0); }

◆ LikelihoodCalculation()

int TofEPID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 35 of file TofEPID.h.

35{return -1;}

◆ mass2()

double TofEPID::mass2 ( ) const
inline

Definition at line 27 of file TofEPID.h.

27{return m_mass2;}

◆ ndof()

int TofEPID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 26 of file TofEPID.h.

26{return m_ndof;}

◆ neuronPID()

int TofEPID::neuronPID ( ) const
inline

Definition at line 30 of file TofEPID.h.

30{return -1;}

◆ neuronPIDCalculation()

int TofEPID::neuronPIDCalculation ( )
inlineprotected

Definition at line 33 of file TofEPID.h.

33{ return -1;}

◆ offset()

double TofEPID::offset ( int n) const
inline

Definition at line 25 of file TofEPID.h.

25{return m_offset[n];}

Referenced by offsetTofE().

◆ offsetTofE()

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

Definition at line 158 of file TofEPID.cxx.

158 {
159 double offset;
160 // double gb = ptrk/xmass(n);
161 switch(n) {
162 case 0: { // Electron
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*(-28.8481+138.159*plog-249.334*plog*plog);
168 break;
169 }
170
171 case 1: { // Muon
172 double ptemp = ptrk;
173 if(ptrk<0.2) ptemp = 0.2;
174 if(ptrk > 2.1) ptemp = 2.1;
175 double plog = log(ptemp);
176 offset = 0.001*(-33.6966+1.91915*plog-0.592320*plog*plog);
177 break;
178 }
179 case 2: { // Pion
180 double ptemp = ptrk;
181 if(ptrk<0.2) ptemp = 0.2;
182 if(ptrk > 2.1) ptemp = 2.1;
183 double plog = log(ptemp);
184 offset = 0.001*(-27.9965 + 1.213 * plog - 2.02740 * plog * plog);
185 break;
186 }
187 case 3: { // Kaon
188 double ptemp = ptrk;
189 if(ptrk<0.3) ptemp = 0.3;
190 if(ptrk > 2.1) ptemp = 2.1;
191 double plog = log(ptemp);
192 offset = 0.001*(-23.4842 -28.7569 * plog + 78.21* plog *plog);
193 break;
194 }
195
196 case 4: { // Proton
197 double ptemp = ptrk;
198 if(ptrk<0.4) ptemp = 0.4;
199 if(ptrk > 2.1) ptemp = 2.1;
200 double plog = log(ptemp);
201 if(charge>0)
202 offset = 0.001*(-4.854-110.540*plog+99.8732*plog*plog);
203 if(charge<0)
204 offset = 0.001*(27.047-145.120*plog+167.014*plog*plog);
205 break;
206 }
207
208 default:
209 offset = 0.0;
210 break;
211 }
212 // offset = 0.0;
213 return offset;
214}
double offset(int n) const
Definition TofEPID.h:25
float ptrk

◆ part()

int TofEPID::part ( ) const
inline

Definition at line 28 of file TofEPID.h.

28{return m_part;}

◆ particleIDCalculation()

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 int strip = (*it)->strip();
117 if( strip<0 || strip>11 ) { m_sigma[i] = 0.065; }
118 else {
119 double p0, p1;
120 if( strip==0 ) { p0=0.16; p1=0.0; }
121 else if( strip==1 ) { p0=0.051094; p1=0.019467; }
122 else if( strip==2 ) { p0=0.056019; p1=0.012964; }
123 else if( strip==3 ) { p0=0.043901; p1=0.015933; }
124 else if( strip==4 ) { p0=0.049750; p1=0.010473; }
125 else if( strip==5 ) { p0=0.048345; p1=0.008545; }
126 else if( strip==6 ) { p0=0.046518; p1=0.009038; }
127 else if( strip==7 ) { p0=0.048803; p1=0.007251; }
128 else if( strip==8 ) { p0=0.047523; p1=0.008434; }
129 else if( strip==9 ) { p0=0.042187; p1=0.010307; }
130 else if( strip==10 ) { p0=0.050337; p1=0.005951; }
131 else if( strip==11 ) { p0=0.054740; p1=0.005629; }
132 if( ptrk<0.05 ) { m_sigma[i] = p0+p1/0.05; }
133 else { m_sigma[i] = p0+p1/ptrk; }
134 }
135 }
136 m_chi[i] = m_offset[i]/m_sigma[i];
137
138 if( fabs(m_chi[i]) < chitemp ) { chitemp = fabs(m_chi[i]); }
139 double ppp = pdfCalculate(m_chi[i],1);
140 if( fabs(ppp) > pdftemp ) { pdftemp = fabs(ppp); }
141 }
142 m_chimin = chitemp;
143 // if( pdftemp < pdfCalculate(pdfMinSigmaCut(),1) ) { return irc; }
144 // if( fabs(m_chimin) > chiMinCut() ) { return irc; }
145
146 for( unsigned int i=0; i<5; i++ ) {
147 m_prob[i] = probCalculate( m_chi[i]*m_chi[i], 1 );
148 }
149
150 irc = 0;
151 return irc;
152}
double p1[4]
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
EvtRecTrack * PidTrk() const
double probCalculate(double chi2, int n)
double pdfCalculate(double offset, double sigma)
static std::string path
bool is_cluster() const
void setStatus(unsigned int status)
bool is_mrpc() const
bool is_counter() const
bool is_readout() const
bool is_raw() const

Referenced by calculate().

◆ prob()

double TofEPID::prob ( int n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 23 of file TofEPID.h.

23{return m_prob[n];}

◆ rhit()

double TofEPID::rhit ( ) const
inline

Definition at line 29 of file TofEPID.h.

29{return m_rhit;}

◆ sigma()

double TofEPID::sigma ( int n) const
inline

Definition at line 24 of file TofEPID.h.

24{return m_sigma[n];}

◆ sigmaTofE()

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

Definition at line 216 of file TofEPID.cxx.

216 {
217
218 double sigma;
219 // double gb = ptrk/xmass(n);
220 switch(n) {
221
222 case 0: { // Electron
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 * (109.974 +15.2457 * plog + 36.8139 * plog * plog);
228
229 break;
230 }
231
232 case 1: { // Muon
233 double ptemp = ptrk;
234 if(ptrk < 0.2) ptemp = 0.2;
235 if(ptrk > 2.1) ptemp = 2.1;
236 double plog = log(ptemp);
237 sigma = 0.001 * (96.5077 -2.96232 * plog + 3.12910 * plog * plog);
238 break;
239 }
240
241 case 2: { // pion
242 double ptemp = ptrk;
243 if(ptrk < 0.2) ptemp = 0.2;
244 if(ptrk > 2.1) ptemp = 2.1;
245 double plog = log(ptemp);
246 sigma = 0.001 * (105.447 - 2.08044 * plog + 3.44846 * plog * plog);
247 break;
248 }
249
250 case 3: { // Kaon
251 double ptemp = ptrk;
252 if(ptrk < 0.3) ptemp = 0.3;
253 if(ptrk > 2.1) ptemp = 2.1;
254 double plog = log(ptemp);
255 sigma = 0.001*(88.8806 - 26.8464 * plog + 113.672 * plog * plog);
256 break;
257 }
258 case 4: { // Proton
259 double ptemp = ptrk;
260 if(ptrk < 0.5) ptemp = 0.5;
261 if(ptrk > 2.1) ptemp = 2.1;
262 double plog = log(ptemp);
263 if(charge>0)
264 sigma = 0.001 * (96.3534 -44.1139 * plog + 53.9805 * plog * plog);
265 if(charge<0)
266 sigma = 0.001 * (157.345 -98.7357 * plog + 55.1145 * plog * plog);
267 break;
268 }
269
270 default:
271 sigma = 0.100;
272
273 break;
274 }
275 // sigma =1;
276 return sigma;
277}
TTree * sigma

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