]>
Commit | Line | Data |
---|---|---|
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 | ||
0e46b9ae | 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" | |
02cdc6ac | 24 | #include "AliLog.h" |
0e46b9ae | 25 | |
c630aafd | 26 | #include "AliESDtrack.h" |
af885e0f | 27 | #include "AliESDEvent.h" |
c630aafd | 28 | |
0e46b9ae | 29 | #include "AliTOFpidESD.h" |
30 | ||
c630aafd | 31 | ClassImp(AliTOFpidESD) |
32 | ||
0f4a7374 | 33 | //_________________________________________________________________________ |
655e379f | 34 | AliTOFpidESD::AliTOFpidESD(): |
35 | fN(-1), | |
36 | fEventN(-1), | |
37 | fSigma(0), | |
38 | fRange(0) | |
39 | { | |
40 | } | |
41 | //_________________________________________________________________________ | |
42 | AliTOFpidESD::AliTOFpidESD(Double_t *param): | |
43 | fN(0), | |
44 | fEventN(0), | |
45 | fSigma(0), | |
46 | fRange(0) | |
47 | { | |
0f4a7374 | 48 | // |
49 | // The main constructor | |
50 | // | |
0f4a7374 | 51 | fSigma=param[0]; |
52 | fRange=param[1]; | |
53 | ||
54 | } | |
55 | ||
bc9f08da | 56 | //_________________________________________________________________________ |
af885e0f | 57 | Int_t AliTOFpidESD::MakePID(AliESDEvent *event, Double_t timeZero) |
bc9f08da | 58 | { |
59 | // | |
60 | // This function calculates the "detector response" PID probabilities | |
61 | // Just for a bare hint... | |
62 | ||
02cdc6ac | 63 | AliDebug(1,Form("TOF PID Parameters: Sigma (ps)= %f, Range= %f",fSigma,fRange)); |
64 | AliDebug(1,"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \n"); | |
bc9f08da | 65 | Int_t ntrk=event->GetNumberOfTracks(); |
66 | AliESDtrack **tracks=new AliESDtrack*[ntrk]; | |
67 | ||
68 | Int_t i; | |
69 | for (i=0; i<ntrk; i++) { | |
70 | AliESDtrack *t=event->GetTrack(i); | |
71 | tracks[i]=t; | |
72 | } | |
73 | ||
74 | for (i=0; i<ntrk; i++) { | |
75 | AliESDtrack *t=tracks[i]; | |
76 | if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue; | |
77 | if ((t->GetStatus()&AliESDtrack::kTIME)==0) continue; | |
78 | Double_t tof=t->GetTOFsignal()-timeZero; | |
79 | Double_t time[10]; t->GetIntegratedTimes(time); | |
80 | Double_t p[10]; | |
81 | Double_t mom=t->GetP(); | |
82 | for (Int_t j=0; j<AliPID::kSPECIES; j++) { | |
83 | Double_t mass=AliPID::ParticleMass(j); | |
84 | Double_t dpp=0.01; //mean relative pt resolution; | |
85 | if (mom>0.5) dpp=0.01*mom; | |
86 | Double_t sigma=dpp*time[j]/(1.+ mom*mom/(mass*mass)); | |
87 | sigma=TMath::Sqrt(sigma*sigma + fSigma*fSigma); | |
88 | if (TMath::Abs(tof-time[j]) > fRange*sigma) { | |
89 | p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma; | |
90 | continue; | |
91 | } | |
92 | p[j]=TMath::Exp(-0.5*(tof-time[j])*(tof-time[j])/(sigma*sigma))/sigma; | |
93 | } | |
94 | t->SetTOFpid(p); | |
95 | } | |
96 | ||
97 | delete[] tracks; | |
98 | ||
99 | return 0; | |
100 | } | |
101 | ||
c630aafd | 102 | //_________________________________________________________________________ |
af885e0f | 103 | Int_t AliTOFpidESD::MakePID(AliESDEvent *event) |
c630aafd | 104 | { |
105 | // | |
106 | // This function calculates the "detector response" PID probabilities | |
107 | // Just for a bare hint... | |
108 | ||
c630aafd | 109 | Int_t ntrk=event->GetNumberOfTracks(); |
3f83f224 | 110 | AliESDtrack **tracks=new AliESDtrack*[ntrk]; |
111 | ||
112 | Int_t i; | |
113 | for (i=0; i<ntrk; i++) { | |
c630aafd | 114 | AliESDtrack *t=event->GetTrack(i); |
3f83f224 | 115 | tracks[i]=t; |
116 | } | |
3f83f224 | 117 | |
3f83f224 | 118 | for (i=0; i<ntrk; i++) { |
119 | AliESDtrack *t=tracks[i]; | |
74ea065c | 120 | if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue; |
3f83f224 | 121 | if ((t->GetStatus()&AliESDtrack::kTIME)==0) continue; |
74ea065c | 122 | Double_t tof=t->GetTOFsignal(); |
123 | Double_t time[10]; t->GetIntegratedTimes(time); | |
c630aafd | 124 | Double_t p[10]; |
125 | Double_t mom=t->GetP(); | |
304864ab | 126 | for (Int_t j=0; j<AliPID::kSPECIES; j++) { |
127 | Double_t mass=AliPID::ParticleMass(j); | |
3f83f224 | 128 | Double_t dpp=0.01; //mean relative pt resolution; |
129 | if (mom>0.5) dpp=0.01*mom; | |
130 | Double_t sigma=dpp*time[j]/(1.+ mom*mom/(mass*mass)); | |
c630aafd | 131 | sigma=TMath::Sqrt(sigma*sigma + fSigma*fSigma); |
132 | if (TMath::Abs(tof-time[j]) > fRange*sigma) { | |
431be10d | 133 | p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma; |
c630aafd | 134 | continue; |
135 | } | |
431be10d | 136 | p[j]=TMath::Exp(-0.5*(tof-time[j])*(tof-time[j])/(sigma*sigma))/sigma; |
c630aafd | 137 | } |
c630aafd | 138 | t->SetTOFpid(p); |
c630aafd | 139 | } |
140 | ||
3f83f224 | 141 | delete[] tracks; |
74ea065c | 142 | |
c630aafd | 143 | return 0; |
144 | } | |
0f4a7374 | 145 |