]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliITSPIDResponse.cxx
Reset of centrality object.
[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]=5.33458E4;
46     fBBsa[1]=16.5303;
47     fBBsa[2]=2.60065E-3;
48     fBBsa[3]=3.59533E-4;
49     fBBsa[4]=7.51168E-5;  
50     fResolSA[0]=1.;   // 0 cluster tracks should not be used
51     fResolSA[1]=0.25;  // rough values for tracks with 1 or 2
52     fResolSA[2]=0.2;   // clusters (not to be used)
53     fResolSA[3]=0.116; // value from pp 2010 run (L. Milano, 18-Jan-11)
54     fResolSA[4]=0.104; // value from pp 2010 run
55     for(Int_t i=0; i<5;i++) fResolTPCITS[i]=0.13;
56   }else{
57     fBBtpcits[0]=1.04;
58     fBBtpcits[1]=27.14;
59     fBBtpcits[2]=1.00;
60     fBBtpcits[3]=0.964;
61     fBBtpcits[4]=2.59;
62     fBBsa[0]=-2.48;
63     fBBsa[1]=23.13;
64     fBBsa[2]=1.161;
65     fBBsa[3]=0.93;
66     fBBsa[4]=-1.2973;
67     fResolSA[0]=1.;   // 0 cluster tracks should not be used
68     fResolSA[1]=0.25;  // rough values for tracks with 1 or 2
69     fResolSA[2]=0.2;   // clusters (not to be used)
70     fResolSA[3]=0.110; // value from pp 2010 simulations (L. Milano, 18-Jan-11)
71     fResolSA[4]=0.096; // value from pp 2010 simulations
72     for(Int_t i=0; i<5;i++) fResolTPCITS[i]=0.13;
73   }
74 }
75
76 //_________________________________________________________________________
77 AliITSPIDResponse::AliITSPIDResponse(Double_t *param): 
78   fRes(param[0]),
79   fKp1(15.77),
80   fKp2(4.95),
81   fKp3(0.312),
82   fKp4(2.14),
83   fKp5(0.82)
84 {
85   //
86   //  The main constructor
87   //
88   for (Int_t i=0; i<5;i++) {
89       fBBsa[i]=0.; 
90       fBBtpcits[i]=0.;
91       fResolSA[i]=0.; 
92       fResolTPCITS[i]=0.;
93   }
94 }
95
96
97 //_________________________________________________________________________
98 Double_t AliITSPIDResponse::BetheAleph(Double_t p, Double_t mass) const {
99   //
100   // returns AliExternalTrackParam::BetheBloch normalized to 
101   // fgMIP at the minimum
102   //
103   
104   Double_t bb=
105     AliExternalTrackParam::BetheBlochAleph(p/mass,fKp1,fKp2,fKp3,fKp4,fKp5);
106   return bb;
107 }
108
109 //_________________________________________________________________________
110 Double_t AliITSPIDResponse::Bethe(Double_t p, Double_t mass, Bool_t isSA) const {
111   //
112   // returns AliExternalTrackParam::BetheBloch normalized to 
113   // fgMIP at the minimum
114   //
115
116   Double_t bg=p/mass;
117   Double_t beta = bg/TMath::Sqrt(1.+ bg*bg);
118   Double_t gamma=bg/beta;
119   Double_t par[5];
120   if(isSA){
121     for(Int_t ip=0; ip<5;ip++) par[ip]=fBBsa[ip];
122   }else{
123     for(Int_t ip=0; ip<5;ip++) par[ip]=fBBtpcits[ip];
124   }
125   Double_t eff=1.0;
126   if(bg<par[2])
127     eff=(bg-par[3])*(bg-par[3])+par[4];
128   else
129     eff=(par[2]-par[3])*(par[2]-par[3])+par[4];
130
131   Double_t bb=0.;
132   if(gamma>=0. && beta>0.){
133     bb=(par[1]+2.0*TMath::Log(gamma)-beta*beta)*(par[0]/(beta*beta))*eff;
134   }
135   return bb;
136 }
137
138 //_________________________________________________________________________
139 Double_t AliITSPIDResponse::GetResolution(Double_t bethe, 
140                                           Int_t nPtsForPid, 
141                                           Bool_t isSA) const {
142   // 
143   // Calculate expected resolution for truncated mean
144   //
145   Float_t r;
146   if(isSA) r=fResolSA[nPtsForPid];
147   else r=fResolTPCITS[nPtsForPid];
148   return r*bethe;
149 }
150
151
152
153
154 //_________________________________________________________________________
155 void AliITSPIDResponse::GetITSProbabilities(Float_t mom, Double_t qclu[4], Double_t condprobfun[AliPID::kSPECIES]) const {
156   //
157   // Method to calculate PID probabilities for a single track
158   // using the likelihood method
159   //
160   const Int_t nLay = 4;
161   const Int_t nPart = 3;
162
163   static AliITSPidParams pars;  // Pid parametrisation parameters
164   
165   Double_t itsProb[nPart] = {1,1,1}; // p, K, pi
166
167   for (Int_t iLay = 0; iLay < nLay; iLay++) {
168     if (qclu[iLay] <= 0)
169       continue;
170
171     Float_t dedx = qclu[iLay];
172     Float_t layProb = pars.GetLandauGausNorm(dedx,AliPID::kProton,mom,iLay+3);
173     itsProb[0] *= layProb;
174     
175     layProb = pars.GetLandauGausNorm(dedx,AliPID::kKaon,mom,iLay+3);
176     if (mom < 0.16) layProb=0.00001;
177     itsProb[1] *= layProb;
178     
179     layProb = pars.GetLandauGausNorm(dedx,AliPID::kPion,mom,iLay+3);
180     itsProb[2] *= layProb;
181   }
182
183   // Normalise probabilities
184   Double_t sumProb = 0;
185   for (Int_t iPart = 0; iPart < nPart; iPart++) {
186     sumProb += itsProb[iPart];
187   }
188   sumProb += 2*itsProb[2]; // muon and electron cannot be distinguished from pions
189
190   for (Int_t iPart = 0; iPart < nPart; iPart++) {
191     itsProb[iPart]/=sumProb;
192   }
193   
194   condprobfun[AliPID::kElectron] = itsProb[2];
195   condprobfun[AliPID::kMuon] = itsProb[2];
196   condprobfun[AliPID::kPion] = itsProb[2];
197   condprobfun[AliPID::kKaon] = itsProb[1];
198   condprobfun[AliPID::kProton] = itsProb[0];
199   return;
200 }
201
202 //_________________________________________________________________________
203 Int_t AliITSPIDResponse::GetParticleIdFromdEdxVsP(Float_t mom, Float_t signal, Bool_t isSA) const{
204   // method to get particle identity with simple cuts on dE/dx vs. momentum
205
206   Double_t massp=AliPID::ParticleMass(AliPID::kProton);
207   Double_t massk=AliPID::ParticleMass(AliPID::kKaon);
208   Double_t bethep=Bethe(mom,massp,isSA);
209   Double_t bethek=Bethe(mom,massk,isSA);
210   if(signal>(0.5*(bethep+bethek))) return AliPID::kProton;
211   Double_t masspi=AliPID::ParticleMass(AliPID::kPion);
212   Double_t bethepi=Bethe(mom,masspi,isSA);
213   if(signal>(0.5*(bethepi+bethek))) return AliPID::kKaon;
214   return AliPID::kPion;
215     
216 }