Default calibration (A.Colla)
[u/mrichter/AliRoot.git] / PMD / AliPMDReconstructor.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 ///////////////////////////////////////////////////////////////////////////////
17 //                                                                           //
18 // class for PMD reconstruction                                              //
19 //                                                                           //
20 ///////////////////////////////////////////////////////////////////////////////
21
22 #include "Riostream.h"
23 #include "AliPMDReconstructor.h"
24 #include "AliRunLoader.h"
25 #include "AliRun.h"
26 #include "AliPMDClusterFinder.h"
27 #include "AliPMDtracker.h"
28 #include "AliRawReader.h"
29 #include "AliESDPmdTrack.h"
30 #include "AliESD.h"
31 #include "AliLog.h"
32
33 ClassImp(AliPMDReconstructor)
34
35 //_____________________________________________________________________________
36 void AliPMDReconstructor::Init(AliRunLoader* runLoader) 
37 {
38   // Initialize the reconstructor 
39   AliDebug(1, Form("Init called with runloader 0x%x", runLoader));
40   if (!runLoader)
41     { 
42       AliWarning("Init : No run loader");
43       return;
44     }
45 }
46     
47 //_____________________________________________________________________________
48 void AliPMDReconstructor::Reconstruct(AliRunLoader* runLoader) const
49 {
50 // reconstruct clusters from digits file
51
52   AliPMDClusterFinder *pmdClus = new AliPMDClusterFinder(runLoader);
53   pmdClus->Load();
54   for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
55     {
56       pmdClus->Digits2RecPoints(iEvent);
57     }
58   pmdClus->UnLoad();
59   delete pmdClus;
60
61 }
62 // ------------------------------------------------------------------------ //
63
64 void AliPMDReconstructor::Reconstruct(AliRunLoader* runLoader,
65                                       AliRawReader *rawReader) const
66 {
67 // reconstruct clusters from Raw Data
68
69   AliPMDClusterFinder pmdClus(runLoader);
70   pmdClus.LoadClusters();
71
72   Int_t iEvent = 0;
73   while (rawReader->NextEvent()) {
74     pmdClus.Digits2RecPoints(iEvent,rawReader);
75     iEvent++;
76   }
77   pmdClus.UnLoadClusters();
78   
79 }
80
81
82 // ------------------------------------------------------------------------ //
83
84 void AliPMDReconstructor::Reconstruct(AliRawReader *rawReader,
85                                       TTree *clustersTree) const
86 {
87 // reconstruct clusters from Raw Data
88
89   AliPMDClusterFinder pmdClus;
90   pmdClus.Digits2RecPoints(rawReader, clustersTree);
91
92 }
93
94 // ------------------------------------------------------------------------ //
95
96 //void AliPMDReconstructor::FillESD(AliRunLoader* runLoader,AliESD* esd) const
97 //{
98 //  AliLoader* loader = runLoader->GetLoader("PMDLoader");
99 //  if (!loader) {
100 //    AliError("PMD loader not found");
101 //    return;
102 //  }
103 //  loader->LoadRecPoints("READ");
104 //  TTree *treeR = loader->TreeR();
105 //  AliPMDtracker pmdtracker;
106 //  pmdtracker.LoadClusters(treeR);
107 //  pmdtracker.Clusters2Tracks(esd);
108 //  loader->UnloadRecPoints();
109 //}
110
111 // ------------------------------------------------------------------------ //
112 void AliPMDReconstructor::FillESD(AliRawReader* /*rawReader*/,
113                                   TTree* clustersTree, AliESD* esd) const
114 {
115   AliPMDtracker pmdtracker;
116   pmdtracker.LoadClusters(clustersTree);
117   pmdtracker.Clusters2Tracks(esd);
118 }
119
120