]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCpidESD.cxx
Merging changes from v4-04-Release
[u/mrichter/AliRoot.git] / TPC / AliTPCpidESD.cxx
CommitLineData
8c6a71ab 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//-----------------------------------------------------------------
21
22#include "AliTPCpidESD.h"
23#include "AliESD.h"
24#include "AliESDtrack.h"
25
26ClassImp(AliTPCpidESD)
27
28//_________________________________________________________________________
29AliTPCpidESD::AliTPCpidESD(Double_t *param)
30{
31 //
32 // The main constructor
33 //
34 fMIP=param[0];
35 fRes=param[1];
36 fRange=param[2];
37}
38
39Double_t AliTPCpidESD::Bethe(Double_t bg) {
40 //
41 // This is the Bethe-Bloch function normalised to 1 at the minimum
42 //
43 Double_t bg2=bg*bg;
cf6a95b7 44 Double_t bethe;
45 if (bg<3.5e1)
46 bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2));
47 else // Density effect ( approximately :)
48 bethe=1.15*(1.+ bg2)/bg2*(log(3.5*5940*bg) - bg2/(1.+ bg2));
8c6a71ab 49 return bethe/11.091;
50}
51
52//_________________________________________________________________________
53Int_t AliTPCpidESD::MakePID(AliESD *event)
54{
55 //
56 // This function calculates the "detector response" PID probabilities
57 //
8c6a71ab 58 Int_t ntrk=event->GetNumberOfTracks();
59 for (Int_t i=0; i<ntrk; i++) {
60 AliESDtrack *t=event->GetTrack(i);
61 if ((t->GetStatus()&AliESDtrack::kTPCin )==0)
62 if ((t->GetStatus()&AliESDtrack::kTPCout)==0) continue;
304864ab 63 Int_t ns=AliPID::kSPECIES;
8c6a71ab 64 Double_t p[10];
65 for (Int_t j=0; j<ns; j++) {
304864ab 66 Double_t mass=AliPID::ParticleMass(j);
8c6a71ab 67 Double_t mom=t->GetP();
68 Double_t dedx=t->GetTPCsignal()/fMIP;
69 Double_t bethe=Bethe(mom/mass);
70 Double_t sigma=fRes*bethe;
71 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
431be10d 72 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
8c6a71ab 73 continue;
74 }
431be10d 75 p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
8c6a71ab 76 }
77 t->SetTPCpid(p);
78 }
79 return 0;
80}