1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //-----------------------------------------------------------------//
18 // Implementation of the TOF PID class //
19 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //
21 //-----------------------------------------------------------------//
26 #include "AliESDtrack.h"
27 #include "AliESDEvent.h"
29 #include "AliTOFpidESD.h"
31 ClassImp(AliTOFpidESD)
33 //_________________________________________________________________________
34 AliTOFpidESD::AliTOFpidESD():
37 fPmax(0) // zero at 0.5 GeV/c for pp
40 //_________________________________________________________________________
41 AliTOFpidESD::AliTOFpidESD(Double_t *param):
44 fPmax(0) // zero at 0.5 GeV/c for pp
47 // The main constructor
51 //fPmax=TMath::Exp(-0.5*3*3)/fSigma; // ~3 sigma at 0.5 GeV/c for PbPb
55 AliTOFpidESD::GetMismatchProbability(Double_t p, Double_t mass) const {
57 // Returns the probability of mismatching
58 // assuming 1/(p*beta)^2 scaling
60 const Double_t km=0.5; // "reference" momentum (GeV/c)
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);
65 return fPmax*ref2/p2beta2;
68 //_________________________________________________________________________
69 Int_t AliTOFpidESD::MakePID(AliESDEvent *event, Double_t timeZero)
72 // This function calculates the "detector response" PID probabilities
73 // Just for a bare hint...
75 AliDebug(1,Form("TOF PID Parameters: Sigma (ps)= %f, Range= %f",fSigma,fRange));
76 AliDebug(1,"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \n");
78 Int_t ntrk=event->GetNumberOfTracks();
79 AliESDtrack **tracks=new AliESDtrack*[ntrk];
82 for (i=0; i<ntrk; i++) {
83 AliESDtrack *t=event->GetTrack(i);
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);
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;
105 p[j]=TMath::Exp(-0.5*(tof-time[j])*(tof-time[j])/(sigma*sigma))/sigma;
107 // Check the mismatching
108 Double_t pm=GetMismatchProbability(mom,mass);
109 if (p[j]>pm) mismatch=kFALSE;
111 // Check for particles heavier than (AliPID::kSPECIES - 1)
112 if (tof < (time[j] + fRange*sigma)) heavy=kFALSE;
117 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]=1/AliPID::kSPECIES;
121 if (heavy) t->ResetStatus(AliESDtrack::kTOFpid);
130 //_________________________________________________________________________
131 Int_t AliTOFpidESD::MakePID(AliESDEvent *event)
134 // This function calculates the "detector response" PID probabilities
135 // Just for a bare hint...
137 Int_t ntrk=event->GetNumberOfTracks();
138 AliESDtrack **tracks=new AliESDtrack*[ntrk];
141 for (i=0; i<ntrk; i++) {
142 AliESDtrack *t=event->GetTrack(i);
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);
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;
164 p[j]=TMath::Exp(-0.5*(tof-time[j])*(tof-time[j])/(sigma*sigma))/sigma;
166 // Check the mismatching
167 Double_t pm=GetMismatchProbability(mom,mass);
168 if (p[j]>pm) mismatch=kFALSE;
170 // Check for particles heavier than (AliPID::kSPECIES - 1)
171 if (tof < (time[j] + fRange*sigma)) heavy=kFALSE;
176 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]=1/AliPID::kSPECIES;
180 if (heavy) t->ResetStatus(AliESDtrack::kTOFpid);