Fixes in order to write correct raw-data on big-endian platforms (Marco)
[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 void 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 // ------------------------------------------------------------------------ //
106
107 //void AliPMDReconstructor::FillESD(AliRunLoader* runLoader,AliESD* esd) const
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 // ------------------------------------------------------------------------ //
123 void AliPMDReconstructor::FillESD(AliRawReader* /*rawReader*/,
124                                   TTree* clustersTree, AliESD* esd) const
125 {
126   AliPMDtracker pmdtracker;
127   pmdtracker.LoadClusters(clustersTree);
128   pmdtracker.Clusters2Tracks(esd);
129 }
130 // ------------------------------------------------------------------------ //
131 void AliPMDReconstructor::FillESD(TTree * /*digitsTree*/,
132                                   TTree* clustersTree, AliESD* esd) const
133 {
134   AliPMDtracker pmdtracker;
135   pmdtracker.LoadClusters(clustersTree);
136   pmdtracker.Clusters2Tracks(esd);
137 }
138
139