]>
Commit | Line | Data |
---|---|---|
8f589502 | 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 | **************************************************************************/ | |
6a4e212e | 15 | /* $Id: AliTOFT0maker.cxx,v 1.8 2010/01/19 16:32:20 noferini Exp $ */ |
8f589502 | 16 | |
17 | ///////////////////////////////////////////////////////////////////////////// | |
18 | // // | |
19 | // This class contains the basic functions for the time zero // | |
6a4e212e | 20 | // evaluation with TOF detector informations. // |
21 | // Use case in an analysis task: // | |
22 | // // | |
23 | // Create the object in the task constructor (fTOFmaker is a private var) // | |
24 | // fTOFmaker = new AliTOFT0maker(); // | |
25 | // fTOFmaker->SetTimeResolution(115.0e-12); // if you want set the TOF res // | |
26 | // 115 ps is the TOF default resolution value // | |
27 | // // | |
28 | // Use the RemakePID method in the task::Exec // | |
29 | // Double_t* calcolot0; // | |
30 | // calcolot0=fTOFmaker->RemakePID(fESD); // | |
31 | // //calcolot0[0] = calculated event time // | |
32 | // //calcolot0[1] = event time time resolution // | |
33 | // //calcolot0[2] = average event time for the current fill // | |
34 | // // | |
35 | // Let consider that: // | |
36 | // - the PIF is automatically recalculated with the event time subtrction // | |
8f589502 | 37 | // // |
38 | ///////////////////////////////////////////////////////////////////////////// | |
39 | ||
536031f2 | 40 | #include <Riostream.h> |
41 | #include <stdlib.h> | |
42 | ||
43 | #include "AliTOFT0v1.h" | |
44 | #include "AliTOFT0maker.h" | |
45 | #include "AliTOFcalibHisto.h" | |
46 | #include "AliPID.h" | |
47 | #include "AliESDpid.h" | |
536031f2 | 48 | |
49 | ClassImp(AliTOFT0maker) | |
50 | ||
51 | //____________________________________________________________________________ | |
6a4e212e | 52 | AliTOFT0maker::AliTOFT0maker() : |
53 | TObject(), | |
54 | fCalib(new AliTOFcalibHisto()), | |
8f589502 | 55 | fESDswitch(0), |
56 | fTimeResolution(115), | |
57 | fT0sigma(1000) | |
536031f2 | 58 | { |
6a4e212e | 59 | // |
60 | // ctr | |
61 | // | |
62 | ||
63 | fCalculated[0] = 0; | |
64 | fCalculated[1] = 0; | |
65 | fCalculated[2] = 0; | |
66 | ||
536031f2 | 67 | fCalib->LoadCalibPar(); |
68 | ||
69 | if(AliPID::ParticleMass(0) == 0) new AliPID(); | |
70 | } | |
71 | //____________________________________________________________________________ | |
8f589502 | 72 | AliTOFT0maker::AliTOFT0maker(const AliTOFT0maker & t) : |
73 | TObject(), | |
74 | fCalib(t.fCalib), | |
75 | fESDswitch(t.fESDswitch), | |
76 | fTimeResolution(t.fTimeResolution), | |
77 | fT0sigma(t.fT0sigma) | |
78 | { | |
79 | } | |
80 | ||
81 | //____________________________________________________________________________ | |
82 | AliTOFT0maker& AliTOFT0maker::operator=(const AliTOFT0maker &t) | |
83 | { | |
6a4e212e | 84 | // |
8f589502 | 85 | // assign. operator |
86 | // | |
87 | ||
88 | if (this == &t) | |
89 | return *this; | |
90 | fCalib = t.fCalib; | |
91 | fESDswitch = t.fESDswitch; | |
92 | fTimeResolution = t.fTimeResolution; | |
93 | fT0sigma = t.fT0sigma; | |
94 | ||
95 | return *this; | |
96 | } | |
97 | //____________________________________________________________________________ | |
536031f2 | 98 | AliTOFT0maker::~AliTOFT0maker() |
99 | { | |
100 | // dtor | |
101 | if(fCalib) delete fCalib; | |
102 | } | |
103 | //____________________________________________________________________________ | |
104 | Double_t* AliTOFT0maker::RemakePID(AliESDEvent *esd,Double_t t0time,Double_t t0sigma){ | |
8f589502 | 105 | // |
106 | // Remake TOF PID probabilities | |
107 | // | |
108 | ||
8f589502 | 109 | Double_t *t0tof; |
536031f2 | 110 | |
111 | AliTOFT0v1* t0maker=new AliTOFT0v1(esd); | |
112 | t0maker->SetCalib(fCalib); | |
113 | t0maker->SetTimeResolution(fTimeResolution*1e-12); | |
114 | ||
115 | if(! fESDswitch){ | |
8f589502 | 116 | t0tof=t0maker->DefineT0RawCorrection("all"); |
536031f2 | 117 | TakeTimeRawCorrection(esd); |
118 | } | |
8f589502 | 119 | else t0tof=t0maker->DefineT0("all"); |
536031f2 | 120 | |
8f589502 | 121 | Float_t lT0Current=0.; |
536031f2 | 122 | fT0sigma=1000; |
123 | ||
8f589502 | 124 | Int_t nrun = esd->GetRunNumber(); |
125 | Double_t t0fill = GetT0Fill(nrun); | |
126 | ||
6a4e212e | 127 | fCalculated[0]=-1000*t0tof[0]; |
128 | fCalculated[1]=1000*t0tof[1]; | |
129 | fCalculated[2] = t0fill; | |
8f589502 | 130 | |
6a4e212e | 131 | if(fCalculated[1] < 150 && TMath::Abs(fCalculated[0] - t0fill) < 500){ |
132 | fT0sigma=fCalculated[1]; | |
133 | lT0Current=fCalculated[0]; | |
536031f2 | 134 | } |
135 | ||
136 | if(t0sigma < 1000){ | |
137 | if(fT0sigma < 1000){ | |
138 | Double_t w1 = 1./t0sigma/t0sigma; | |
6a4e212e | 139 | Double_t w2 = 1./fCalculated[1]/fCalculated[1]; |
536031f2 | 140 | |
141 | Double_t wtot = w1+w2; | |
142 | ||
6a4e212e | 143 | lT0Current = (w1*t0time + w2*fCalculated[0]) / wtot; |
536031f2 | 144 | fT0sigma = TMath::Sqrt(1./wtot); |
145 | } | |
146 | else{ | |
8f589502 | 147 | lT0Current=t0time; |
536031f2 | 148 | fT0sigma=t0sigma; |
149 | } | |
150 | } | |
151 | ||
536031f2 | 152 | if(fT0sigma >= 1000){ |
8f589502 | 153 | lT0Current = t0fill; |
536031f2 | 154 | fT0sigma = 135; |
8f589502 | 155 | |
6a4e212e | 156 | fCalculated[0] = t0fill; |
157 | fCalculated[1] = 150; | |
536031f2 | 158 | } |
159 | ||
8f589502 | 160 | RemakeTOFpid(esd,lT0Current); |
536031f2 | 161 | |
6a4e212e | 162 | return fCalculated; |
536031f2 | 163 | } |
164 | //____________________________________________________________________________ | |
8f589502 | 165 | void AliTOFT0maker::TakeTimeRawCorrection(AliESDEvent * const esd){ |
166 | // | |
167 | // Take raw corrections for time measurements | |
168 | // | |
169 | ||
536031f2 | 170 | Int_t ntracks = esd->GetNumberOfTracks(); |
171 | ||
172 | while (ntracks--) { | |
173 | AliESDtrack *t=esd->GetTrack(ntracks); | |
174 | ||
175 | if ((t->GetStatus()&AliESDtrack::kTOFout)==0) continue; | |
176 | ||
177 | Double_t time=t->GetTOFsignalRaw(); | |
178 | Double_t tot = t->GetTOFsignalToT(); | |
179 | Int_t chan = t->GetTOFCalChannel(); | |
180 | Double_t corr = fCalib->GetFullCorrection(chan,tot) - fCalib->GetCorrection(AliTOFcalibHisto::kTimeSlewingCorr,chan,0); | |
181 | time -= corr*1000; | |
182 | ||
183 | Int_t crate = Int_t(fCalib->GetCalibMap(AliTOFcalibHisto::kDDL,chan)); | |
184 | ||
185 | if(crate == 63 || crate == 62){ | |
186 | time += 9200; | |
187 | } | |
188 | ||
189 | t->SetTOFsignal(time); | |
190 | } | |
191 | } | |
192 | //____________________________________________________________________________ | |
193 | void AliTOFT0maker::RemakeTOFpid(AliESDEvent *esd,Float_t timezero){ | |
8f589502 | 194 | // |
195 | // Recalculate TOF PID probabilities | |
196 | // | |
197 | ||
10d100d4 | 198 | AliESDpid pidESD; |
199 | pidESD.GetTOFResponse().SetTimeResolution(TMath::Sqrt(fT0sigma*fT0sigma + fTimeResolution*fTimeResolution)); | |
200 | pidESD.MakePID(esd,kFALSE,timezero); | |
536031f2 | 201 | |
202 | } | |
203 | //____________________________________________________________________________ | |
8f589502 | 204 | Double_t AliTOFT0maker::GetT0Fill(Int_t nrun) const { |
205 | // | |
206 | // Return T0 of filling | |
207 | // | |
208 | ||
536031f2 | 209 | Double_t t0; |
210 | if(nrun==104065) t0= 1771614; | |
211 | else if(nrun==104068) t0= 1771603; | |
212 | else if(nrun==104070) t0= 1771594; | |
213 | else if(nrun==104073) t0= 1771610; | |
214 | else if(nrun==104080) t0= 1771305; | |
215 | else if(nrun==104083) t0= 1771613; | |
216 | else if(nrun==104157) t0= 1771665; | |
217 | else if(nrun==104159) t0= 1771679; | |
218 | else if(nrun==104160) t0= 1771633; | |
219 | else if(nrun==104316) t0= 1764344; | |
220 | else if(nrun==104320) t0= 1764342; | |
221 | else if(nrun==104321) t0= 1764371; | |
222 | else if(nrun==104439) t0= 1771750; | |
223 | else if(nrun==104792) t0= 1771755; | |
224 | else if(nrun==104793) t0= 1771762; | |
225 | else if(nrun==104799) t0= 1771828; | |
226 | else if(nrun==104800) t0= 1771788; | |
227 | else if(nrun==104801) t0= 1771796; | |
228 | else if(nrun==104802) t0= 1771775; | |
229 | else if(nrun==104803) t0= 1771795; | |
230 | else if(nrun==104824) t0= 1771751; | |
231 | else if(nrun==104825) t0= 1771763; | |
232 | else if(nrun==104845) t0= 1771792; | |
233 | else if(nrun==104852) t0= 1771817; | |
234 | else if(nrun==104864) t0= 1771825; | |
235 | else if(nrun==104865) t0= 1771827; | |
236 | else if(nrun==104867) t0= 1771841; | |
237 | else if(nrun==104876) t0= 1771856; | |
238 | else if(nrun==104878) t0= 1771847; | |
239 | else if(nrun==104879) t0= 1771830; | |
240 | else if(nrun==104892) t0= 1771837; | |
6a4e212e | 241 | else t0= 487; |
536031f2 | 242 | |
243 | if(fESDswitch) t0 -= 487; | |
244 | ||
245 | return t0; | |
246 | } |