New version of TOF tracker which uses TOF clusters as an input (A. De Caro)
[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
25 #include <TFile.h>
26
27 #include "AliLog.h"
28 #include "AliRun.h"
29 #include "AliRunLoader.h"
30
31 #include "AliTOFtracker.h"
32 #include "AliTOFClusterFinder.h"
33 #include "AliTOFReconstructor.h"
34
35
36 ClassImp(AliTOFReconstructor)
37
38
39 //_____________________________________________________________________________
40   void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader) const
41 {
42 // reconstruct clusters from digits
43
44   AliTOFClusterFinder *tofClus = new AliTOFClusterFinder(runLoader);
45   tofClus->Load();
46   for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
47     {
48       tofClus->Digits2RecPoints(iEvent);
49     }
50   tofClus->UnLoad();
51
52 }
53
54 //_____________________________________________________________________________
55 void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader,
56                                       AliRawReader *rawReader) const
57 {
58 // reconstruct clusters from Raw Data
59
60   AliTOFClusterFinder tofClus(runLoader);
61   tofClus.LoadClusters();
62   Int_t iEvent = 0;
63   while (rawReader->NextEvent()) {
64     tofClus.Digits2RecPoints(iEvent,rawReader);
65     //tofClus.Raw2Digits(iEvent,rawReader); // temporary solution
66     iEvent++;
67   }
68   tofClus.UnLoadClusters();
69
70 }
71
72 //_____________________________________________________________________________
73 void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
74                                       TTree *clustersTree) const
75 {
76 // reconstruct clusters from Raw Data
77
78   AliTOFClusterFinder tofClus;
79   tofClus.Digits2RecPoints(rawReader, clustersTree);
80
81 }
82
83 //_____________________________________________________________________________
84 AliTracker* AliTOFReconstructor::CreateTracker(AliRunLoader* runLoader) const
85 {
86 // create a TOF tracker
87
88   AliTOFGeometry* geom = GetTOFGeometry(runLoader);
89   if (!geom) return NULL;
90   Double_t parPID[] = {130., 5.};
91   return new AliTOFtracker(geom, parPID);
92 }
93
94 //_____________________________________________________________________________
95 void AliTOFReconstructor::FillESD(AliRunLoader* /*runLoader*/, 
96                                   AliESD* /*esd*/) const
97 {
98 // nothing to be done
99
100 }
101
102 //_____________________________________________________________________________
103 AliTOFGeometry* AliTOFReconstructor::GetTOFGeometry(AliRunLoader* runLoader) const
104 {
105 // get the TOF parameters
106
107   runLoader->CdGAFile();
108   AliTOFGeometry* tofGeom = (AliTOFGeometry*) gFile->Get("TOFGeometry"); 
109   if (!tofGeom) {
110     AliError("no TOF geometry available");
111     return NULL;
112   }
113   return tofGeom;
114 }