]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCpidESD.cxx
Extacting the OCDB in a separate module. The detectors have write permission in the...
[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"
af885e0f 23#include "AliESDEvent.h"
8c6a71ab 24#include "AliESDtrack.h"
25
26ClassImp(AliTPCpidESD)
27
28//_________________________________________________________________________
179c6296 29 AliTPCpidESD::AliTPCpidESD(Double_t *param):
30 fMIP(0.),
31 fRes(0.),
32 fRange(0.)
8c6a71ab 33{
34 //
35 // The main constructor
36 //
37 fMIP=param[0];
38 fRes=param[1];
39 fRange=param[2];
40}
41
42Double_t AliTPCpidESD::Bethe(Double_t bg) {
43 //
44 // This is the Bethe-Bloch function normalised to 1 at the minimum
45 //
46 Double_t bg2=bg*bg;
402a0e49 47 Double_t beta2 = bg2/(1.+ bg2);
48
49 return 8.62702e-2*(9.14550 - beta2 - TMath::Log(3.51000e-5 + 1./bg2))/beta2;
8c6a71ab 50}
51
52//_________________________________________________________________________
af885e0f 53Int_t AliTPCpidESD::MakePID(AliESDEvent *event)
8c6a71ab 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;
8c6a71ab 63 Double_t p[10];
7a8614f3 64 Double_t mom=t->GetP();
65 const AliExternalTrackParam *in=t->GetInnerParam();
66 if (in) mom=in->GetP();
67 Double_t dedx=t->GetTPCsignal()/fMIP;
68 Bool_t mismatch=kTRUE, heavy=kTRUE;
69 for (Int_t j=0; j<AliPID::kSPECIES; j++) {
304864ab 70 Double_t mass=AliPID::ParticleMass(j);
8c6a71ab 71 Double_t bethe=Bethe(mom/mass);
72 Double_t sigma=fRes*bethe;
73 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
431be10d 74 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
7a8614f3 75 } else {
76 p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
77 mismatch=kFALSE;
8c6a71ab 78 }
7a8614f3 79
80 // Check for particles heavier than (AliPID::kSPECIES - 1)
81 if (dedx < (bethe + fRange*sigma)) heavy=kFALSE;
82
8c6a71ab 83 }
7a8614f3 84
85 if (mismatch)
86 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]=1/AliPID::kSPECIES;
87
8c6a71ab 88 t->SetTPCpid(p);
7a8614f3 89
90 if (heavy) t->ResetStatus(AliESDtrack::kTPCpid);
91
8c6a71ab 92 }
93 return 0;
94}