]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliITSPIDResponse.cxx
Update (Chiara Z)
[u/mrichter/AliRoot.git] / STEER / AliITSPIDResponse.cxx
1 /**************************************************************************
2  * Copyright(c) 2005-2007, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 //-----------------------------------------------------------------
19 // ITS PID method # 1
20 //           Implementation of the ITS PID class
21 // Very naive one... Should be made better by the detector experts...
22 //      Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
23 //-----------------------------------------------------------------
24 #include "TMath.h"
25 #include "AliITSPIDResponse.h"
26 #include "AliITSPidParams.h"
27 #include "AliExternalTrackParam.h"
28
29 ClassImp(AliITSPIDResponse)
30
31 AliITSPIDResponse::AliITSPIDResponse(Bool_t isMC): 
32   fRes(0.13),
33   fKp1(15.77),
34   fKp2(4.95),
35   fKp3(0.312),
36   fKp4(2.14),
37   fKp5(0.82)
38 {
39   if(!isMC){
40     fBBtpcits[0]=0.73;
41     fBBtpcits[1]=14.68;
42     fBBtpcits[2]=0.905;
43     fBBtpcits[3]=1.2;
44     fBBtpcits[4]=6.6;
45     fBBsa[0]=2.73198E7;
46     fBBsa[1]=6.92389;
47     fBBsa[2]=1.90088E-6;
48     fBBsa[3]=1.90088E-6;
49     fBBsa[4]=3.40644E-7;
50     fBBsaElectron[0]=4.05799E6;
51     fBBsaElectron[1]=38.5713;
52     fBBsaElectron[2]=1.46462E-7;
53     fBBsaElectron[3]=1.46462E-7;
54     fBBsaElectron[4]=4.40284E-7; 
55     fResolSA[0]=1.;   // 0 cluster tracks should not be used
56     fResolSA[1]=0.25;  // rough values for tracks with 1
57     fResolSA[2]=0.131;   // value from pp 2010 run (L. Milano, 16-Jun-11)
58     fResolSA[3]=0.113; // value from pp 2010 run 
59     fResolSA[4]=0.104; // value from pp 2010 run
60     for(Int_t i=0; i<5;i++) fResolTPCITS[i]=0.13;
61   }else{
62     fBBtpcits[0]=1.04;
63     fBBtpcits[1]=27.14;
64     fBBtpcits[2]=1.00;
65     fBBtpcits[3]=0.964;
66     fBBtpcits[4]=2.59;
67     fBBsa[0]=2.02078E7;
68     fBBsa[1]=14.0724;
69     fBBsa[2]=3.84454E-7;
70     fBBsa[3]=3.84454E-7;
71     fBBsa[4]=2.43913E-7;
72     fBBsaElectron[0]=2.26807E6;
73     fBBsaElectron[1]=99.985;
74     fBBsaElectron[2]=0.000714841;
75     fBBsaElectron[3]=0.000259585;
76     fBBsaElectron[4]=1.39412E-7;
77     fResolSA[0]=1.;   // 0 cluster tracks should not be used
78     fResolSA[1]=0.25;  // rough values for tracks with 1
79     fResolSA[2]=0.126;   // value from pp 2010 simulations (L. Milano, 16-Jun-11)
80     fResolSA[3]=0.109; // value from pp 2010 simulations
81     fResolSA[4]=0.097; // value from pp 2010 simulations
82     for(Int_t i=0; i<5;i++) fResolTPCITS[i]=0.13;
83   }
84 }
85
86 /*
87 //_________________________________________________________________________
88 AliITSPIDResponse::AliITSPIDResponse(Double_t *param): 
89   fRes(param[0]),
90   fKp1(15.77),
91   fKp2(4.95),
92   fKp3(0.312),
93   fKp4(2.14),
94   fKp5(0.82)
95 {
96   //
97   //  The main constructor
98   //
99   for (Int_t i=0; i<5;i++) {
100       fBBsa[i]=0.; 
101       fBBtpcits[i]=0.;
102       fResolSA[i]=0.; 
103       fResolTPCITS[i]=0.;
104   }
105 }
106 */
107
108 //_________________________________________________________________________
109 Double_t AliITSPIDResponse::BetheAleph(Double_t p, Double_t mass) const {
110   //
111   // returns AliExternalTrackParam::BetheBloch normalized to 
112   // fgMIP at the minimum
113   //
114   
115   Double_t bb=
116     AliExternalTrackParam::BetheBlochAleph(p/mass,fKp1,fKp2,fKp3,fKp4,fKp5);
117   return bb;
118 }
119
120 //_________________________________________________________________________
121 Double_t AliITSPIDResponse::Bethe(Double_t p, Double_t mass, Bool_t isSA) const {
122   //
123   // returns AliExternalTrackParam::BetheBloch normalized to 
124   // fgMIP at the minimum
125   //
126
127   Double_t bg=p/mass;
128   Double_t beta = bg/TMath::Sqrt(1.+ bg*bg);
129   Double_t gamma=bg/beta;
130   Double_t par[5];
131   if(isSA){
132     if(mass>0.0005 && mass<0.00052){
133       //if is an electron use a specific BB parameterization
134       //To be used only between 100 and 160 MeV/c
135       for(Int_t ip=0; ip<5;ip++) par[ip]=fBBsaElectron[ip];
136     }else{
137       for(Int_t ip=0; ip<5;ip++) par[ip]=fBBsa[ip];
138     }
139   }else{
140     for(Int_t ip=0; ip<5;ip++) par[ip]=fBBtpcits[ip];
141   }
142   Double_t eff=1.0;
143   if(bg<par[2])
144     eff=(bg-par[3])*(bg-par[3])+par[4];
145   else
146     eff=(par[2]-par[3])*(par[2]-par[3])+par[4];
147   
148   Double_t bb=0.;
149   if(gamma>=0. && beta>0.){
150     bb=(par[1]+2.0*TMath::Log(gamma)-beta*beta)*(par[0]/(beta*beta))*eff;
151   }
152   return bb;
153 }
154
155 //_________________________________________________________________________
156 Double_t AliITSPIDResponse::GetResolution(Double_t bethe, 
157                                           Int_t nPtsForPid, 
158                                           Bool_t isSA) const {
159   // 
160   // Calculate expected resolution for truncated mean
161   //
162   Float_t r;
163   if(isSA) r=fResolSA[nPtsForPid];
164   else r=fResolTPCITS[nPtsForPid];
165   return r*bethe;
166 }
167
168
169
170
171 //_________________________________________________________________________
172 void AliITSPIDResponse::GetITSProbabilities(Float_t mom, Double_t qclu[4], Double_t condprobfun[AliPID::kSPECIES], Bool_t isMC) const {
173   //
174   // Method to calculate PID probabilities for a single track
175   // using the likelihood method
176   //
177   const Int_t nLay = 4;
178   const Int_t nPart = 3;
179
180   static AliITSPidParams pars(isMC);  // Pid parametrisation parameters
181   
182   Double_t itsProb[nPart] = {1,1,1}; // p, K, pi
183
184   for (Int_t iLay = 0; iLay < nLay; iLay++) {
185     if (qclu[iLay] <= 0)
186       continue;
187
188     Float_t dedx = qclu[iLay];
189     Float_t layProb = pars.GetLandauGausNorm(dedx,AliPID::kProton,mom,iLay+3);
190     itsProb[0] *= layProb;
191     
192     layProb = pars.GetLandauGausNorm(dedx,AliPID::kKaon,mom,iLay+3);
193     if (mom < 0.16) layProb=0.00001;
194     itsProb[1] *= layProb;
195     
196     layProb = pars.GetLandauGausNorm(dedx,AliPID::kPion,mom,iLay+3);
197     itsProb[2] *= layProb;
198   }
199
200   // Normalise probabilities
201   Double_t sumProb = 0;
202   for (Int_t iPart = 0; iPart < nPart; iPart++) {
203     sumProb += itsProb[iPart];
204   }
205   sumProb += 2*itsProb[2]; // muon and electron cannot be distinguished from pions
206
207   for (Int_t iPart = 0; iPart < nPart; iPart++) {
208     itsProb[iPart]/=sumProb;
209   }
210   
211   condprobfun[AliPID::kElectron] = itsProb[2];
212   condprobfun[AliPID::kMuon] = itsProb[2];
213   condprobfun[AliPID::kPion] = itsProb[2];
214   condprobfun[AliPID::kKaon] = itsProb[1];
215   condprobfun[AliPID::kProton] = itsProb[0];
216   return;
217 }
218
219 //_________________________________________________________________________
220 Int_t AliITSPIDResponse::GetParticleIdFromdEdxVsP(Float_t mom, Float_t signal, Bool_t isSA) const{
221   // method to get particle identity with simple cuts on dE/dx vs. momentum
222
223   Double_t massp=AliPID::ParticleMass(AliPID::kProton);
224   Double_t massk=AliPID::ParticleMass(AliPID::kKaon);
225   Double_t bethep=Bethe(mom,massp,isSA);
226   Double_t bethek=Bethe(mom,massk,isSA);
227   if(signal>(0.5*(bethep+bethek))) return AliPID::kProton;
228   Double_t masspi=AliPID::ParticleMass(AliPID::kPion);
229   Double_t bethepi=Bethe(mom,masspi,isSA);
230   if(signal>(0.5*(bethepi+bethek))) return AliPID::kKaon;
231   return AliPID::kPion;
232     
233 }