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