Reducing the memory size needed for raw data reconstruction
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructor.cxx
CommitLineData
121a60bd 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
0e46b9ae 24#include "TFile.h"
d08a92dd 25
26#include "AliLog.h"
0e46b9ae 27#include "AliRawReader.h"
d08a92dd 28#include "AliRunLoader.h"
29
0e46b9ae 30#include "AliTOFClusterFinder.h"
d3c7bfac 31#include "AliTOFGeometry.h"
d88fbf15 32#include "AliTOFtrackerMI.h"
0e46b9ae 33#include "AliTOFtracker.h"
d08a92dd 34#include "AliTOFReconstructor.h"
121a60bd 35
0e46b9ae 36class TTree;
37
38class AliESD;
39
40extern TDirectory *gDirectory;
41extern TFile *gFile;
42
121a60bd 43ClassImp(AliTOFReconstructor)
44
121a60bd 45//_____________________________________________________________________________
7b61cd9c 46 void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader) const
121a60bd 47{
d08a92dd 48// reconstruct clusters from digits
7b61cd9c 49
4ab68796 50 AliTOFClusterFinder tofClus(runLoader);
51 tofClus.Load();
d08a92dd 52 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
53 {
4ab68796 54 tofClus.Digits2RecPoints(iEvent);
d08a92dd 55 }
4ab68796 56 tofClus.UnLoad();
7b61cd9c 57
d08a92dd 58}
59
60//_____________________________________________________________________________
61void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader,
62 AliRawReader *rawReader) const
63{
64// reconstruct clusters from Raw Data
65
66 AliTOFClusterFinder tofClus(runLoader);
67 tofClus.LoadClusters();
68 Int_t iEvent = 0;
69 while (rawReader->NextEvent()) {
7b61cd9c 70 tofClus.Digits2RecPoints(iEvent,rawReader);
71 //tofClus.Raw2Digits(iEvent,rawReader); // temporary solution
d08a92dd 72 iEvent++;
73 }
74 tofClus.UnLoadClusters();
75
76}
77
78//_____________________________________________________________________________
79void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
80 TTree *clustersTree) const
81{
82// reconstruct clusters from Raw Data
83
84 AliTOFClusterFinder tofClus;
85 tofClus.Digits2RecPoints(rawReader, clustersTree);
121a60bd 86
87}
88
89//_____________________________________________________________________________
90AliTracker* AliTOFReconstructor::CreateTracker(AliRunLoader* runLoader) const
91{
92// create a TOF tracker
93
94 AliTOFGeometry* geom = GetTOFGeometry(runLoader);
95 if (!geom) return NULL;
37ecb35e 96 // Double_t parPID[] = {130., 5.};
97 Double_t parPID[] = {80., 5.};
d88fbf15 98 TString selectedTracker = GetOption();
99 // use MI tracker if selected
100 if (selectedTracker.Contains("MI")) return new AliTOFtrackerMI(geom,parPID);
101
121a60bd 102 return new AliTOFtracker(geom, parPID);
103}
104
105//_____________________________________________________________________________
106void AliTOFReconstructor::FillESD(AliRunLoader* /*runLoader*/,
107 AliESD* /*esd*/) const
108{
109// nothing to be done
110
111}
112
121a60bd 113//_____________________________________________________________________________
114AliTOFGeometry* AliTOFReconstructor::GetTOFGeometry(AliRunLoader* runLoader) const
115{
116// get the TOF parameters
117
d3c7bfac 118 AliTOFGeometry *tofGeom;
119
d076c8d5 120 runLoader->CdGAFile();
d3c7bfac 121 TDirectory *savedir=gDirectory;
122 TFile *in=(TFile*)gFile;
123 if (!in->IsOpen()) {
124 AliWarning("Geometry file is not open default TOF geometry will be used");
125 tofGeom = new AliTOFGeometry();
126 }
127 else {
128 in->cd();
129 tofGeom = (AliTOFGeometry*) in->Get("TOFgeometry");
130 }
131
132 savedir->cd();
133
d076c8d5 134 if (!tofGeom) {
135 AliError("no TOF geometry available");
121a60bd 136 return NULL;
137 }
d076c8d5 138 return tofGeom;
121a60bd 139}