Updated version (Jens)
[u/mrichter/AliRoot.git] / STEER / AliTPCPIDResponse.cxx
CommitLineData
10d100d4 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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//-----------------------------------------------------------------
17// Implementation of the TPC PID class
18// Very naive one... Should be made better by the detector experts...
19// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
20// With many additions and modifications suggested by
21// Alexander Kalweit, GSI, alexander.philipp.kalweit@cern.ch
22// Dariusz Miskowiec, GSI, D.Miskowiec@gsi.de
23//-----------------------------------------------------------------
24
d2aa6df0 25#include <TGraph.h>
26#include <TObjArray.h>
27#include <TSpline.h>
28
10d100d4 29#include "AliExternalTrackParam.h"
30
d2aa6df0 31#include "AliTPCPIDResponse.h"
32
10d100d4 33ClassImp(AliTPCPIDResponse)
34
35//_________________________________________________________________________
36AliTPCPIDResponse::AliTPCPIDResponse():
d2aa6df0 37 fMIP(50.),
38 fRes0(0.07),
39 fResN2(0.),
40 fKp1(0.0283086),
41 fKp2(2.63394e+01),
42 fKp3(5.04114e-11),
43 fKp4(2.12543),
44 fKp5(4.88663),
45 fUseDatabase(kFALSE),
46 fResponseFunctions(AliPID::kUnknown+1)
10d100d4 47{
48 //
49 // The default constructor
50 //
51}
52
53//_________________________________________________________________________
d2aa6df0 54AliTPCPIDResponse::AliTPCPIDResponse(const Double_t *param):
55 fMIP(param[0]),
56 fRes0(param[1]),
57 fResN2(param[2]),
58 fKp1(0.0283086),
59 fKp2(2.63394e+01),
60 fKp3(5.04114e-11),
61 fKp4(2.12543),
62 fKp5(4.88663),
63 fUseDatabase(kFALSE),
64 fResponseFunctions(AliPID::kUnknown+1)
10d100d4 65{
66 //
67 // The main constructor
68 //
69}
70
d2aa6df0 71//_________________________________________________________________________
10d100d4 72Double_t AliTPCPIDResponse::Bethe(Double_t betaGamma) const {
73 //
74 // This is the Bethe-Bloch function normalised to 1 at the minimum
75 // WARNING
76 // Simulated and reconstructed Bethe-Bloch differs
77 // Simulated curve is the dNprim/dx
78 // Reconstructed is proportianal dNtot/dx
79 // Temporary fix for production - Simple linear correction function
80 // Future 2 Bethe Bloch formulas needed
81 // 1. for simulation
82 // 2. for reconstructed PID
83 //
d2aa6df0 84
85// const Float_t kmeanCorrection =0.1;
10d100d4 86 Double_t bb=
87 AliExternalTrackParam::BetheBlochAleph(betaGamma,fKp1,fKp2,fKp3,fKp4,fKp5);
88 return bb*fMIP;
89}
90
91//_________________________________________________________________________
92void AliTPCPIDResponse::SetBetheBlochParameters(Double_t kp1,
93 Double_t kp2,
94 Double_t kp3,
95 Double_t kp4,
96 Double_t kp5) {
97 //
98 // Set the parameters of the ALEPH Bethe-Bloch formula
99 //
100 fKp1=kp1;
101 fKp2=kp2;
102 fKp3=kp3;
103 fKp4=kp4;
104 fKp5=kp5;
105}
106//_________________________________________________________________________
107void AliTPCPIDResponse::SetSigma(Float_t res0, Float_t resN2) {
108 //
109 // Set the relative resolution sigma_rel = res0 * sqrt(1+resN2/npoint)
110 //
111 fRes0 = res0;
112 fResN2 = resN2;
113}
114
115//_________________________________________________________________________
116Double_t AliTPCPIDResponse::GetExpectedSignal(const Float_t mom,
d2aa6df0 117 AliPID::EParticleType n) const {
10d100d4 118 //
119 // Calculates the expected PID signal as the function of
120 // the information stored in the track, for the specified particle type
121 //
122 // At the moment, these signals are just the results of calling the
123 // Bethe-Bloch formula.
124 // This can be improved. By taking into account the number of
125 // assigned clusters and/or the track dip angle, for example.
126 //
127
d2aa6df0 128 Double_t mass=AliPID::ParticleMass(n);
129 if (!fUseDatabase||fResponseFunctions.GetEntriesFast()>AliPID::kUnknown) return Bethe(mom/mass);
130 //
131 TSpline3 * responseFunction = (TSpline3 *) fResponseFunctions.UncheckedAt(n);
132 if (!responseFunction) return Bethe(mom/mass);
133 return fMIP*responseFunction->Eval(mom/mass);
134
10d100d4 135}
136
137//_________________________________________________________________________
138Double_t AliTPCPIDResponse::GetExpectedSigma(const Float_t mom,
139 const Int_t nPoints,
140 AliPID::EParticleType n) const {
141 //
142 // Calculates the expected sigma of the PID signal as the function of
143 // the information stored in the track, for the specified particle type
144 //
145 //
146
147 if (nPoints != 0)
148 return GetExpectedSignal(mom,n)*fRes0*sqrt(1. + fResN2/nPoints);
149 else
150 return GetExpectedSignal(mom,n)*fRes0;
151}