1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // class for TOF reconstruction //
22 ///////////////////////////////////////////////////////////////////////////////
25 #include "TObjArray.h"
29 #include "AliESDEvent.h"
30 #include "AliESDpid.h"
31 #include "AliRawReader.h"
32 #include "AliTOFHeader.h"
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"
45 ClassImp(AliTOFReconstructor)
47 //____________________________________________________________________
48 AliTOFReconstructor::AliTOFReconstructor()
57 //Retrieving the TOF calibration info
58 fTOFcalib = new AliTOFcalib();
62 fTOFcalib->CreateCalObjects();
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);}
67 if(!fTOFcalib->ReadParOfflineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
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);}
78 //_____________________________________________________________________________
79 AliTOFReconstructor::~AliTOFReconstructor()
91 //_____________________________________________________________________________
92 void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
93 TTree *clustersTree) const
96 // reconstruct clusters from Raw Data
99 TString optionString = GetOption();
101 // use V1 cluster finder if selected
102 if (optionString.Contains("ClusterizerV1")) {
103 static AliTOFClusterFinderV1 tofClus(fTOFcalib);
105 // decoder version option
106 if (optionString.Contains("DecoderV0")) {
107 tofClus.SetDecoderVersion(0);
109 else if (optionString.Contains("DecoderV1")) {
110 tofClus.SetDecoderVersion(1);
113 tofClus.SetDecoderVersion(2);
116 tofClus.Digits2RecPoints(rawReader, clustersTree);
119 static AliTOFClusterFinder tofClus(fTOFcalib);
121 // decoder version option
122 if (optionString.Contains("DecoderV0")) {
123 tofClus.SetDecoderVersion(0);
125 else if (optionString.Contains("DecoderV1")) {
126 tofClus.SetDecoderVersion(1);
129 tofClus.SetDecoderVersion(2);
132 tofClus.Digits2RecPoints(rawReader, clustersTree);
137 //_____________________________________________________________________________
138 void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
139 TTree *clustersTree) const
142 // reconstruct clusters from digits
145 AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree"));
147 TString optionString = GetOption();
148 // use V1 cluster finder if selected
149 if (optionString.Contains("ClusterizerV1")) {
150 static AliTOFClusterFinderV1 tofClus(fTOFcalib);
152 // decoder version option
153 if (optionString.Contains("DecoderV0")) {
154 tofClus.SetDecoderVersion(0);
156 else if (optionString.Contains("DecoderV1")) {
157 tofClus.SetDecoderVersion(1);
160 tofClus.SetDecoderVersion(2);
163 tofClus.Digits2RecPoints(digitsTree, clustersTree);
166 static AliTOFClusterFinder tofClus(fTOFcalib);
168 // decoder version option
169 if (optionString.Contains("DecoderV0")) {
170 tofClus.SetDecoderVersion(0);
172 else if (optionString.Contains("DecoderV1")) {
173 tofClus.SetDecoderVersion(1);
176 tofClus.SetDecoderVersion(2);
179 tofClus.Digits2RecPoints(digitsTree, clustersTree);
183 //_____________________________________________________________________________
184 void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
186 // reconstruct clusters from digits
188 AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree"));
190 TString optionString = GetOption();
191 // use V1 cluster finder if selected
192 if (optionString.Contains("ClusterizerV1")) {
193 static AliTOFClusterFinderV1 tofClus(fTOFcalib);
195 // decoder version option
196 if (optionString.Contains("DecoderV0")) {
197 tofClus.SetDecoderVersion(0);
199 else if (optionString.Contains("DecoderV1")) {
200 tofClus.SetDecoderVersion(1);
203 tofClus.SetDecoderVersion(2);
206 tofClus.Raw2Digits(reader, digitsTree);
209 static AliTOFClusterFinder tofClus(fTOFcalib);
211 // decoder version option
212 if (optionString.Contains("DecoderV0")) {
213 tofClus.SetDecoderVersion(0);
215 else if (optionString.Contains("DecoderV1")) {
216 tofClus.SetDecoderVersion(1);
219 tofClus.SetDecoderVersion(2);
222 tofClus.Raw2Digits(reader, digitsTree);
227 //_____________________________________________________________________________
228 AliTracker* AliTOFReconstructor::CreateTracker() const
232 // create a TOF tracker using
233 // TOF Reco Param collected by STEER
236 TString selectedTracker = GetOption();
239 // use MI tracker if selected
240 if (selectedTracker.Contains("TrackerMI")) {
241 tracker = new AliTOFtrackerMI();
243 // use V1 tracker if selected
244 else if (selectedTracker.Contains("TrackerV1")) {
245 tracker = new AliTOFtrackerV1();
248 tracker = new AliTOFtracker();
254 //_____________________________________________________________________________
255 void AliTOFReconstructor::FillEventTimeWithTOF(AliESDEvent *event, AliESDpid *esdPID)
258 // Fill AliESDEvent::fTOFHeader variable
259 // It contains the event_time estiamted by the TOF combinatorial algorithm
262 if (!GetRecoParam()) AliFatal("cannot get TOF RECO params");
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();
272 esdPID->SetTOFResponse(event,(AliESDpid::EStartTimeType_t)GetRecoParam()->GetStartTimeType());
276 //_____________________________________________________________________________
278 AliTOFReconstructor::FillESD(TTree *, TTree *, AliESDEvent * /*esdEvent*/) const
285 // fTOFcalib->CalibrateTExp(esdEvent);