]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TOF/AliTOFpidESD.cxx
reducing macro to minimum AliReconstruction functionality, disable QA and TriggerESD...
[u/mrichter/AliRoot.git] / TOF / AliTOFpidESD.cxx
... / ...
CommitLineData
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// //
18// Implementation of the TOF PID class //
19// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //
20// //
21//-----------------------------------------------------------------//
22
23#include "TMath.h"
24#include "AliLog.h"
25
26#include "AliESDtrack.h"
27#include "AliESDEvent.h"
28
29#include "AliTOFpidESD.h"
30
31ClassImp(AliTOFpidESD)
32
33//_________________________________________________________________________
34AliTOFpidESD::AliTOFpidESD():
35 fSigma(0),
36 fRange(0),
37 fPmax(0) // zero at 0.5 GeV/c for pp
38{
39}
40//_________________________________________________________________________
41AliTOFpidESD::AliTOFpidESD(Double_t *param):
42 fSigma(param[0]),
43 fRange(param[1]),
44 fPmax(0) // zero at 0.5 GeV/c for pp
45{
46 //
47 // The main constructor
48 //
49 //
50
51 //fPmax=TMath::Exp(-0.5*3*3)/fSigma; // ~3 sigma at 0.5 GeV/c for PbPb
52}
53
54Double_t
55AliTOFpidESD::GetMismatchProbability(Double_t p, Double_t mass) const {
56 //
57 // Returns the probability of mismatching
58 // assuming 1/(p*beta)^2 scaling
59 //
60 const Double_t km=0.5; // "reference" momentum (GeV/c)
61
62 Double_t ref2=km*km*km*km/(km*km + mass*mass);// "reference" (p*beta)^2
63 Double_t p2beta2=p*p*p*p/(p*p + mass*mass);
64
65 return fPmax*ref2/p2beta2;
66}
67
68//_________________________________________________________________________
69Int_t AliTOFpidESD::MakePID(AliESDEvent *event, Double_t timeZero)
70{
71 //
72 // This function calculates the "detector response" PID probabilities
73 // Just for a bare hint...
74
75 AliDebug(1,Form("TOF PID Parameters: Sigma (ps)= %f, Range= %f",fSigma,fRange));
76 AliDebug(1,"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \n");
77
78 Int_t ntrk=event->GetNumberOfTracks();
79 AliESDtrack **tracks=new AliESDtrack*[ntrk];
80
81 Int_t i;
82 for (i=0; i<ntrk; i++) {
83 AliESDtrack *t=event->GetTrack(i);
84 tracks[i]=t;
85 }
86
87 for (i=0; i<ntrk; i++) {
88 AliESDtrack *t=tracks[i];
89 if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
90 if ((t->GetStatus()&AliESDtrack::kTIME)==0) continue;
91 Double_t tof=t->GetTOFsignal()-timeZero;
92 Double_t time[10]; t->GetIntegratedTimes(time);
93 Double_t p[10];
94 Double_t mom=t->GetP();
95 Bool_t mismatch=kTRUE, heavy=kTRUE;
96 for (Int_t j=0; j<AliPID::kSPECIES; j++) {
97 Double_t mass=AliPID::ParticleMass(j);
98 Double_t dpp=0.01; //mean relative pt resolution;
99 if (mom>0.5) dpp=0.01*mom;
100 Double_t sigma=dpp*time[j]/(1.+ mom*mom/(mass*mass));
101 sigma=TMath::Sqrt(sigma*sigma + fSigma*fSigma);
102 if (TMath::Abs(tof-time[j]) > fRange*sigma) {
103 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
104 } else
105 p[j]=TMath::Exp(-0.5*(tof-time[j])*(tof-time[j])/(sigma*sigma))/sigma;
106
107 // Check the mismatching
108 Double_t pm=GetMismatchProbability(mom,mass);
109 if (p[j]>pm) mismatch=kFALSE;
110
111 // Check for particles heavier than (AliPID::kSPECIES - 1)
112 if (tof < (time[j] + fRange*sigma)) heavy=kFALSE;
113
114 }
115
116 if (mismatch)
117 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]=1/AliPID::kSPECIES;
118
119 t->SetTOFpid(p);
120
121 if (heavy) t->ResetStatus(AliESDtrack::kTOFpid);
122
123 }
124
125 delete[] tracks;
126
127 return 0;
128}
129
130//_________________________________________________________________________
131Int_t AliTOFpidESD::MakePID(AliESDEvent *event)
132{
133 //
134 // This function calculates the "detector response" PID probabilities
135 // Just for a bare hint...
136
137 Int_t ntrk=event->GetNumberOfTracks();
138 AliESDtrack **tracks=new AliESDtrack*[ntrk];
139
140 Int_t i;
141 for (i=0; i<ntrk; i++) {
142 AliESDtrack *t=event->GetTrack(i);
143 tracks[i]=t;
144 }
145
146 for (i=0; i<ntrk; i++) {
147 AliESDtrack *t=tracks[i];
148 if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
149 if ((t->GetStatus()&AliESDtrack::kTIME)==0) continue;
150 Double_t tof=t->GetTOFsignal();
151 Double_t time[10]; t->GetIntegratedTimes(time);
152 Double_t p[10];
153 Double_t mom=t->GetP();
154 Bool_t mismatch=kTRUE, heavy=kTRUE;
155 for (Int_t j=0; j<AliPID::kSPECIES; j++) {
156 Double_t mass=AliPID::ParticleMass(j);
157 Double_t dpp=0.01; //mean relative pt resolution;
158 if (mom>0.5) dpp=0.01*mom;
159 Double_t sigma=dpp*time[j]/(1.+ mom*mom/(mass*mass));
160 sigma=TMath::Sqrt(sigma*sigma + fSigma*fSigma);
161 if (TMath::Abs(tof-time[j]) > fRange*sigma) {
162 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
163 } else
164 p[j]=TMath::Exp(-0.5*(tof-time[j])*(tof-time[j])/(sigma*sigma))/sigma;
165
166 // Check the mismatching
167 Double_t pm=GetMismatchProbability(mom,mass);
168 if (p[j]>pm) mismatch=kFALSE;
169
170 // Check for particles heavier than (AliPID::kSPECIES - 1)
171 if (tof < (time[j] + fRange*sigma)) heavy=kFALSE;
172
173 }
174
175 if (mismatch)
176 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]=1/AliPID::kSPECIES;
177
178 t->SetTOFpid(p);
179
180 if (heavy) t->ResetStatus(AliESDtrack::kTOFpid);
181
182 }
183
184 delete[] tracks;
185
186 return 0;
187}
188