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 //-----------------------------------------------------------------
17 // Implementation of the TRD PID class
18 // Very naive one... And the implementation is even poorer...
19 // Should be made better by the detector experts...
20 //-----------------------------------------------------------------
22 #include "AliTRDpidESD.h"
24 #include "AliESDtrack.h"
26 ClassImp(AliTRDpidESD)
28 //_________________________________________________________________________
29 AliTRDpidESD::AliTRDpidESD(Double_t *param)
32 // The main constructor
34 fMIP=param[0]; // MIP signal
35 fRes=param[1]; // relative resolution
36 fRange=param[2]; // PID "range" (in sigmas)
39 Double_t AliTRDpidESD::Bethe(Double_t bg) {
41 // This is the Bethe-Bloch function normalised to 1 at the minimum
46 bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2));
47 else // Density effect ( approximately :)
48 bethe=(1.+ bg2)/bg2*(log(3.5*5940*bg) - bg2/(1.+ bg2));
52 //_________________________________________________________________________
53 Int_t AliTRDpidESD::MakePID(AliESD *event)
56 // This function calculates the "detector response" PID probabilities
58 static const Double_t masses[]={
59 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
61 Int_t ntrk=event->GetNumberOfTracks();
62 for (Int_t i=0; i<ntrk; i++) {
63 AliESDtrack *t=event->GetTrack(i);
64 if ((t->GetStatus()&AliESDtrack::kTRDin)==0)
65 if ((t->GetStatus()&AliESDtrack::kTRDout)==0)
66 if ((t->GetStatus()&AliESDtrack::kTRDrefit)==0) continue;
67 Int_t ns=AliESDtrack::kSPECIES;
69 for (Int_t j=0; j<ns; j++) {
70 Double_t mass=masses[j];
71 Double_t mom=t->GetP();
72 Double_t dedx=t->GetTRDsignal()/fMIP;
73 Double_t bethe=Bethe(mom/mass);
74 Double_t sigma=fRes*bethe;
75 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
76 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
79 p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;