]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFReconstructor.cxx
New TOF online calibration object classes implemented, both for channel
[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 "TFile.h"
26 #include "TObjArray.h"
27 #include "TString.h"
28
29 #include "AliLog.h"
30 #include "AliRawReader.h"
31
32 #include "AliTOFClusterFinder.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 //class TFile;
41 //class TDirectory;
42
43 class AliESDEvent;
44
45 //extern TDirectory *gDirectory;
46 //extern TFile *gFile;
47
48 ClassImp(AliTOFReconstructor)
49
50  //____________________________________________________________________
51 AliTOFReconstructor::AliTOFReconstructor() 
52   : AliReconstructor(),
53     fTOFcalib(0)
54 {
55 //
56 // ctor
57 //
58   
59   //Retrieving the TOF calibration info  
60   fTOFcalib    = new AliTOFcalib();
61   fTOFcalib->CreateCalArrays();
62
63   if(!fTOFcalib->ReadParOnlineDelayFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
64   if(!fTOFcalib->ReadParOnlineStatusFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
65
66   if(!fTOFcalib->ReadParOfflineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
67 }
68
69 //------------------------------------------------------------------------
70 AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
71   : AliReconstructor(),
72     fTOFcalib(0)
73 {
74 //
75 // copy ctor
76 //
77   this->fTOFcalib=source.fTOFcalib;
78 }
79
80 //------------------------------------------------------------------------
81 AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &source)
82 {
83 //
84 // assignment op.
85 //
86   this->fTOFcalib=source.fTOFcalib;
87   return *this;
88 }
89 //_____________________________________________________________________________
90 AliTOFReconstructor::~AliTOFReconstructor() 
91 {
92 //
93 // dtor
94 //
95   delete fTOFcalib;
96 }
97
98 //_____________________________________________________________________________
99 void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
100                                       TTree *clustersTree) const
101 {
102 // reconstruct clusters from Raw Data
103
104   static AliTOFClusterFinder tofClus(fTOFcalib);
105   tofClus.Digits2RecPoints(rawReader, clustersTree);
106
107 }
108
109 //_____________________________________________________________________________
110 void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
111                                       TTree *clustersTree) const
112 {
113 // reconstruct clusters from Raw Data
114
115   AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree")); 
116   static AliTOFClusterFinder tofClus(fTOFcalib);
117   tofClus.Digits2RecPoints(digitsTree, clustersTree);
118
119 }
120 //_____________________________________________________________________________
121   void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
122 {
123 // reconstruct clusters from digits
124
125   AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree")); 
126   AliTOFClusterFinder tofClus(fTOFcalib);
127   tofClus.Raw2Digits(reader, digitsTree);
128
129 }
130
131 //_____________________________________________________________________________
132 AliTracker* AliTOFReconstructor::CreateTracker() const
133 {
134 // create a TOF tracker
135
136   TString selectedTracker = GetOption();
137   // use MI tracker if selected
138   if (selectedTracker.Contains("MI")) return new AliTOFtrackerMI();
139   if (selectedTracker.Contains("V1")) return new AliTOFtrackerV1();
140   return new AliTOFtracker();
141 }
142