BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
Tof1PID Class Reference

#include <Tof1PID.h>

+ Inheritance diagram for Tof1PID:

Public Member Functions

 ~Tof1PID ()
 
void init ()
 
void calculate ()
 
bool IsPidInfoValid () const
 
double chi (int n) const
 
double prob (int n) const
 
double offset (int n) const
 
double sigma (int n) const
 
int ndof () const
 
double mass2 () const
 
double ph1 () const
 
double zhit1 () const
 
double path1 () const
 
double tof1 () 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)
 

Static Public Member Functions

static Tof1PIDinstance ()
 

Protected Member Functions

int particleIDCalculation ()
 
int neuronPIDCalculation ()
 
int LikelihoodCalculation ()
 
double offsetTof1 (int n, int cntr, double ptrk, double ztof, double m_ph1, double charge)
 
double sigmaTof1 (int n, int cntr, double ptrk, double ztof, double m_ph1, double charge)
 
double sampleQ0 (double betagamma, double beta)
 
virtual int particleIDCalculation ()=0
 
virtual int LikelihoodCalculation ()=0
 

Additional Inherited Members

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

Detailed Description

Definition at line 14 of file Tof1PID.h.

Constructor & Destructor Documentation

◆ ~Tof1PID()

Tof1PID::~Tof1PID ( )
inline

Definition at line 19 of file Tof1PID.h.

19{;}

Member Function Documentation

◆ calculate()

void Tof1PID::calculate ( )
virtual

Implements ParticleIDBase.

Definition at line 55 of file Tof1PID.cxx.

55 {
56 if(particleIDCalculation() == 0) m_ndof=1;
57}
int particleIDCalculation()
Definition: Tof1PID.cxx:59

Referenced by TofPID::particleIDCalculation().

◆ chi()

