1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // class for TOF reconstruction //
22 ///////////////////////////////////////////////////////////////////////////////
27 #include "AliRawReader.h"
28 #include "AliRunLoader.h"
30 #include "AliTOFClusterFinder.h"
31 #include "AliTOFGeometry.h"
32 #include "AliTOFGeometryV5.h"
33 #include "AliTOFcalib.h"
34 #include "AliTOFtrackerMI.h"
35 #include "AliTOFtracker.h"
36 #include "AliTOFReconstructor.h"
42 extern TDirectory *gDirectory;
45 ClassImp(AliTOFReconstructor)
47 //____________________________________________________________________
48 AliTOFReconstructor::AliTOFReconstructor()
56 //Retrieving the TOF calibration info
57 fTOFGeometry = new AliTOFGeometryV5();
58 fTOFcalib = new AliTOFcalib(fTOFGeometry);
59 if(!fTOFcalib->ReadParFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
62 //------------------------------------------------------------------------
63 AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
71 this->fTOFGeometry=source.fTOFGeometry;
72 this->fTOFcalib=source.fTOFcalib;
75 //------------------------------------------------------------------------
76 AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &source)
81 this->fTOFGeometry=source.fTOFGeometry;
82 this->fTOFcalib=source.fTOFcalib;
85 //_____________________________________________________________________________
86 AliTOFReconstructor::~AliTOFReconstructor()
95 //_____________________________________________________________________________
96 void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader) const
98 // reconstruct clusters from digits
100 AliTOFClusterFinder tofClus(runLoader, fTOFcalib);
102 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
104 AliDebug(2,Form("Local Event loop mode: Creating Recpoints from Digits, Event n. %i",iEvent));
105 tofClus.Digits2RecPoints(iEvent);
111 //_____________________________________________________________________________
112 void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader,
113 AliRawReader *rawReader) const
115 // reconstruct clusters from Raw Data
117 AliTOFClusterFinder tofClus(runLoader, fTOFcalib);
118 tofClus.LoadClusters();
120 while (rawReader->NextEvent()) {
121 AliDebug(2,Form("Local Event loop mode: Creating Recpoints from Raw data, Event n. %i",iEvent));
122 tofClus.Digits2RecPoints(iEvent,rawReader);
125 tofClus.UnLoadClusters();
129 //_____________________________________________________________________________
130 void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
131 TTree *clustersTree) const
133 // reconstruct clusters from Raw Data
135 AliTOFClusterFinder tofClus(fTOFcalib);
136 tofClus.Digits2RecPoints(rawReader, clustersTree);
140 //_____________________________________________________________________________
141 void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
142 TTree *clustersTree) const
144 // reconstruct clusters from Raw Data
146 AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree"));
147 AliTOFClusterFinder tofClus(fTOFcalib);
148 tofClus.Digits2RecPoints(digitsTree, clustersTree);
151 //_____________________________________________________________________________
152 void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
154 // reconstruct clusters from digits
156 AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree"));
157 AliTOFClusterFinder tofClus(fTOFcalib);
158 tofClus.Raw2Digits(reader, digitsTree);
162 //_____________________________________________________________________________
163 AliTracker* AliTOFReconstructor::CreateTracker(AliRunLoader* /*runLoader*/) const
165 // create a TOF tracker
167 TString selectedTracker = GetOption();
168 // use MI tracker if selected
169 if (selectedTracker.Contains("MI")) return new AliTOFtrackerMI();
170 return new AliTOFtracker();
173 //_____________________________________________________________________________
174 void AliTOFReconstructor::FillESD(AliRunLoader* /*runLoader*/,
175 AliESD* /*esd*/) const
177 // nothing to be done
181 //_____________________________________________________________________________
182 AliTOFGeometry* AliTOFReconstructor::GetTOFGeometry(AliRunLoader* runLoader) const
184 // get the TOF parameters
186 AliTOFGeometry *tofGeom;
188 runLoader->CdGAFile();
189 TDirectory *savedir=gDirectory;
190 TFile *in=(TFile*)gFile;
192 AliWarning("Geometry file is not open default TOF geometry will be used");
193 tofGeom = new AliTOFGeometryV5();
197 tofGeom = (AliTOFGeometry*) in->Get("TOFgeometry");
203 AliError("no TOF geometry available");