]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFReconstructor.cxx
Improvements in memory handling.
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructor.cxx
CommitLineData
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"
0e46b9ae 29#include "AliRawReader.h"
d08a92dd 30
0e46b9ae 31#include "AliTOFClusterFinder.h"
e3bd5504 32#include "AliTOFClusterFinderV1.h"
a98acac1 33#include "AliTOFcalib.h"
d88fbf15 34#include "AliTOFtrackerMI.h"
0e46b9ae 35#include "AliTOFtracker.h"
eeef0c5d 36#include "AliTOFtrackerV1.h"
d08a92dd 37#include "AliTOFReconstructor.h"
121a60bd 38
0e46b9ae 39class TTree;
40
af885e0f 41class AliESDEvent;
0e46b9ae 42
121a60bd 43ClassImp(AliTOFReconstructor)
44
a98acac1 45 //____________________________________________________________________
46AliTOFReconstructor::AliTOFReconstructor()
47 : AliReconstructor(),
a98acac1 48 fTOFcalib(0)
49{
50//
51// ctor
52//
6b025efd 53
a98acac1 54 //Retrieving the TOF calibration info
ba66add8 55 fTOFcalib = new AliTOFcalib();
24d1e16e 56 fTOFcalib->CreateCalObjects();
17149e6b 57
58 if(!fTOFcalib->ReadParOnlineDelayFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
59 if(!fTOFcalib->ReadParOnlineStatusFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
60
ba66add8 61 if(!fTOFcalib->ReadParOfflineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
a98acac1 62}
63
64//------------------------------------------------------------------------
65AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
8a190ba2 66 : AliReconstructor(source),
67 fTOFcalib(source.fTOFcalib)
a98acac1 68{
69//
70// copy ctor
71//
a98acac1 72}
73
74//------------------------------------------------------------------------
75AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &source)
76{
77//
78// assignment op.
79//
8a190ba2 80 if (this == &source)
81 return *this;
82
83 fTOFcalib=source.fTOFcalib;
a98acac1 84 return *this;
85}
86//_____________________________________________________________________________
87AliTOFReconstructor::~AliTOFReconstructor()
88{
89//
90// dtor
91//
a98acac1 92 delete fTOFcalib;
93}
94
d08a92dd 95//_____________________________________________________________________________
96void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
97 TTree *clustersTree) const
98{
e3bd5504 99 //
100 // reconstruct clusters from Raw Data
101 //
102
17bb1d52 103 TString optionString = GetOption();
e3bd5504 104 // use V1 cluster finder if selected
17bb1d52 105 if (optionString.Contains("ClusterizerV1")) {
e3bd5504 106 static AliTOFClusterFinderV1 tofClus(fTOFcalib);
17bb1d52 107
108 // decoder version option
109 if (optionString.Contains("DecoderV1"))
110 tofClus.SetDecoderVersion(1);
111 else
112 tofClus.SetDecoderVersion(0);
113
e3bd5504 114 tofClus.Digits2RecPoints(rawReader, clustersTree);
115 }
116 else {
117 static AliTOFClusterFinder tofClus(fTOFcalib);
17bb1d52 118
119 // decoder version option
120 if (optionString.Contains("DecoderV1"))
121 tofClus.SetDecoderVersion(1);
122 else
123 tofClus.SetDecoderVersion(0);
124
e3bd5504 125 tofClus.Digits2RecPoints(rawReader, clustersTree);
126 }
121a60bd 127
128}
129
a98acac1 130//_____________________________________________________________________________
131void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
132 TTree *clustersTree) const
133{
e3bd5504 134 //
135 // reconstruct clusters from digits
136 //
a98acac1 137
138 AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree"));
e3bd5504 139
17bb1d52 140 TString optionString = GetOption();
e3bd5504 141 // use V1 cluster finder if selected
17bb1d52 142 if (optionString.Contains("ClusterizerV1")) {
e3bd5504 143 static AliTOFClusterFinderV1 tofClus(fTOFcalib);
17bb1d52 144
145 // decoder version option
146 if (optionString.Contains("DecoderV1"))
147 tofClus.SetDecoderVersion(1);
148 else
149 tofClus.SetDecoderVersion(0);
150
e3bd5504 151 tofClus.Digits2RecPoints(digitsTree, clustersTree);
152 }
153 else {
154 static AliTOFClusterFinder tofClus(fTOFcalib);
17bb1d52 155
156 // decoder version option
157 if (optionString.Contains("DecoderV1"))
158 tofClus.SetDecoderVersion(1);
159 else
160 tofClus.SetDecoderVersion(0);
161
e3bd5504 162 tofClus.Digits2RecPoints(digitsTree, clustersTree);
163 }
a98acac1 164
165}
166//_____________________________________________________________________________
167 void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
168{
169// reconstruct clusters from digits
170
171 AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree"));
e3bd5504 172
17bb1d52 173 TString optionString = GetOption();
e3bd5504 174 // use V1 cluster finder if selected
17bb1d52 175 if (optionString.Contains("ClusterizerV1")) {
e3bd5504 176 static AliTOFClusterFinderV1 tofClus(fTOFcalib);
17bb1d52 177
178 // decoder version option
179 if (optionString.Contains("DecoderV1"))
180 tofClus.SetDecoderVersion(1);
181 else
182 tofClus.SetDecoderVersion(0);
183
e3bd5504 184 tofClus.Raw2Digits(reader, digitsTree);
185 }
186 else {
187 static AliTOFClusterFinder tofClus(fTOFcalib);
17bb1d52 188
189 // decoder version option
190 if (optionString.Contains("DecoderV1"))
191 tofClus.SetDecoderVersion(1);
192 else
193 tofClus.SetDecoderVersion(0);
194
e3bd5504 195 tofClus.Raw2Digits(reader, digitsTree);
196 }
a98acac1 197
198}
199
121a60bd 200//_____________________________________________________________________________
d76c31f4 201AliTracker* AliTOFReconstructor::CreateTracker() const
121a60bd 202{
3a646035 203
204 //
205 // create a TOF tracker using
206 // TOF Reco Param collected by STEER
207 //
121a60bd 208
d88fbf15 209 TString selectedTracker = GetOption();
3a646035 210
211 AliTracker *tracker;
d88fbf15 212 // use MI tracker if selected
17bb1d52 213 if (selectedTracker.Contains("TrackerMI")) {
3a646035 214 tracker = new AliTOFtrackerMI();
215 }
216 // use V1 tracker if selected
17bb1d52 217 if (selectedTracker.Contains("TrackerV1")) {
3a646035 218 tracker = new AliTOFtrackerV1();
219 }
220 else {
221 tracker = new AliTOFtracker();
222 }
223 return tracker;
121a60bd 224
e3bd5504 225}