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 //-----------------------------------------------------------
39 Int_t AliITSPid::wpik(Int_t nc,Float_t q)
43 Float_t qmpi,qmk,sigpi,sigk,dpi,dk,ppi,pk;
48 Float_t dqpi=(q-qmpi)/sigpi;
49 Float_t dqk =(q-qmk )/sigk;
50 if( dqk<-1. )return pion();
53 ppi =1.- TMath::Erf(dpi); // +0.5;
54 pk =1.- TMath::Erf(dk); // +0.5;
55 Float_t rpik=ppi/(pk+0.0000001);
56 cout<<"q,dqpi,dqk, wpik: ppi,pk,rpik="
57 <<q<<" "<<dqpi<<" "<<dqk<<" "<<ppi<<" "<<pk<<" "<<rpik<<endl;
58 if( rpik>=1000. ){return pion();}
59 if( rpik>0.001 ){fWk=1./(rpik+1.); fWpi=1.-fWk;return 0;}
62 //-----------------------------------------------------------
64 Int_t AliITSPid::wpikp(Int_t nc,Float_t q)
68 Float_t qmpi,qmk,qmp,sigpi,sigk,sigp,ppi,pka,ppr,rppi,rpka;
77 ppi =TMath::Erf( TMath::Abs((q-qmpi)/sigpi) )+0.5;
78 pka =TMath::Erf( TMath::Abs((q-qmk )/sigk) )+0.5;
79 ppr =TMath::Erf( TMath::Abs((q-qmp )/sigp) )+0.5;
84 if( rppi>rpka ) { rp=rpka; }
86 if( rp>=1000. ){ return proton(); }
87 if( rp>0.001 ){ fWp=rp/(rp+1.);return proton(); }
91 //-----------------------------------------------------------
92 Int_t AliITSPid::GetPcode(TClonesArray* rps,Float_t pm)
96 //-----------------------------------------------------------
97 Int_t AliITSPid::GetPcode(Float_t q,Float_t pm)
99 fWpi=fWk=fWp=-1.; fPcode=0;
105 { if( q<cut[2][2] ){ return pion(); } else { return kaon();} }
111 { if ( q<=cut[3][5] ) {return kaon();} else {return proton();}}
117 { if( q<=cut[4][4] ) {return kaon();} else {return proton(); }}
120 if ( q>cut[5][5] ) {return proton();} else {return wpik(5,q);};
123 if ( q>cut[6][5] ) {return proton();} else {return wpik(6,q);};
126 if ( q<=cut[7][5] ) {return fPcode;} else {return proton();};
129 if ( q<=cut[8][5] ) {return fPcode;} else {return proton();};
132 if ( q<=cut[9][5] ) {return fPcode;} else {return proton();};
134 if( pm<=cut[10][0] ){ return wpikp(10,q); }
136 if( pm<=cut[11][0] ){ return wpikp(11,q); }
138 if( pm<=cut[12][0] ){ return wpikp(12,q); }
142 //-----------------------------------------------------------
143 void AliITSPid::SetCut(Int_t n,Float_t pm,Float_t pilo,Float_t pihi,
144 Float_t klo,Float_t khi,Float_t plo,Float_t phi)
155 //-----------------------------------------------------------
156 void AliITSPid::SetVec(Int_t ntrack,TVector info)
158 TClonesArray& arr=*trs;
159 new( arr[ntrack] ) TVector(info);
161 //-----------------------------------------------------------
162 TVector* AliITSPid::GetVec(Int_t ntrack)
164 TClonesArray& arr=*trs;
165 return (TVector*)arr[ntrack];
167 //-----------------------------------------------------------
168 void AliITSPid::SetEdep(Int_t track,Float_t Edep)
171 if( ((TVector*)trs->At(track))->IsValid() )
172 {TVector yy( *((TVector*)trs->At(track)) );xx=yy; }
173 Int_t j=(Int_t)xx(0); if(j>4)return;
174 xx(++j)=Edep;xx(0)=j;
175 TClonesArray &arr=*trs;
176 new(arr[track])TVector(xx);
178 //-----------------------------------------------------------
179 void AliITSPid::SetPmom(Int_t track,Float_t Pmom)
182 if( ((TVector*)trs->At(track))->IsValid() )
183 {TVector yy( *((TVector*)trs->At(track)) );xx=yy; }
185 TClonesArray &arr=*trs;
186 new(arr[track])TVector(xx);
188 //-----------------------------------------------------------
189 void AliITSPid::SetPcod(Int_t track,Int_t partcode)
192 if( ((TVector*)trs->At(track))->IsValid() )
193 {TVector yy( *((TVector*)trs->At(track)) );xx=yy; }
195 {xx(11)=partcode; mxtrs++;
196 TClonesArray &arr=*trs;
197 new(arr[track])TVector(xx);
200 //-----------------------------------------------------------
201 void AliITSPid::Print(Int_t track)
202 {cout<<mxtrs<<" tracks in AliITSPid obj."<<endl;
203 if( ((TVector*)trs->At(track))->IsValid() )
204 {TVector xx( *((TVector*)trs->At(track)) );
208 {cout<<"No data for track "<<track<<endl;return;}
210 //-----------------------------------------------------------
211 void AliITSPid::Tab(void)
213 if(trs->GetEntries()==0){cout<<"No entries in TAB"<<endl;return;}
214 cout<<"------------------------------------------------------------------------"<<endl;
215 cout<<"Nq"<<" q1 "<<" q2 "<<" q3 "<<" q4 "<<" q5 "<<
216 " Qtrm " <<" Wpi "<<" Wk "<<" Wp "<<"Pmom "<<endl;
217 cout<<"------------------------------------------------------------------------"<<endl;
218 for(Int_t i=0;i<trs->GetEntries();i++)
220 TVector xx( *((TVector*)trs->At(i)) );
221 if( xx.IsValid() && xx(0)>0 )
223 TVector xx( *((TVector*)trs->At(i)) );
227 xx(6)=(this->qtrm(i));
232 // 2)Calculate Wpi,Wk,Wp
233 this->GetPcode(xx(6),xx(10)/1000.);
240 for(Int_t j=1;j<11;j++){
241 cout.width(7);cout.precision(5);cout<<xx(j);
245 // 4)Update data in TVector
246 TClonesArray &arr=*trs;
247 new(arr[i])TVector(xx);
250 {/*cout<<"No data for track "<<i<<endl;*/}
251 }// End loop for tracks
253 void AliITSPid::Reset(void)
255 for(Int_t i=0;i<trs->GetEntries();i++){
257 TClonesArray &arr=*trs;
258 new(arr[i])TVector(xx);
261 //-----------------------------------------------------------
262 AliITSPid::AliITSPid(Int_t ntrack)
264 trs = new TClonesArray("TVector",ntrack);
265 TClonesArray &arr=*trs;
266 for(Int_t i=0;i<ntrack;i++)new(arr[i])TVector(0,11);
269 // Ncut Pmom pilo pihi klo khi plo phi
270 // cut[j] [0] [1] [2] [3] [4] [5] [6]
271 //----------------------------------------------------------------
272 SetCut( 1, 0.12 , 0. , 0. , inf , inf , inf , inf );
273 SetCut( 2, 0.20 , 0. , 6.0 , 6.0 , inf , inf , inf );
274 SetCut( 3, 0.30 , 0. , 3.5 , 3.5 , 9.0 , 9.0 , inf );
275 SetCut( 4, 0.41 , 0. , 1.9 , 1.9 , 4.0 , 4.0 , inf );
276 //----------------------------------------------------------------
277 SetCut( 5, 0.47 , 1. , 0.12, 1.98 , 0.17 , 3.5 , inf );
278 SetCut( 6, 0.53 , 1. , 0.12, 1.75 , 0.16 , 3.0 , inf );
279 //----------------------------------------------------------------
280 SetCut( 7, 0.59 , 0. , 0. , 1.18 , 0.125 , 2.7 , inf );
281 SetCut( 8, 0.65 , 0. , 0. , 1.18 , 0.125 , 2.5 , inf );
282 SetCut( 9, 0.73 , 0. , 0. , 0. , 0.125 , 2.0 , inf );
283 //----------------------------------------------------------------
284 SetCut( 10, 0.83 , 0. , 0. , 1.25 , 0.13 , 2.14 , 0.20 );
285 SetCut( 11, 0.93 , 0. , 0. , 1.18 , 0.125 , 1.88 , 0.18 );
286 SetCut( 12, 1.03 , 0. , 0. , 1.13 , 0.12 , 1.68 , 0.155);
288 //-----------------------------------------------------------