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