New class AliESDEvent, backward compatibility with the old AliESD (Christian)
[u/mrichter/AliRoot.git] / PMD / AliPMDReconstructor.cxx
CommitLineData
05f4fa74 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"
01b56f5c 28#include "AliRawReader.h"
05f4fa74 29#include "AliESDPmdTrack.h"
af885e0f 30#include "AliESDEvent.h"
cb6ed79d 31#include "AliLog.h"
05f4fa74 32
05f4fa74 33ClassImp(AliPMDReconstructor)
34
cb6ed79d 35//_____________________________________________________________________________
36void 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
05f4fa74 47//_____________________________________________________________________________
48void AliPMDReconstructor::Reconstruct(AliRunLoader* runLoader) const
49{
01b56f5c 50// reconstruct clusters from digits file
05f4fa74 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}
cb6ed79d 62// ------------------------------------------------------------------------ //
63
01b56f5c 64void 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()) {
01b56f5c 74 pmdClus.Digits2RecPoints(iEvent,rawReader);
01b56f5c 75 iEvent++;
76 }
77 pmdClus.UnLoadClusters();
78
79}
05f4fa74 80
cb6ed79d 81
05f4fa74 82// ------------------------------------------------------------------------ //
83
cb6ed79d 84void AliPMDReconstructor::Reconstruct(AliRawReader *rawReader,
85 TTree *clustersTree) const
05f4fa74 86{
cb6ed79d 87// reconstruct clusters from Raw Data
88
89 AliPMDClusterFinder pmdClus;
90 pmdClus.Digits2RecPoints(rawReader, clustersTree);
91
92}
93
94// ------------------------------------------------------------------------ //
8fbad6d3 95void AliPMDReconstructor::Reconstruct(TTree *digitsTree,
96 TTree *clustersTree) const
97{
98// reconstruct clusters from Raw Data
99
100 AliPMDClusterFinder pmdClus;
101 pmdClus.Digits2RecPoints(digitsTree, clustersTree);
102
103}
104
105// ------------------------------------------------------------------------ //
05f4fa74 106
af885e0f 107//void AliPMDReconstructor::FillESD(AliRunLoader* runLoader,AliESDEvent* esd) const
cb6ed79d 108//{
109// AliLoader* loader = runLoader->GetLoader("PMDLoader");
110// if (!loader) {
111// AliError("PMD loader not found");
112// return;
113// }
114// loader->LoadRecPoints("READ");
115// TTree *treeR = loader->TreeR();
116// AliPMDtracker pmdtracker;
117// pmdtracker.LoadClusters(treeR);
118// pmdtracker.Clusters2Tracks(esd);
119// loader->UnloadRecPoints();
120//}
121
122// ------------------------------------------------------------------------ //
123void AliPMDReconstructor::FillESD(AliRawReader* /*rawReader*/,
af885e0f 124 TTree* clustersTree, AliESDEvent* esd) const
cb6ed79d 125{
05f4fa74 126 AliPMDtracker pmdtracker;
cb6ed79d 127 pmdtracker.LoadClusters(clustersTree);
05f4fa74 128 pmdtracker.Clusters2Tracks(esd);
05f4fa74 129}
8fbad6d3 130// ------------------------------------------------------------------------ //
131void AliPMDReconstructor::FillESD(TTree * /*digitsTree*/,
af885e0f 132 TTree* clustersTree, AliESDEvent* esd) const
8fbad6d3 133{
134 AliPMDtracker pmdtracker;
135 pmdtracker.LoadClusters(clustersTree);
136 pmdtracker.Clusters2Tracks(esd);
137}
cb6ed79d 138
139