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