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