]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFReconstructor.cxx
23bd66c5f542f51e4f7c0b5a3fc10b69b936a8f2
[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->CreateCalObjects();
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
61   if(!fTOFcalib->ReadParOfflineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
62
63
64   if(!fTOFcalib->ReadDeltaBCOffsetFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
65   if(!fTOFcalib->ReadCTPLatencyFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
66   if(!fTOFcalib->ReadT0FillFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
67 }
68
69 //_____________________________________________________________________________
70 AliTOFReconstructor::~AliTOFReconstructor() 
71 {
72 //
73 // dtor
74 //
75   delete fTOFcalib;
76 }
77
78 //_____________________________________________________________________________
79 void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
80                                       TTree *clustersTree) const
81 {
82   //
83   // reconstruct clusters from Raw Data
84   //
85
86   TString optionString = GetOption();
87   // use V1 cluster finder if selected
88   if (optionString.Contains("ClusterizerV1")) {
89     static AliTOFClusterFinderV1 tofClus(fTOFcalib);
90
91     // decoder version option
92     if (optionString.Contains("DecoderV0"))
93       tofClus.SetDecoderVersion(0);
94     else
95       tofClus.SetDecoderVersion(1);
96     
97     tofClus.Digits2RecPoints(rawReader, clustersTree);
98   }
99   else {
100     static AliTOFClusterFinder tofClus(fTOFcalib);
101     
102     // decoder version option
103     if (optionString.Contains("DecoderV0"))
104       tofClus.SetDecoderVersion(0);
105     else
106       tofClus.SetDecoderVersion(1);
107
108     tofClus.Digits2RecPoints(rawReader, clustersTree);
109   }
110
111 }
112
113 //_____________________________________________________________________________
114 void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
115                                       TTree *clustersTree) const
116 {
117   //
118   // reconstruct clusters from digits
119   //
120
121   AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree")); 
122
123   TString optionString = GetOption();
124   // use V1 cluster finder if selected
125   if (optionString.Contains("ClusterizerV1")) {
126     static AliTOFClusterFinderV1 tofClus(fTOFcalib);
127
128     // decoder version option
129     if (optionString.Contains("DecoderV0"))
130       tofClus.SetDecoderVersion(0);
131     else
132       tofClus.SetDecoderVersion(1);
133     
134     tofClus.Digits2RecPoints(digitsTree, clustersTree);
135   }
136   else {
137     static AliTOFClusterFinder tofClus(fTOFcalib);
138
139     // decoder version option
140     if (optionString.Contains("DecoderV0"))
141       tofClus.SetDecoderVersion(0);
142     else
143       tofClus.SetDecoderVersion(1);
144     
145     tofClus.Digits2RecPoints(digitsTree, clustersTree);
146   }
147
148 }
149 //_____________________________________________________________________________
150   void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
151 {
152 // reconstruct clusters from digits
153
154   AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree")); 
155
156   TString optionString = GetOption();
157   // use V1 cluster finder if selected
158   if (optionString.Contains("ClusterizerV1")) {
159     static AliTOFClusterFinderV1 tofClus(fTOFcalib);
160
161     // decoder version option
162     if (optionString.Contains("DecoderV0"))
163       tofClus.SetDecoderVersion(0);
164     else
165       tofClus.SetDecoderVersion(1);
166     
167     tofClus.Raw2Digits(reader, digitsTree);
168   }
169   else {
170     static AliTOFClusterFinder tofClus(fTOFcalib);
171
172     // decoder version option
173     if (optionString.Contains("DecoderV0"))
174       tofClus.SetDecoderVersion(0);
175     else
176       tofClus.SetDecoderVersion(1);
177     
178     tofClus.Raw2Digits(reader, digitsTree);
179   }
180
181 }
182
183 //_____________________________________________________________________________
184 AliTracker* AliTOFReconstructor::CreateTracker() const
185 {
186
187   // 
188   // create a TOF tracker using 
189   // TOF Reco Param collected by STEER
190   //
191
192   TString selectedTracker = GetOption();
193  
194   AliTracker *tracker;
195   // use MI tracker if selected
196   if (selectedTracker.Contains("TrackerMI")) {
197     tracker = new AliTOFtrackerMI();
198   }
199   // use V1 tracker if selected
200   else if (selectedTracker.Contains("TrackerV1")) {
201     tracker =  new AliTOFtrackerV1();
202   }
203   else {
204     tracker = new AliTOFtracker();
205   }
206   return tracker;
207
208 }