6 //-----------------------------------------------------------
7 Float_t AliITSPid::qcorr(Float_t xc)
11 fcorr=( 0.766 +0.9692*xc -1.267*xc*xc )*( 1.-TMath::Exp(-xc*64.75) );
12 if(fcorr<=0.1)fcorr=0.1;
16 //-----------------------------------------------------------
19 Float_t AliITSPid::qtrm(Int_t track)
21 TVector q(*( this->GetVec(track) ));
26 case 1:q(6)=q(1); break;
27 case 2:q(6)=(q(1)+q(2))/2.; break;
29 for(Int_t i=0;i<nl;i++){vf[i]=q(i+1);}
30 sort(vf.begin(),vf.end());
31 q(6)= (vf[0]+vf[1])/2.;
34 for(Int_t i=0;i<nl;i++){q(i+1)=vf[i];} this->SetVec(track,q);
37 //-----------------------------------------------------------
38 Int_t AliITSPid::wpik(Int_t nc,Float_t q)
42 Float_t qmpi,qmk,sigpi,sigk,dpi,dk,ppi,pk;
47 Float_t dqpi=(q-qmpi)/sigpi;
48 Float_t dqk =(q-qmk )/sigk;
49 if( dqk<-1. )return pion();
52 ppi =1.- TMath::Erf(dpi); // +0.5;
53 pk =1.- TMath::Erf(dk); // +0.5;
54 Float_t rpik=ppi/(pk+0.0000001);
55 cout<<"q,dqpi,dqk, wpik: ppi,pk,rpik="
56 <<q<<" "<<dqpi<<" "<<dqk<<" "<<ppi<<" "<<pk<<" "<<rpik<<endl;
57 if( rpik>=1000. ){return pion();}
58 if( rpik>0.001 ){fWk=1./(rpik+1.); fWpi=1.-fWk;return 0;}
61 //-----------------------------------------------------------
62 Int_t AliITSPid::wpikp(Int_t nc,Float_t q)
66 Float_t qmpi,qmk,qmp,sigpi,sigk,sigp,ppi,pka,ppr,rppi,rpka;
75 ppi =TMath::Erf( TMath::Abs((q-qmpi)/sigpi) )+0.5;
76 pka =TMath::Erf( TMath::Abs((q-qmk )/sigk) )+0.5;
77 ppr =TMath::Erf( TMath::Abs((q-qmp )/sigp) )+0.5;
82 if( rppi>rpka ) { rp=rpka; }
84 if( rp>=1000. ){ return proton(); }
85 if( rp>0.001 ){ fWp=rp/(rp+1.);return proton(); }
89 //-----------------------------------------------------------
90 Int_t AliITSPid::GetPcode(TClonesArray* rps,Float_t pm)
94 //-----------------------------------------------------------
95 Int_t AliITSPid::GetPcode(Float_t q,Float_t pm)
97 fWpi=fWk=fWp=-1.; fPcode=0;
103 { if( q<cut[2][2] ){ return pion(); } else { return kaon();} }
109 { if ( q<=cut[3][5] ) {return kaon();} else {return proton();}}
115 { if( q<=cut[4][4] ) {return kaon();} else {return proton(); }}
118 if ( q>cut[5][5] ) {return proton();} else {return wpik(5,q);};
121 if ( q>cut[6][5] ) {return proton();} else {return wpik(6,q);};
124 if ( q<=cut[7][5] ) {return fPcode;} else {return proton();};
127 if ( q<=cut[8][5] ) {return fPcode;} else {return proton();};
130 if ( q<=cut[9][5] ) {return fPcode;} else {return proton();};
132 if( pm<=cut[10][0] ){ return wpikp(10,q); }
134 if( pm<=cut[11][0] ){ return wpikp(11,q); }
136 if( pm<=cut[12][0] ){ return wpikp(12,q); }
140 //-----------------------------------------------------------
141 void AliITSPid::SetCut(Int_t n,Float_t pm,Float_t pilo,Float_t pihi,
142 Float_t klo,Float_t khi,Float_t plo,Float_t phi)
153 //-----------------------------------------------------------
154 void AliITSPid::SetVec(Int_t ntrack,TVector info)
156 TClonesArray& arr=*trs;
157 new( arr[ntrack] ) TVector(info);
159 //-----------------------------------------------------------
160 TVector* AliITSPid::GetVec(Int_t ntrack)
162 TClonesArray& arr=*trs;
163 return (TVector*)arr[ntrack];
165 //-----------------------------------------------------------
166 void AliITSPid::SetEdep(Int_t track,Float_t Edep)
169 if( ((TVector*)trs->At(track))->IsValid() )
170 {TVector yy( *((TVector*)trs->At(track)) );xx=yy; }
171 Int_t j=(Int_t)xx(0); if(j>4)return;
172 xx(++j)=Edep;xx(0)=j;
173 TClonesArray &arr=*trs;
174 new(arr[track])TVector(xx);
176 //-----------------------------------------------------------
177 void AliITSPid::SetPmom(Int_t track,Float_t Pmom)
180 if( ((TVector*)trs->At(track))->IsValid() )
181 {TVector yy( *((TVector*)trs->At(track)) );xx=yy; }
183 TClonesArray &arr=*trs;
184 new(arr[track])TVector(xx);
186 //-----------------------------------------------------------
187 void AliITSPid::SetPcod(Int_t track,Int_t partcode)
190 if( ((TVector*)trs->At(track))->IsValid() )
191 {TVector yy( *((TVector*)trs->At(track)) );xx=yy; }
193 {xx(11)=partcode; mxtrs++;
194 TClonesArray &arr=*trs;
195 new(arr[track])TVector(xx);
198 //-----------------------------------------------------------
199 void AliITSPid::Print(Int_t track)
200 {cout<<mxtrs<<" tracks in AliITSPid obj."<<endl;
201 if( ((TVector*)trs->At(track))->IsValid() )
202 {TVector xx( *((TVector*)trs->At(track)) );
206 {cout<<"No data for track "<<track<<endl;return;}
208 //-----------------------------------------------------------
209 void AliITSPid::Tab(void)
211 if(trs->GetEntries()==0){cout<<"No entries in TAB"<<endl;return;}
212 cout<<"------------------------------------------------------------------------"<<endl;
213 cout<<"Nq"<<" q1 "<<" q2 "<<" q3 "<<" q4 "<<" q5 "<<
214 " Qtrm " <<" Wpi "<<" Wk "<<" Wp "<<"Pmom "<<endl;
215 cout<<"------------------------------------------------------------------------"<<endl;
216 for(Int_t i=0;i<trs->GetEntries();i++)
218 TVector xx( *((TVector*)trs->At(i)) );
219 if( xx.IsValid() && xx(0)>0 )
221 TVector xx( *((TVector*)trs->At(i)) );
225 xx(6)=(this->qtrm(i));
230 // 2)Calculate Wpi,Wk,Wp
231 this->GetPcode(xx(6),xx(10)/1000.);
238 for(Int_t j=1;j<11;j++){
239 cout.width(7);cout.precision(5);cout<<xx(j);
243 // 4)Update data in TVector
244 TClonesArray &arr=*trs;
245 new(arr[i])TVector(xx);
248 {/*cout<<"No data for track "<<i<<endl;*/}
249 }// End loop for tracks
251 void AliITSPid::Reset(void)
253 for(Int_t i=0;i<trs->GetEntries();i++){
255 TClonesArray &arr=*trs;
256 new(arr[i])TVector(xx);
259 //-----------------------------------------------------------
260 AliITSPid::AliITSPid(Int_t ntrack)
262 trs = new TClonesArray("TVector",ntrack);
263 TClonesArray &arr=*trs;
264 for(Int_t i=0;i<ntrack;i++)new(arr[i])TVector(0,11);
267 // Ncut Pmom pilo pihi klo khi plo phi
268 // cut[j] [0] [1] [2] [3] [4] [5] [6]
269 //----------------------------------------------------------------
270 SetCut( 1, 0.12 , 0. , 0. , inf , inf , inf , inf );
271 SetCut( 2, 0.20 , 0. , 6.0 , 6.0 , inf , inf , inf );
272 SetCut( 3, 0.30 , 0. , 3.5 , 3.5 , 9.0 , 9.0 , inf );
273 SetCut( 4, 0.41 , 0. , 1.9 , 1.9 , 4.0 , 4.0 , inf );
274 //----------------------------------------------------------------
275 SetCut( 5, 0.47 , 1. , 0.12, 1.98 , 0.17 , 3.5 , inf );
276 SetCut( 6, 0.53 , 1. , 0.12, 1.75 , 0.16 , 3.0 , inf );
277 //----------------------------------------------------------------
278 SetCut( 7, 0.59 , 0. , 0. , 1.18 , 0.125 , 2.7 , inf );
279 SetCut( 8, 0.65 , 0. , 0. , 1.18 , 0.125 , 2.5 , inf );
280 SetCut( 9, 0.73 , 0. , 0. , 0. , 0.125 , 2.0 , inf );
281 //----------------------------------------------------------------
282 SetCut( 10, 0.83 , 0. , 0. , 1.25 , 0.13 , 2.14 , 0.20 );
283 SetCut( 11, 0.93 , 0. , 0. , 1.18 , 0.125 , 1.88 , 0.18 );
284 SetCut( 12, 1.03 , 0. , 0. , 1.13 , 0.12 , 1.68 , 0.155);
286 //-----------------------------------------------------------