]>
Commit | Line | Data |
---|---|---|
121a60bd | 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 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // class for TOF reconstruction // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
b09247a2 | 24 | #include <cstdlib> |
6b025efd | 25 | #include "TObjArray.h" |
26 | #include "TString.h" | |
d08a92dd | 27 | |
28 | #include "AliLog.h" | |
f858b00e | 29 | #include "AliESDEvent.h" |
30 | #include "AliESDpid.h" | |
0e46b9ae | 31 | #include "AliRawReader.h" |
f858b00e | 32 | #include "AliTOFHeader.h" |
d08a92dd | 33 | |
0e46b9ae | 34 | #include "AliTOFClusterFinder.h" |
e3bd5504 | 35 | #include "AliTOFClusterFinderV1.h" |
a98acac1 | 36 | #include "AliTOFcalib.h" |
d88fbf15 | 37 | #include "AliTOFtrackerMI.h" |
0e46b9ae | 38 | #include "AliTOFtracker.h" |
eeef0c5d | 39 | #include "AliTOFtrackerV1.h" |
f858b00e | 40 | #include "AliTOFT0maker.h" |
d08a92dd | 41 | #include "AliTOFReconstructor.h" |
6786addd | 42 | #include "AliTOFTriggerMask.h" |
43 | #include "AliTOFTrigger.h" | |
121a60bd | 44 | |
0e46b9ae | 45 | class TTree; |
46 | ||
121a60bd | 47 | ClassImp(AliTOFReconstructor) |
48 | ||
a98acac1 | 49 | //____________________________________________________________________ |
6786addd | 50 | AliTOFReconstructor::AliTOFReconstructor() : |
51 | AliReconstructor(), | |
52 | fTOFcalib(0), | |
53 | /*fTOFT0maker(0),*/ | |
54 | fNumberOfTofClusters(0), | |
55 | fNumberOfTofTrgPads(0), | |
56 | fClusterFinder(0), | |
57 | fClusterFinderV1(0) | |
a98acac1 | 58 | { |
59 | // | |
60 | // ctor | |
61 | // | |
6b025efd | 62 | |
a98acac1 | 63 | //Retrieving the TOF calibration info |
5b4ed716 | 64 | fTOFcalib = new AliTOFcalib(); |
65 | fTOFcalib->Init(); | |
6786addd | 66 | fClusterFinder = new AliTOFClusterFinder(fTOFcalib); |
67 | fClusterFinderV1 = new AliTOFClusterFinderV1(fTOFcalib); | |
68 | ||
69 | TString optionString = GetOption(); | |
70 | if (optionString.Contains("DecoderV0")) { | |
71 | fClusterFinder->SetDecoderVersion(0); | |
72 | fClusterFinderV1->SetDecoderVersion(0); | |
73 | } | |
74 | else if (optionString.Contains("DecoderV1")) { | |
75 | fClusterFinder->SetDecoderVersion(1); | |
76 | fClusterFinderV1->SetDecoderVersion(1); | |
77 | } | |
78 | else { | |
79 | fClusterFinder->SetDecoderVersion(2); | |
80 | fClusterFinderV1->SetDecoderVersion(2); | |
81 | } | |
82 | ||
83 | ||
5b4ed716 | 84 | |
85 | #if 0 | |
24d1e16e | 86 | fTOFcalib->CreateCalObjects(); |
17149e6b | 87 | |
88 | if(!fTOFcalib->ReadParOnlineDelayFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);} | |
89 | if(!fTOFcalib->ReadParOnlineStatusFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);} | |
90 | ||
ba66add8 | 91 | if(!fTOFcalib->ReadParOfflineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);} |
2bf4d9d6 | 92 | |
93 | ||
94 | if(!fTOFcalib->ReadDeltaBCOffsetFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);} | |
95 | if(!fTOFcalib->ReadCTPLatencyFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);} | |
96 | if(!fTOFcalib->ReadT0FillFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);} | |
f04b3a69 | 97 | if(!fTOFcalib->ReadRunParamsFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);} |
5b4ed716 | 98 | #endif |
99 | ||
a98acac1 | 100 | } |
101 | ||
a98acac1 | 102 | //_____________________________________________________________________________ |
103 | AliTOFReconstructor::~AliTOFReconstructor() | |
104 | { | |
105 | // | |
106 | // dtor | |
107 | // | |
f858b00e | 108 | |
a98acac1 | 109 | delete fTOFcalib; |
f858b00e | 110 | |
111 | //delete fTOFT0maker; | |
6786addd | 112 | fNumberOfTofClusters = 0; |
113 | fNumberOfTofTrgPads = 0; | |
f858b00e | 114 | |
6786addd | 115 | delete fClusterFinder; |
116 | delete fClusterFinderV1; | |
a98acac1 | 117 | } |
118 | ||
d08a92dd | 119 | //_____________________________________________________________________________ |
120 | void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader, | |
121 | TTree *clustersTree) const | |
122 | { | |
e3bd5504 | 123 | // |
124 | // reconstruct clusters from Raw Data | |
125 | // | |
126 | ||
17bb1d52 | 127 | TString optionString = GetOption(); |
5b4ed716 | 128 | |
e3bd5504 | 129 | // use V1 cluster finder if selected |
17bb1d52 | 130 | if (optionString.Contains("ClusterizerV1")) { |
6786addd | 131 | /* |
132 | AliTOFClusterFinderV1 tofClus(fTOFcalib); | |
17bb1d52 | 133 | |
134 | // decoder version option | |
5b4ed716 | 135 | if (optionString.Contains("DecoderV0")) { |
17bb1d52 | 136 | tofClus.SetDecoderVersion(0); |
5b4ed716 | 137 | } |
138 | else if (optionString.Contains("DecoderV1")) { | |
22f79281 | 139 | tofClus.SetDecoderVersion(1); |
5b4ed716 | 140 | } |
141 | else { | |
142 | tofClus.SetDecoderVersion(2); | |
143 | } | |
6786addd | 144 | |
e3bd5504 | 145 | tofClus.Digits2RecPoints(rawReader, clustersTree); |
6786addd | 146 | */ |
147 | ||
148 | fClusterFinderV1->Digits2RecPoints(rawReader, clustersTree); | |
e3bd5504 | 149 | } |
150 | else { | |
6786addd | 151 | /* |
152 | AliTOFClusterFinder tofClus(fTOFcalib); | |
153 | ||
17bb1d52 | 154 | // decoder version option |
5b4ed716 | 155 | if (optionString.Contains("DecoderV0")) { |
17bb1d52 | 156 | tofClus.SetDecoderVersion(0); |
5b4ed716 | 157 | } |
158 | else if (optionString.Contains("DecoderV1")) { | |
22f79281 | 159 | tofClus.SetDecoderVersion(1); |
5b4ed716 | 160 | } |
161 | else { | |
162 | tofClus.SetDecoderVersion(2); | |
163 | } | |
17bb1d52 | 164 | |
e3bd5504 | 165 | tofClus.Digits2RecPoints(rawReader, clustersTree); |
121a60bd | 166 | |
6786addd | 167 | */ |
168 | ||
169 | fClusterFinder->Digits2RecPoints(rawReader, clustersTree); | |
170 | } | |
171 | AliTOFTrigger::PrepareTOFMapFromRaw(rawReader,13600); // 13600 +/- 400 is the value to select the richt bunch crossing (in future from OCDB) | |
121a60bd | 172 | } |
173 | ||
a98acac1 | 174 | //_____________________________________________________________________________ |
175 | void AliTOFReconstructor::Reconstruct(TTree *digitsTree, | |
176 | TTree *clustersTree) const | |
177 | { | |
e3bd5504 | 178 | // |
179 | // reconstruct clusters from digits | |
180 | // | |
a98acac1 | 181 | |
182 | AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree")); | |
e3bd5504 | 183 | |
17bb1d52 | 184 | TString optionString = GetOption(); |
e3bd5504 | 185 | // use V1 cluster finder if selected |
17bb1d52 | 186 | if (optionString.Contains("ClusterizerV1")) { |
6786addd | 187 | /* |
188 | AliTOFClusterFinderV1 tofClus(fTOFcalib); | |
17bb1d52 | 189 | |
190 | // decoder version option | |
5b4ed716 | 191 | if (optionString.Contains("DecoderV0")) { |
17bb1d52 | 192 | tofClus.SetDecoderVersion(0); |
5b4ed716 | 193 | } |
194 | else if (optionString.Contains("DecoderV1")) { | |
22f79281 | 195 | tofClus.SetDecoderVersion(1); |
5b4ed716 | 196 | } |
197 | else { | |
198 | tofClus.SetDecoderVersion(2); | |
199 | } | |
17bb1d52 | 200 | |
e3bd5504 | 201 | tofClus.Digits2RecPoints(digitsTree, clustersTree); |
6786addd | 202 | */ |
203 | fClusterFinderV1->Digits2RecPoints(digitsTree, clustersTree); | |
e3bd5504 | 204 | } |
205 | else { | |
6786addd | 206 | /* |
207 | AliTOFClusterFinder tofClus(fTOFcalib); | |
17bb1d52 | 208 | |
209 | // decoder version option | |
5b4ed716 | 210 | if (optionString.Contains("DecoderV0")) { |
17bb1d52 | 211 | tofClus.SetDecoderVersion(0); |
5b4ed716 | 212 | } |
213 | else if (optionString.Contains("DecoderV1")) { | |
22f79281 | 214 | tofClus.SetDecoderVersion(1); |
5b4ed716 | 215 | } |
216 | else { | |
217 | tofClus.SetDecoderVersion(2); | |
218 | } | |
17bb1d52 | 219 | |
e3bd5504 | 220 | tofClus.Digits2RecPoints(digitsTree, clustersTree); |
6786addd | 221 | */ |
222 | ||
223 | fClusterFinder->Digits2RecPoints(digitsTree, clustersTree); | |
224 | AliTOFTrigger::PrepareTOFMapFromDigit(digitsTree); | |
225 | ||
e3bd5504 | 226 | } |
a98acac1 | 227 | |
228 | } | |
229 | //_____________________________________________________________________________ | |
230 | void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const | |
231 | { | |
232 | // reconstruct clusters from digits | |
233 | ||
234 | AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree")); | |
e3bd5504 | 235 | |
17bb1d52 | 236 | TString optionString = GetOption(); |
e3bd5504 | 237 | // use V1 cluster finder if selected |
17bb1d52 | 238 | if (optionString.Contains("ClusterizerV1")) { |
6786addd | 239 | /* |
240 | AliTOFClusterFinderV1 tofClus(fTOFcalib); | |
17bb1d52 | 241 | |
242 | // decoder version option | |
5b4ed716 | 243 | if (optionString.Contains("DecoderV0")) { |
17bb1d52 | 244 | tofClus.SetDecoderVersion(0); |
5b4ed716 | 245 | } |
246 | else if (optionString.Contains("DecoderV1")) { | |
22f79281 | 247 | tofClus.SetDecoderVersion(1); |
5b4ed716 | 248 | } |
249 | else { | |
250 | tofClus.SetDecoderVersion(2); | |
251 | } | |
17bb1d52 | 252 | |
e3bd5504 | 253 | tofClus.Raw2Digits(reader, digitsTree); |
6786addd | 254 | */ |
255 | ||
256 | fClusterFinderV1->Digits2RecPoints(reader, digitsTree); | |
e3bd5504 | 257 | } |
258 | else { | |
6786addd | 259 | /* |
260 | AliTOFClusterFinder tofClus(fTOFcalib); | |
17bb1d52 | 261 | |
262 | // decoder version option | |
5b4ed716 | 263 | if (optionString.Contains("DecoderV0")) { |
17bb1d52 | 264 | tofClus.SetDecoderVersion(0); |
5b4ed716 | 265 | } |
266 | else if (optionString.Contains("DecoderV1")) { | |
22f79281 | 267 | tofClus.SetDecoderVersion(1); |
5b4ed716 | 268 | } |
269 | else { | |
270 | tofClus.SetDecoderVersion(2); | |
271 | } | |
17bb1d52 | 272 | |
e3bd5504 | 273 | tofClus.Raw2Digits(reader, digitsTree); |
6786addd | 274 | */ |
275 | ||
276 | fClusterFinder->Digits2RecPoints(reader, digitsTree); | |
277 | ||
e3bd5504 | 278 | } |
a98acac1 | 279 | |
280 | } | |
281 | ||
121a60bd | 282 | //_____________________________________________________________________________ |
d76c31f4 | 283 | AliTracker* AliTOFReconstructor::CreateTracker() const |
121a60bd | 284 | { |
3a646035 | 285 | |
286 | // | |
287 | // create a TOF tracker using | |
288 | // TOF Reco Param collected by STEER | |
289 | // | |
121a60bd | 290 | |
d88fbf15 | 291 | TString selectedTracker = GetOption(); |
3a646035 | 292 | |
293 | AliTracker *tracker; | |
d88fbf15 | 294 | // use MI tracker if selected |
17bb1d52 | 295 | if (selectedTracker.Contains("TrackerMI")) { |
3a646035 | 296 | tracker = new AliTOFtrackerMI(); |
297 | } | |
298 | // use V1 tracker if selected | |
a572506f | 299 | else if (selectedTracker.Contains("TrackerV1")) { |
3a646035 | 300 | tracker = new AliTOFtrackerV1(); |
301 | } | |
302 | else { | |
303 | tracker = new AliTOFtracker(); | |
304 | } | |
305 | return tracker; | |
121a60bd | 306 | |
e3bd5504 | 307 | } |
f858b00e | 308 | |
309 | //_____________________________________________________________________________ | |
310 | void AliTOFReconstructor::FillEventTimeWithTOF(AliESDEvent *event, AliESDpid *esdPID) | |
311 | { | |
312 | // | |
313 | // Fill AliESDEvent::fTOFHeader variable | |
314 | // It contains the event_time estiamted by the TOF combinatorial algorithm | |
315 | // | |
316 | ||
6786addd | 317 | |
318 | // Set here F. Noferini | |
319 | AliTOFTriggerMask *mapTrigger = AliTOFTrigger::GetTOFTriggerMap(); | |
320 | ||
321 | ||
322 | TString optionString = GetOption(); | |
323 | if (optionString.Contains("ClusterizerV1")) { | |
324 | fNumberOfTofClusters=fClusterFinderV1->GetNumberOfTOFclusters(); | |
325 | fNumberOfTofTrgPads=fClusterFinderV1->GetNumberOfTOFtrgPads(); | |
326 | AliInfo(Form(" Number of TOF cluster readout = %d ",fNumberOfTofClusters)); | |
327 | AliInfo(Form(" Number of TOF cluster readout in trigger window = %d ",fNumberOfTofTrgPads)); | |
328 | } else { | |
329 | fNumberOfTofClusters=fClusterFinder->GetNumberOfTOFclusters(); | |
330 | fNumberOfTofTrgPads=fClusterFinder->GetNumberOfTOFtrgPads(); | |
331 | AliInfo(Form(" Number of TOF cluster readout = %d ",fNumberOfTofClusters)); | |
332 | AliInfo(Form(" Number of TOF cluster readout in trigger window = %d ",fNumberOfTofTrgPads)); | |
333 | } | |
334 | ||
5c1e5810 | 335 | if (!GetRecoParam()) AliFatal("cannot get TOF RECO params"); |
336 | ||
f858b00e | 337 | Float_t tofResolution = GetRecoParam()->GetTimeResolution();// TOF time resolution in ps |
d486a5ef | 338 | AliTOFT0maker *tofT0maker = new AliTOFT0maker(esdPID); |
f858b00e | 339 | tofT0maker->SetTimeResolution(tofResolution); |
340 | tofT0maker->ComputeT0TOF(event); | |
341 | tofT0maker->WriteInESD(event); | |
342 | tofT0maker->~AliTOFT0maker(); | |
343 | delete tofT0maker; | |
344 | ||
d486a5ef | 345 | esdPID->SetTOFResponse(event,(AliESDpid::EStartTimeType_t)GetRecoParam()->GetStartTimeType()); |
346 | ||
6786addd | 347 | |
348 | event->GetTOFHeader()->SetNumberOfTOFclusters(fNumberOfTofClusters); | |
349 | event->GetTOFHeader()->SetNumberOfTOFtrgPads(fNumberOfTofTrgPads); | |
350 | event->GetTOFHeader()->SetTriggerMask(mapTrigger); | |
351 | AliInfo(Form(" Number of readout cluster in trigger window = %d ; number of trgPads from Trigger map = %d", | |
352 | event->GetTOFHeader()->GetNumberOfTOFtrgPads(), | |
353 | event->GetTOFHeader()->GetNumberOfTOFmaxipad())); | |
354 | ||
355 | fClusterFinderV1->ResetDigits(); | |
356 | fClusterFinderV1->ResetRecpoint(); | |
357 | fClusterFinder->ResetRecpoint(); | |
358 | fClusterFinderV1->Clear(); | |
359 | fClusterFinder->Clear(); | |
360 | ||
f858b00e | 361 | } |
362 | ||
c2fb5b09 | 363 | //_____________________________________________________________________________ |
364 | void | |
35b6d6a6 | 365 | AliTOFReconstructor::FillESD(TTree *, TTree *, AliESDEvent * /*esdEvent*/) const |
c2fb5b09 | 366 | { |
367 | // | |
368 | // correct Texp | |
369 | // | |
370 | // | |
371 | ||
5a388465 | 372 | // fTOFcalib->CalibrateTExp(esdEvent); |
c2fb5b09 | 373 | } |