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