double Tof1PID::chi ( int  n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 24 of file Tof1PID.h.

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

Referenced by TofPID::particleIDCalculation().

◆ init()

void Tof1PID::init ( )
virtual

Implements ParticleIDBase.

Definition at line 40 of file Tof1PID.cxx.

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

Referenced by TofPID::particleIDCalculation().

◆ instance()

Tof1PID * Tof1PID::instance ( )
static

Definition at line 16 of file Tof1PID.cxx.

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

Referenced by TofPID::particleIDCalculation().

◆ IsPidInfoValid()

bool Tof1PID::IsPidInfoValid ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 23 of file Tof1PID.h.

23{return (m_ndof > 0); }

Referenced by TofPID::particleIDCalculation().

◆ LikelihoodCalculation()

int Tof1PID::LikelihoodCalculation ( )
inlineprotectedvirtual

Implements ParticleIDBase.

Definition at line 40 of file Tof1PID.h.

40{return -1;}

◆ mass2()

double Tof1PID::mass2 ( ) const
inline

Definition at line 29 of file Tof1PID.h.

29{return m_mass2;}

◆ ndof()

int Tof1PID::ndof ( ) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 28 of file Tof1PID.h.

28{return m_ndof;}

◆ neuronPID()

int Tof1PID::neuronPID ( ) const
inline

Definition at line 34 of file Tof1PID.h.

34{return -1;}

◆ neuronPIDCalculation()

int Tof1PID::neuronPIDCalculation ( )
inlineprotected

Definition at line 39 of file Tof1PID.h.

39{ return -1;}

◆ offset()

double Tof1PID::offset ( int  n) const
inline

Definition at line 26 of file Tof1PID.h.

26{return m_offset[n];}

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

◆ offsetTof1()

double Tof1PID::offsetTof1 ( int  n,
int  cntr,
double  ptrk,
double  ztof,
double  m_ph1,
double  charge 
)
protected

Definition at line 137 of file Tof1PID.cxx.

137 {
138 double offset;
139 // double gb = ptrk/xmass(n);
140 double betagamma;
141 switch(n) {
142
143 case 0: { // Electron
144 offset = 0.0;
145 return offset;
146 }
147
148 case 1: { // Muon
149 offset = 0.0;
150 return offset;
151 }
152
153 case 2: { // Pion
154 betagamma=ptrk/139.57;
155 break;
156 }
157 case 3: { // Kaon
158 betagamma=ptrk/493.68;
159 break;
160 }
161
162 case 4: { // Proton
163 betagamma=ptrk/938.27;
164 break;
165 }
166
167 default: {
168 offset = 0.0;
169 return offset;
170 }
171 break;
172 }
173 double Q = ph1;
174 z=z/1000.0;
175 double beta = betagamma / TMath::Sqrt(1 + betagamma*betagamma);
176 double Q0 = sampleQ0(betagamma,beta);
177 double func[15]= {0.};
178 func[0]=1.;
179 func[1]=1./sqrt(Q);
180 func[2]=z/sqrt(Q);
181 func[3]=z*z/sqrt(Q);
182 func[4]=Q;
183 func[5]=Q*Q;
184 func[6]=Q*Q*Q;
185 func[7]=1./(0.84*0.84+z*z);
186 func[8]=z;
187 func[9]=z*z;
188 func[10]=z*z*z;
189 func[11]=1./sqrt(Q0);
190 func[12]=z/sqrt(Q0);
191 func[13]=z*z/sqrt(Q0);
192 func[14]=z*z*z/sqrt(Q0);
193 offset=0.;
194 for(int i=0; i<15; i++) {
195 offset+= m_pars[i]*func[i];
196 }
197
198 return offset;
199}
double sampleQ0(double betagamma, double beta)
Definition: Tof1PID.cxx:242
double offset(int n) const
Definition: Tof1PID.h:26
double ph1() const
Definition: Tof1PID.h:30
float ptrk

◆ particleIDCalculation()

int Tof1PID::particleIDCalculation ( )
protectedvirtual

Implements ParticleIDBase.

Definition at line 59 of file Tof1PID.cxx.

59 {
60 int irc = -1;
61
62 EvtRecTrack* recTrk = PidTrk();
63 if(!(recTrk->isMdcTrackValid())) return irc;
64 RecMdcTrack* mdcTrk = recTrk->mdcTrack();
65 double ptrk = mdcTrk->p();
66 double charge = mdcTrk->charge();
67 // double cost = cos(mdcTrk->theta());
68 if(!(recTrk->isTofTrackValid())) return irc;
69
70#ifndef BEAN
71 SmartRefVector<RecTofTrack> tofTrk = recTrk->tofTrack();
72 SmartRefVector<RecTofTrack>::iterator it;//=tofTrk.begin();
73#else
74 const std::vector<TTofTrack* >& tofTrk = recTrk->tofTrack();
75 std::vector<TTofTrack* >::const_iterator it;//=tofTrk.begin();
76#endif
77
78 TofHitStatus *hitst = new TofHitStatus;
79 std::vector<int> tof1count;
80 int goodtof1trk=0;
81 for(it = tofTrk.begin(); it!=tofTrk.end(); it++,goodtof1trk++) {
82 unsigned int st = (*it)->status();
83 hitst->setStatus(st);
84 if( !(hitst->is_barrel()) ) continue;
85 if( !(hitst->is_counter()) ) continue;
86 if( hitst->layer()==1 ) tof1count.push_back(goodtof1trk);
87 }
88 delete hitst;
89 if(tof1count.size()!=1) return irc;//not tof2 track or more than 1 tracks
90 it = tofTrk.begin()+tof1count[0];
91 double tof = (*it)->tof();
92 m_tof1 = tof;
93 // int qual = (*it)->quality();
94 // if(qual != 1) return irc;
95 int cntr = (*it)->tofID();
96 double path = ((*it)->path())*10.0;//the unit from mm to cm
97 m_path1 = path;
98 m_ph1 = (*it)->ph(); //no change
99 m_zhit1 = ((*it)->zrhit())*10;//the unit from mm to cm
100 double beta2 = path*path/velc()/velc()/tof/tof;
101 m_mass2 = ptrk * ptrk * (1/beta2 -1);
102 if ((m_mass2>20)||(m_mass2<-1)) return irc;
103 if(tof <=0 ) return irc;
104 double chitemp = 99.;
105 double pdftemp = 0;
106 double sigma_tmp= (*it)->sigma(0);
107 for(int i = 0; i < 5; i++) {
108
109 m_offset[i] = tof - (*it)->texp(i)-(*it)->toffset(i);//- offsetTof1(i, cntr, ptrk, m_zhit1, m_ph1,charge);
110 if(sigma_tmp!=0) {
111 m_sigma[i] = 1.2*sigma_tmp;
112 if(i<2) m_sigma[i]=sigma_tmp;
113 }
114 else m_sigma[i]=sigmaTof1(i, cntr,ptrk,m_zhit1, m_ph1,charge);
115 m_chi[i] = m_offset[i]/m_sigma[i];
116
117 if(fabs(m_chi[i]) < chitemp) chitemp = fabs(m_chi[i]);
118 double ppp = pdfCalculate(m_chi[i],1);
119 if(fabs(ppp) > pdftemp) pdftemp = fabs(ppp);
120 }
121 m_chimin = chitemp;
122 m_pdfmin = pdftemp;
123 if(pdftemp < pdfCalculate(pdfMinSigmaCut(),1)) return irc;
124 if(fabs(m_chimin) > chiMinCut()) return irc;
125 for(int i = 0; i < 5; i++) {
126 m_prob[i] = probCalculate(m_chi[i]*m_chi[i], 1);
127 }
128 irc = 0;
129 return irc;
130}
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 sigmaTof1(int n, int cntr, double ptrk, double ztof, double m_ph1, double charge)
Definition: Tof1PID.cxx:201
bool is_barrel() const
Definition: TofHitStatus.h:26
unsigned int layer() const
Definition: TofHitStatus.h:28
void setStatus(unsigned int status)
bool is_counter() const
Definition: TofHitStatus.h:24

Referenced by calculate().

◆ path1()

double Tof1PID::path1 ( ) const
inline

Definition at line 32 of file Tof1PID.h.

32{return m_path1;}

◆ ph1()

double Tof1PID::ph1 ( ) const
inline

Definition at line 30 of file Tof1PID.h.

30{return m_ph1;}

Referenced by offsetTof1().

◆ prob()

double Tof1PID::prob ( int  n) const
inlinevirtual

Implements ParticleIDBase.

Definition at line 25 of file Tof1PID.h.

25{return m_prob[n];}

◆ sampleQ0()

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

Definition at line 242 of file Tof1PID.cxx.

242 {
243 double val = 0.261/ TMath::Power(beta, 1.96) *( 5.43- TMath::Power(beta, 1.96) -TMath::Log(1.12 + TMath::Power(1/betagamma, 0.386)));
244 return val*100.;
245}

Referenced by offsetTof1().

◆ sigma()

double Tof1PID::sigma ( int  n) const
inline

Definition at line 27 of file Tof1PID.h.

27{return m_sigma[n];}

Referenced by TofPID::particleIDCalculation().

◆ sigmaTof1()

double Tof1PID::sigmaTof1 ( int  n,
int  cntr,
double  ptrk,
double  ztof,
double  m_ph1,
double  charge 
)
protected

Definition at line 201 of file Tof1PID.cxx.

201 {
202 double sigma;
203 // double gb = ptrk/xmass(n);
204 double cosz = cos(ztof/1000.0);
205
206 switch(n) {
207
208 case 0: { // Electron
209 sigma = 0.132405-0.135638*cosz+0.105528*cosz*cosz;
210 break;
211 }
212
213 case 1: { // Muon
214 sigma = 0.164057 -0.199648*cosz+ 0.139481*cosz*cosz;
215 break;
216 }
217
218 case 2: { // Pion
219 sigma = 0.132943-0.0996678*cosz+0.0785578*cosz*cosz;
220 break;
221 }
222 case 3: { // Kaon
223 sigma = 0.146572 -0.124672*cosz+0.0920656*cosz*cosz;
224 break;
225 }
226
227 case 4: { // Proton
228 sigma = 0.1513 -0.0806081*cosz+0.0607409*cosz*cosz;
229 break;
230 }
231
232 default:
233 sigma = 0.100;
234 break;
235 }
236 sigma = 0.110;
237 //sigma = 1.0;
238 return sigma;
239}
double cos(const BesAngle a)
Definition: BesAngle.h:213
TTree * sigma

Referenced by particleIDCalculation().

◆ tof1()

double Tof1PID::tof1 ( ) const
inline

Definition at line 33 of file Tof1PID.h.

33{return m_tof1;}

◆ zhit1()

double Tof1PID::zhit1 ( ) const
inline

Definition at line 31 of file Tof1PID.h.

31{return m_zhit1;}

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