]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TOF/AliTOFReconstructor.cxx
Improved QAchecker and plots for DQM
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructor.cxx
... / ...
CommitLineData
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
24#include <cstdlib>
25#include "TObjArray.h"
26#include "TString.h"
27
28#include "AliLog.h"
29#include "AliESDEvent.h"
30#include "AliESDpid.h"
31#include "AliRawReader.h"
32#include "AliTOFHeader.h"
33
34#include "AliTOFClusterFinder.h"
35#include "AliTOFClusterFinderV1.h"
36#include "AliTOFcalib.h"
37#include "AliTOFtrackerMI.h"
38#include "AliTOFtracker.h"
39#include "AliTOFtrackerV1.h"
40#include "AliTOFT0maker.h"
41#include "AliTOFReconstructor.h"
42
43class TTree;
44
45ClassImp(AliTOFReconstructor)
46
47 //____________________________________________________________________
48AliTOFReconstructor::AliTOFReconstructor()
49 : AliReconstructor(),
50 fTOFcalib(0)/*,
51 fTOFT0maker(0)*/
52{
53//
54// ctor
55//
56
57 //Retrieving the TOF calibration info
58 fTOFcalib = new AliTOFcalib();
59 fTOFcalib->Init();
60
61#if 0
62 fTOFcalib->CreateCalObjects();
63
64 if(!fTOFcalib->ReadParOnlineDelayFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
65 if(!fTOFcalib->ReadParOnlineStatusFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
66
67 if(!fTOFcalib->ReadParOfflineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
68
69
70 if(!fTOFcalib->ReadDeltaBCOffsetFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
71 if(!fTOFcalib->ReadCTPLatencyFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
72 if(!fTOFcalib->ReadT0FillFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
73 if(!fTOFcalib->ReadRunParamsFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
74#endif
75
76}
77
78//_____________________________________________________________________________
79AliTOFReconstructor::~AliTOFReconstructor()
80{
81//
82// dtor
83//
84
85 delete fTOFcalib;
86
87 //delete fTOFT0maker;
88
89}
90
91//_____________________________________________________________________________
92void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
93 TTree *clustersTree) const
94{
95 //
96 // reconstruct clusters from Raw Data
97 //
98
99 TString optionString = GetOption();
100
101 // use V1 cluster finder if selected
102 if (optionString.Contains("ClusterizerV1")) {
103 static AliTOFClusterFinderV1 tofClus(fTOFcalib);
104
105 // decoder version option
106 if (optionString.Contains("DecoderV0")) {
107 tofClus.SetDecoderVersion(0);
108 }
109 else if (optionString.Contains("DecoderV1")) {
110 tofClus.SetDecoderVersion(1);
111 }
112 else {
113 tofClus.SetDecoderVersion(2);
114 }
115
116 tofClus.Digits2RecPoints(rawReader, clustersTree);
117 }
118 else {
119 static AliTOFClusterFinder tofClus(fTOFcalib);
120
121 // decoder version option
122 if (optionString.Contains("DecoderV0")) {
123 tofClus.SetDecoderVersion(0);
124 }
125 else if (optionString.Contains("DecoderV1")) {
126 tofClus.SetDecoderVersion(1);
127 }
128 else {
129 tofClus.SetDecoderVersion(2);
130 }
131
132 tofClus.Digits2RecPoints(rawReader, clustersTree);
133 }
134
135}
136
137//_____________________________________________________________________________
138void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
139 TTree *clustersTree) const
140{
141 //
142 // reconstruct clusters from digits
143 //
144
145 AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree"));
146
147 TString optionString = GetOption();
148 // use V1 cluster finder if selected
149 if (optionString.Contains("ClusterizerV1")) {
150 static AliTOFClusterFinderV1 tofClus(fTOFcalib);
151
152 // decoder version option
153 if (optionString.Contains("DecoderV0")) {
154 tofClus.SetDecoderVersion(0);
155 }
156 else if (optionString.Contains("DecoderV1")) {
157 tofClus.SetDecoderVersion(1);
158 }
159 else {
160 tofClus.SetDecoderVersion(2);
161 }
162
163 tofClus.Digits2RecPoints(digitsTree, clustersTree);
164 }
165 else {
166 static AliTOFClusterFinder tofClus(fTOFcalib);
167
168 // decoder version option
169 if (optionString.Contains("DecoderV0")) {
170 tofClus.SetDecoderVersion(0);
171 }
172 else if (optionString.Contains("DecoderV1")) {
173 tofClus.SetDecoderVersion(1);
174 }
175 else {
176 tofClus.SetDecoderVersion(2);
177 }
178
179 tofClus.Digits2RecPoints(digitsTree, clustersTree);
180 }
181
182}
183//_____________________________________________________________________________
184 void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
185{
186// reconstruct clusters from digits
187
188 AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree"));
189
190 TString optionString = GetOption();
191 // use V1 cluster finder if selected
192 if (optionString.Contains("ClusterizerV1")) {
193 static AliTOFClusterFinderV1 tofClus(fTOFcalib);
194
195 // decoder version option
196 if (optionString.Contains("DecoderV0")) {
197 tofClus.SetDecoderVersion(0);
198 }
199 else if (optionString.Contains("DecoderV1")) {
200 tofClus.SetDecoderVersion(1);
201 }
202 else {
203 tofClus.SetDecoderVersion(2);
204 }
205
206 tofClus.Raw2Digits(reader, digitsTree);
207 }
208 else {
209 static AliTOFClusterFinder tofClus(fTOFcalib);
210
211 // decoder version option
212 if (optionString.Contains("DecoderV0")) {
213 tofClus.SetDecoderVersion(0);
214 }
215 else if (optionString.Contains("DecoderV1")) {
216 tofClus.SetDecoderVersion(1);
217 }
218 else {
219 tofClus.SetDecoderVersion(2);
220 }
221
222 tofClus.Raw2Digits(reader, digitsTree);
223 }
224
225}
226
227//_____________________________________________________________________________
228AliTracker* AliTOFReconstructor::CreateTracker() const
229{
230
231 //
232 // create a TOF tracker using
233 // TOF Reco Param collected by STEER
234 //
235
236 TString selectedTracker = GetOption();
237
238 AliTracker *tracker;
239 // use MI tracker if selected
240 if (selectedTracker.Contains("TrackerMI")) {
241 tracker = new AliTOFtrackerMI();
242 }
243 // use V1 tracker if selected
244 else if (selectedTracker.Contains("TrackerV1")) {
245 tracker = new AliTOFtrackerV1();
246 }
247 else {
248 tracker = new AliTOFtracker();
249 }
250 return tracker;
251
252}
253
254//_____________________________________________________________________________
255void AliTOFReconstructor::FillEventTimeWithTOF(AliESDEvent *event, AliESDpid *esdPID)
256{
257 //
258 // Fill AliESDEvent::fTOFHeader variable
259 // It contains the event_time estiamted by the TOF combinatorial algorithm
260 //
261
262 if (!GetRecoParam()) AliFatal("cannot get TOF RECO params");
263
264 Float_t tofResolution = GetRecoParam()->GetTimeResolution();// TOF time resolution in ps
265 AliTOFT0maker *tofT0maker = new AliTOFT0maker(esdPID);
266 tofT0maker->SetTimeResolution(tofResolution);
267 tofT0maker->ComputeT0TOF(event);
268 tofT0maker->WriteInESD(event);
269 tofT0maker->~AliTOFT0maker();
270 delete tofT0maker;
271
272 esdPID->SetTOFResponse(event,(AliESDpid::EStartTimeType_t)GetRecoParam()->GetStartTimeType());
273
274}
275
276//_____________________________________________________________________________
277void
278AliTOFReconstructor::FillESD(TTree *, TTree *, AliESDEvent * /*esdEvent*/) const
279{
280 //
281 // correct Texp
282 //
283 //
284
285 // fTOFcalib->CalibrateTExp(esdEvent);
286}