]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliITSPIDResponse.cxx
Fix for Coverity defect 10859: FORWARD_NULL
[u/mrichter/AliRoot.git] / STEER / AliITSPIDResponse.cxx
CommitLineData
10d100d4 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
10d100d4 29ClassImp(AliITSPIDResponse)
30
15e979c9 31AliITSPIDResponse::AliITSPIDResponse(Bool_t isMC):
10d100d4 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{
15e979c9 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;
8abeb05b 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
15e979c9 55 for(Int_t i=0; i<5;i++) fResolTPCITS[i]=0.13;
56 }else{
99daa709 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;
646e694f 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;
8abeb05b 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
15e979c9 72 for(Int_t i=0; i<5;i++) fResolTPCITS[i]=0.13;
73 }
10d100d4 74}
75
76//_________________________________________________________________________
77AliITSPIDResponse::AliITSPIDResponse(Double_t *param):
9ebbddd4 78 fRes(param[0]),
10d100d4 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 //
10d100d4 88}
89
90
8abeb05b 91//_________________________________________________________________________
15e979c9 92Double_t AliITSPIDResponse::BetheAleph(Double_t p, Double_t mass) const {
10d100d4 93 //
94 // returns AliExternalTrackParam::BetheBloch normalized to
95 // fgMIP at the minimum
96 //
15e979c9 97
10d100d4 98 Double_t bb=
99 AliExternalTrackParam::BetheBlochAleph(p/mass,fKp1,fKp2,fKp3,fKp4,fKp5);
9ebbddd4 100 return bb;
10d100d4 101}
102
8abeb05b 103//_________________________________________________________________________
15e979c9 104Double_t AliITSPIDResponse::Bethe(Double_t p, Double_t mass, Bool_t isSA) const {
105 //
106 // returns AliExternalTrackParam::BetheBloch normalized to
107 // fgMIP at the minimum
108 //
109
110 Double_t bg=p/mass;
111 Double_t beta = bg/TMath::Sqrt(1.+ bg*bg);
112 Double_t gamma=bg/beta;
113 Double_t par[5];
114 if(isSA){
115 for(Int_t ip=0; ip<5;ip++) par[ip]=fBBsa[ip];
116 }else{
117 for(Int_t ip=0; ip<5;ip++) par[ip]=fBBtpcits[ip];
118 }
119 Double_t eff=1.0;
120 if(bg<par[2])
121 eff=(bg-par[3])*(bg-par[3])+par[4];
122 else
123 eff=(par[2]-par[3])*(par[2]-par[3])+par[4];
124
125 Double_t bb=0.;
126 if(gamma>=0. && beta>0.){
127 bb=(par[1]+2.0*TMath::Log(gamma)-beta*beta)*(par[0]/(beta*beta))*eff;
128 }
129 return bb;
130}
131
8abeb05b 132//_________________________________________________________________________
15e979c9 133Double_t AliITSPIDResponse::GetResolution(Double_t bethe,
134 Int_t nPtsForPid,
135 Bool_t isSA) const {
10d100d4 136 //
137 // Calculate expected resolution for truncated mean
138 //
15e979c9 139 Float_t r;
140 if(isSA) r=fResolSA[nPtsForPid];
141 else r=fResolTPCITS[nPtsForPid];
142 return r*bethe;
10d100d4 143}
144
15e979c9 145
146
147
8abeb05b 148//_________________________________________________________________________
10d100d4 149void AliITSPIDResponse::GetITSProbabilities(Float_t mom, Double_t qclu[4], Double_t condprobfun[AliPID::kSPECIES]) const {
150 //
151 // Method to calculate PID probabilities for a single track
152 // using the likelihood method
153 //
154 const Int_t nLay = 4;
155 const Int_t nPart = 3;
156
157 static AliITSPidParams pars; // Pid parametrisation parameters
158
159 Double_t itsProb[nPart] = {1,1,1}; // p, K, pi
160
161 for (Int_t iLay = 0; iLay < nLay; iLay++) {
162 if (qclu[iLay] <= 0)
163 continue;
164
165 Float_t dedx = qclu[iLay];
166 Float_t layProb = pars.GetLandauGausNorm(dedx,AliPID::kProton,mom,iLay+3);
167 itsProb[0] *= layProb;
168
169 layProb = pars.GetLandauGausNorm(dedx,AliPID::kKaon,mom,iLay+3);
170 if (mom < 0.16) layProb=0.00001;
171 itsProb[1] *= layProb;
172
173 layProb = pars.GetLandauGausNorm(dedx,AliPID::kPion,mom,iLay+3);
174 itsProb[2] *= layProb;
175 }
176
177 // Normalise probabilities
178 Double_t sumProb = 0;
179 for (Int_t iPart = 0; iPart < nPart; iPart++) {
180 sumProb += itsProb[iPart];
181 }
182
183 for (Int_t iPart = 0; iPart < nPart; iPart++) {
184 itsProb[iPart]/=sumProb;
185 }
186
187 condprobfun[AliPID::kElectron] = itsProb[2]/3.;
188 condprobfun[AliPID::kMuon] = itsProb[2]/3.;
189 condprobfun[AliPID::kPion] = itsProb[2]/3.;
190 condprobfun[AliPID::kKaon] = itsProb[1];
191 condprobfun[AliPID::kProton] = itsProb[0];
192 return;
193}
15e979c9 194
8abeb05b 195//_________________________________________________________________________
196Int_t AliITSPIDResponse::GetParticleIdFromdEdxVsP(Float_t mom, Float_t signal, Bool_t isSA) const{
197 // method to get particle identity with simple cuts on dE/dx vs. momentum
198
199 Double_t massp=AliPID::ParticleMass(AliPID::kProton);
200 Double_t massk=AliPID::ParticleMass(AliPID::kKaon);
201 Double_t bethep=Bethe(mom,massp,isSA);
202 Double_t bethek=Bethe(mom,massk,isSA);
203 if(signal>(0.5*(bethep+bethek))) return AliPID::kProton;
204 Double_t masspi=AliPID::ParticleMass(AliPID::kPion);
205 Double_t bethepi=Bethe(mom,masspi,isSA);
206 if(signal>(0.5*(bethepi+bethek))) return AliPID::kKaon;
207 return AliPID::kPion;
208
209}