]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFpidESD.cxx
Use ESD objects from a tree (T.Kuhr)
[u/mrichter/AliRoot.git] / TOF / AliTOFpidESD.cxx
CommitLineData
c630aafd 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 TOF PID class
c630aafd 18// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
19//-----------------------------------------------------------------
3f83f224 20#include "TError.h"
c630aafd 21#include "AliTOFpidESD.h"
c630aafd 22#include "AliESDtrack.h"
2c770f53 23#include "AliESD.h"
c630aafd 24
25ClassImp(AliTOFpidESD)
26
0f4a7374 27//_________________________________________________________________________
8c29135e 28AliTOFpidESD::AliTOFpidESD(Double_t *param) {
0f4a7374 29 //
30 // The main constructor
31 //
0f4a7374 32 fN=0; fEventN=0;
33
34 fSigma=param[0];
35 fRange=param[1];
36
37}
38
c630aafd 39//_________________________________________________________________________
40Int_t AliTOFpidESD::MakePID(AliESD *event)
41{
42 //
43 // This function calculates the "detector response" PID probabilities
44 // Just for a bare hint...
45
3f83f224 46 static const Double_t kMasses[]={
c630aafd 47 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
48 };
49
50 Int_t ntrk=event->GetNumberOfTracks();
3f83f224 51 AliESDtrack **tracks=new AliESDtrack*[ntrk];
52
53 Int_t i;
54 for (i=0; i<ntrk; i++) {
c630aafd 55 AliESDtrack *t=event->GetTrack(i);
3f83f224 56 tracks[i]=t;
57 }
3f83f224 58
3f83f224 59 for (i=0; i<ntrk; i++) {
60 AliESDtrack *t=tracks[i];
74ea065c 61 if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue;
3f83f224 62 if ((t->GetStatus()&AliESDtrack::kTIME)==0) continue;
74ea065c 63 Double_t tof=t->GetTOFsignal();
64 Double_t time[10]; t->GetIntegratedTimes(time);
c630aafd 65 Double_t p[10];
66 Double_t mom=t->GetP();
67 for (Int_t j=0; j<AliESDtrack::kSPECIES; j++) {
3f83f224 68 Double_t mass=kMasses[j];
69 Double_t dpp=0.01; //mean relative pt resolution;
70 if (mom>0.5) dpp=0.01*mom;
71 Double_t sigma=dpp*time[j]/(1.+ mom*mom/(mass*mass));
c630aafd 72 sigma=TMath::Sqrt(sigma*sigma + fSigma*fSigma);
73 if (TMath::Abs(tof-time[j]) > fRange*sigma) {
431be10d 74 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
c630aafd 75 continue;
76 }
431be10d 77 p[j]=TMath::Exp(-0.5*(tof-time[j])*(tof-time[j])/(sigma*sigma))/sigma;
c630aafd 78 }
c630aafd 79 t->SetTOFpid(p);
c630aafd 80 }
81
3f83f224 82 delete[] tracks;
74ea065c 83
c630aafd 84 return 0;
85}
0f4a7374 86