]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliITSPIDResponse.cxx
Fixed compilation
[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     for(Int_t i=0; i<5;i++) fResolSA[i]=0.15;
51     for(Int_t i=0; i<5;i++) fResolTPCITS[i]=0.13;
52   }else{
53     fBBtpcits[0]=0.73;
54     fBBtpcits[1]=14.68;
55     fBBtpcits[2]=0.905;
56     fBBtpcits[3]=0.2;
57     fBBtpcits[4]=6.6;
58     fBBsa[0]=139.1;
59     fBBsa[1]=23.36;
60     fBBsa[2]=0.06052;
61     fBBsa[3]=0.2043;
62     fBBsa[4]=-0.0004999;
63     for(Int_t i=0; i<5;i++) fResolSA[i]=0.15;
64     for(Int_t i=0; i<5;i++) fResolTPCITS[i]=0.13;
65   }
66 }
67
68 //_________________________________________________________________________
69 AliITSPIDResponse::AliITSPIDResponse(Double_t *param): 
70   fRes(param[0]),
71   fKp1(15.77),
72   fKp2(4.95),
73   fKp3(0.312),
74   fKp4(2.14),
75   fKp5(0.82)
76 {
77   //
78   //  The main constructor
79   //
80 }
81
82
83 Double_t AliITSPIDResponse::BetheAleph(Double_t p, Double_t mass) const {
84   //
85   // returns AliExternalTrackParam::BetheBloch normalized to 
86   // fgMIP at the minimum
87   //
88   
89   Double_t bb=
90     AliExternalTrackParam::BetheBlochAleph(p/mass,fKp1,fKp2,fKp3,fKp4,fKp5);
91   return bb;
92 }
93
94 Double_t AliITSPIDResponse::Bethe(Double_t p, Double_t mass, Bool_t isSA) const {
95   //
96   // returns AliExternalTrackParam::BetheBloch normalized to 
97   // fgMIP at the minimum
98   //
99
100   Double_t bg=p/mass;
101   Double_t beta = bg/TMath::Sqrt(1.+ bg*bg);
102   Double_t gamma=bg/beta;
103   Double_t par[5];
104   if(isSA){
105     for(Int_t ip=0; ip<5;ip++) par[ip]=fBBsa[ip];
106   }else{
107     for(Int_t ip=0; ip<5;ip++) par[ip]=fBBtpcits[ip];
108   }
109   Double_t eff=1.0;
110   if(bg<par[2])
111     eff=(bg-par[3])*(bg-par[3])+par[4];
112   else
113     eff=(par[2]-par[3])*(par[2]-par[3])+par[4];
114
115   Double_t bb=0.;
116   if(gamma>=0. && beta>0.){
117     bb=(par[1]+2.0*TMath::Log(gamma)-beta*beta)*(par[0]/(beta*beta))*eff;
118   }
119   return bb;
120 }
121
122 Double_t AliITSPIDResponse::GetResolution(Double_t bethe, 
123                                           Int_t nPtsForPid, 
124                                           Bool_t isSA) const {
125   // 
126   // Calculate expected resolution for truncated mean
127   //
128   Float_t r;
129   if(isSA) r=fResolSA[nPtsForPid];
130   else r=fResolTPCITS[nPtsForPid];
131   return r*bethe;
132 }
133
134
135
136
137 void AliITSPIDResponse::GetITSProbabilities(Float_t mom, Double_t qclu[4], Double_t condprobfun[AliPID::kSPECIES]) const {
138   //
139   // Method to calculate PID probabilities for a single track
140   // using the likelihood method
141   //
142   const Int_t nLay = 4;
143   const Int_t nPart = 3;
144
145   static AliITSPidParams pars;  // Pid parametrisation parameters
146   
147   Double_t itsProb[nPart] = {1,1,1}; // p, K, pi
148
149   for (Int_t iLay = 0; iLay < nLay; iLay++) {
150     if (qclu[iLay] <= 0)
151       continue;
152
153     Float_t dedx = qclu[iLay];
154     Float_t layProb = pars.GetLandauGausNorm(dedx,AliPID::kProton,mom,iLay+3);
155     itsProb[0] *= layProb;
156     
157     layProb = pars.GetLandauGausNorm(dedx,AliPID::kKaon,mom,iLay+3);
158     if (mom < 0.16) layProb=0.00001;
159     itsProb[1] *= layProb;
160     
161     layProb = pars.GetLandauGausNorm(dedx,AliPID::kPion,mom,iLay+3);
162     itsProb[2] *= layProb;
163   }
164
165   // Normalise probabilities
166   Double_t sumProb = 0;
167   for (Int_t iPart = 0; iPart < nPart; iPart++) {
168     sumProb += itsProb[iPart];
169   }
170
171   for (Int_t iPart = 0; iPart < nPart; iPart++) {
172     itsProb[iPart]/=sumProb;
173   }
174   
175   condprobfun[AliPID::kElectron] = itsProb[2]/3.;
176   condprobfun[AliPID::kMuon] = itsProb[2]/3.;
177   condprobfun[AliPID::kPion] = itsProb[2]/3.;
178   condprobfun[AliPID::kKaon] = itsProb[1];
179   condprobfun[AliPID::kProton] = itsProb[0];
180   return;
181 }
182