3#include "ParticleID/TofEPID.h"
6#include "MdcRecEvent/RecMdcTrack.h"
7#include "TofRecEvent/RecTofTrack.h"
8#include "EvtRecEvent/EvtRecTrack.h"
9#include "DstEvent/TofHitStatus.h"
11#include "TofHitStatus.h"
14TofEPID * TofEPID::m_pointer = 0;
17 if(!m_pointer) m_pointer =
new TofEPID();
26 for(
int i = 0; i < 5; i++) {
50 SmartRefVector<RecTofTrack> tofTrackCol = recTrk->
tofTrack();
51 SmartRefVector<RecTofTrack>::iterator it;
53 const std::vector<TTofTrack* >& tofTrackCol = recTrk->
tofTrack();
54 std::vector<TTofTrack* >::const_iterator it;
58 if( tofTrackCol.size()!=1 && tofTrackCol.size()!=3 ) {
return irc; }
61 if( tofTrackCol.size()==1 ) {
62 it = tofTrackCol.begin();
64 bool isRaw = hitst->
is_raw();
65 if( isRaw ) {
return irc; }
70 if( !isReadout || !isCounter || !isCluster ) {
return irc; }
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++ ) {
77 bool isRaw = hitst->
is_raw();
80 if( !isMRPC ) {
return irc; }
84 if( !isReadout && isCounter && isCluster ) { icounter = inumber; }
86 if( icounter == -1 ) {
return irc; }
87 it = tofTrackCol.begin() + icounter;
91 double tof = (*it)->tof();
92 if( tof <= 0 ) {
return irc; }
93 double path = (*it)->path();
94 m_rhit = (*it)->zrhit();
96 double beta2 = beta*beta;
98 double ptrk = mdcTrk->
p();
99 m_mass2 =
ptrk*
ptrk*(1.0/beta2 -1.0);
101 double chitemp = 99.;
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);
109 if( i<2 ) { m_sigma[i] = sigma_tmp; }
110 else { m_sigma[i] = 1.2*sigma_tmp; }
112 else { m_sigma[i] = 0.12; }
116 int strip = (*it)->strip();
117 if( strip<0 || strip>11 ) { m_sigma[i] = 0.065; }
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; }
136 m_chi[i] = m_offset[i]/m_sigma[i];
138 if( fabs(m_chi[i]) < chitemp ) { chitemp = fabs(m_chi[i]); }
140 if( fabs(ppp) > pdftemp ) { pdftemp = fabs(ppp); }
146 for(
unsigned int i=0; i<5; i++ ) {
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);
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);
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);
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);
198 if(
ptrk<0.4) ptemp = 0.4;
199 if(
ptrk > 2.1) ptemp = 2.1;
200 double plog = log(ptemp);
202 offset = 0.001*(-4.854-110.540*plog+99.8732*plog*plog);
204 offset = 0.001*(27.047-145.120*plog+167.014*plog*plog);
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);
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);
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);
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);
260 if(
ptrk < 0.5) ptemp = 0.5;
261 if(
ptrk > 2.1) ptemp = 2.1;
262 double plog = log(ptemp);
264 sigma = 0.001 * (96.3534 -44.1139 * plog + 53.9805 * plog * plog);
266 sigma = 0.001 * (157.345 -98.7357 * plog + 55.1145 * plog * plog);
SmartRefVector< RecTofTrack > tofTrack()
EvtRecTrack * PidTrk() const
double probCalculate(double chi2, int n)
double pdfCalculate(double offset, double sigma)
double sigmaTofE(int n, int cntr, double ptrk, double rtof, double ph, double charge)
static TofEPID * instance()
int particleIDCalculation()
double offset(int n) const
double offsetTofE(int n, int cntr, double ptrk, double rtof, double ph, double charge)
void setStatus(unsigned int status)