]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliITSPIDResponse.cxx
M AliTPCcalibDButil.cxx - Protection agains missing Offset calibration...
[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(): 
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 }
40
41 //_________________________________________________________________________
42 AliITSPIDResponse::AliITSPIDResponse(Double_t *param): 
43   fRes(param[0]),
44   fKp1(15.77),
45   fKp2(4.95),
46   fKp3(0.312),
47   fKp4(2.14),
48   fKp5(0.82)
49 {
50   //
51   //  The main constructor
52   //
53 }
54
55
56 Double_t AliITSPIDResponse::Bethe(Double_t p,Double_t mass) const {
57   //
58   // returns AliExternalTrackParam::BetheBloch normalized to 
59   // fgMIP at the minimum
60   //
61   Double_t bb=
62     AliExternalTrackParam::BetheBlochAleph(p/mass,fKp1,fKp2,fKp3,fKp4,fKp5);
63   return bb;
64 }
65
66 Double_t AliITSPIDResponse::GetResolution(Double_t bethe) const {
67   // 
68   // Calculate expected resolution for truncated mean
69   //
70   return fRes*bethe;
71 }
72
73 void AliITSPIDResponse::GetITSProbabilities(Float_t mom, Double_t qclu[4], Double_t condprobfun[AliPID::kSPECIES]) const {
74   //
75   // Method to calculate PID probabilities for a single track
76   // using the likelihood method
77   //
78   const Int_t nLay = 4;
79   const Int_t nPart = 3;
80
81   static AliITSPidParams pars;  // Pid parametrisation parameters
82   
83   Double_t itsProb[nPart] = {1,1,1}; // p, K, pi
84
85   for (Int_t iLay = 0; iLay < nLay; iLay++) {
86     if (qclu[iLay] <= 0)
87       continue;
88
89     Float_t dedx = qclu[iLay];
90     Float_t layProb = pars.GetLandauGausNorm(dedx,AliPID::kProton,mom,iLay+3);
91     itsProb[0] *= layProb;
92     
93     layProb = pars.GetLandauGausNorm(dedx,AliPID::kKaon,mom,iLay+3);
94     if (mom < 0.16) layProb=0.00001;
95     itsProb[1] *= layProb;
96     
97     layProb = pars.GetLandauGausNorm(dedx,AliPID::kPion,mom,iLay+3);
98     itsProb[2] *= layProb;
99   }
100
101   // Normalise probabilities
102   Double_t sumProb = 0;
103   for (Int_t iPart = 0; iPart < nPart; iPart++) {
104     sumProb += itsProb[iPart];
105   }
106
107   for (Int_t iPart = 0; iPart < nPart; iPart++) {
108     itsProb[iPart]/=sumProb;
109   }
110   
111   condprobfun[AliPID::kElectron] = itsProb[2]/3.;
112   condprobfun[AliPID::kMuon] = itsProb[2]/3.;
113   condprobfun[AliPID::kPion] = itsProb[2]/3.;
114   condprobfun[AliPID::kKaon] = itsProb[1];
115   condprobfun[AliPID::kProton] = itsProb[0];
116   return;
117 }