]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFpidESD.cxx
Added AlidNdEtaCorrection (new procedure).
[u/mrichter/AliRoot.git] / TOF / AliTOFpidESD.cxx
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
25 #include "AliESDtrack.h"
26 #include "AliESD.h"
27
28 #include "AliTOFpidESD.h"
29
30 ClassImp(AliTOFpidESD)
31
32 //_________________________________________________________________________
33 AliTOFpidESD::AliTOFpidESD(Double_t *param) {
34   //
35   //  The main constructor
36   //
37   fN=0; fEventN=0;
38
39   fSigma=param[0];
40   fRange=param[1];
41
42 }
43
44 //_________________________________________________________________________
45 Int_t AliTOFpidESD::MakePID(AliESD *event)
46 {
47   //
48   //  This function calculates the "detector response" PID probabilities
49   //                Just for a bare hint... 
50
51   Int_t ntrk=event->GetNumberOfTracks();
52   AliESDtrack **tracks=new AliESDtrack*[ntrk];
53
54   Int_t i;
55   for (i=0; i<ntrk; i++) {
56     AliESDtrack *t=event->GetTrack(i);
57     tracks[i]=t;
58   }
59
60   for (i=0; i<ntrk; i++) {
61     AliESDtrack *t=tracks[i];
62     if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
63     if ((t->GetStatus()&AliESDtrack::kTIME)==0) continue;
64     Double_t tof=t->GetTOFsignal();
65     Double_t time[10]; t->GetIntegratedTimes(time);
66     Double_t p[10];
67     Double_t mom=t->GetP();
68     for (Int_t j=0; j<AliPID::kSPECIES; j++) {
69       Double_t mass=AliPID::ParticleMass(j);
70       Double_t dpp=0.01;      //mean relative pt resolution;
71       if (mom>0.5) dpp=0.01*mom;
72       Double_t sigma=dpp*time[j]/(1.+ mom*mom/(mass*mass));
73       sigma=TMath::Sqrt(sigma*sigma + fSigma*fSigma);
74       if (TMath::Abs(tof-time[j]) > fRange*sigma) {
75         p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
76         continue;
77       }
78       p[j]=TMath::Exp(-0.5*(tof-time[j])*(tof-time[j])/(sigma*sigma))/sigma;
79     }
80     t->SetTOFpid(p);
81   }
82
83   delete[] tracks;
84   
85   return 0;
86 }
87