Additional include is needed due to the recent changes in AliCluster and AliGeomManager
[u/mrichter/AliRoot.git] / TPC / AliTPCReconstructor.cxx
CommitLineData
59697224 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 TPC reconstruction //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24
25#include "AliTPCReconstructor.h"
26#include "AliRunLoader.h"
27#include "AliRun.h"
38e6e547 28#include "AliRawReader.h"
59697224 29#include "AliTPCclustererMI.h"
30#include "AliTPCtrackerMI.h"
31#include "AliTPCpidESD.h"
4fb6310b 32#include "AliTPCParam.h"
90c7886e 33#include "AliTPCParamSR.h"
3d37b790 34#include "AliTPCcalibDB.h"
59697224 35
36ClassImp(AliTPCReconstructor)
37
194b0609 38
39AliTPCRecoParam * AliTPCReconstructor::fgkRecoParam =0; // reconstruction parameters
40Int_t AliTPCReconstructor::fgStreamLevel = 0; // stream (debug) level
41
42
43AliTPCReconstructor::AliTPCReconstructor(): AliReconstructor() {
44 //
45 // default constructor
46 //
47 if (!fgkRecoParam) {
48 AliError("The Reconstruction parameters nonitialized - Used default one");
49 fgkRecoParam = AliTPCRecoParam::GetHighFluxParam();
50 }
51}
52
53
59697224 54//_____________________________________________________________________________
55void AliTPCReconstructor::Reconstruct(AliRunLoader* runLoader) const
56{
57// reconstruct clusters
58
59 AliLoader* loader = runLoader->GetLoader("TPCLoader");
60 if (!loader) {
61 Error("Reconstruct", "TPC loader not found");
62 return;
63 }
64 loader->LoadRecPoints("recreate");
65 loader->LoadDigits("read");
66
67 AliTPCParam* param = GetTPCParam(runLoader);
68 if (!param) return;
69 AliTPCclustererMI clusterer(param);
70 Int_t nEvents = runLoader->GetNumberOfEvents();
71
72 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
73 runLoader->GetEvent(iEvent);
74
75 TTree* treeClusters = loader->TreeR();
76 if (!treeClusters) {
77 loader->MakeTree("R");
78 treeClusters = loader->TreeR();
79 }
80 TTree* treeDigits = loader->TreeD();
81 if (!treeDigits) {
82 Error("Reconstruct", "Can't get digits tree !");
83 return;
84 }
85
86 clusterer.SetInput(treeDigits);
87 clusterer.SetOutput(treeClusters);
88 clusterer.Digits2Clusters();
89
90 loader->WriteRecPoints("OVERWRITE");
91 }
92
93 loader->UnloadRecPoints();
94 loader->UnloadDigits();
95}
96
97//_____________________________________________________________________________
38e6e547 98void AliTPCReconstructor::Reconstruct(AliRunLoader* runLoader,
99 AliRawReader* rawReader) const
100{
101// reconstruct clusters from raw data
102
103 AliLoader* loader = runLoader->GetLoader("TPCLoader");
104 if (!loader) {
105 Error("Reconstruct", "TPC loader not found");
106 return;
107 }
108 loader->LoadRecPoints("recreate");
109
110 AliTPCParam* param = GetTPCParam(runLoader);
90c7886e 111 if (!param) {
112 AliWarning("Loading default TPC parameters !");
113 param = new AliTPCParamSR;
114 }
38e6e547 115 AliTPCclustererMI clusterer(param);
116
b6f060dc 117 TString option = GetOption();
194b0609 118 // if (option.Contains("PedestalSubtraction"))
119 // clusterer.SetPedSubtraction(kTRUE);
c8c88e5d 120 if (option.Contains("OldRCUFormat"))
121 clusterer.SetOldRCUFormat(kTRUE);
b6f060dc 122
38e6e547 123 Int_t iEvent = 0;
2c7f22ff 124 while (rawReader->NextEvent()) {
38e6e547 125 runLoader->GetEvent(iEvent++);
126
127 TTree* treeClusters = loader->TreeR();
128 if (!treeClusters) {
129 loader->MakeTree("R");
130 treeClusters = loader->TreeR();
131 }
132
133 clusterer.SetOutput(treeClusters);
134 clusterer.Digits2Clusters(rawReader);
135
136 loader->WriteRecPoints("OVERWRITE");
137 }
138
139 loader->UnloadRecPoints();
140}
141
142//_____________________________________________________________________________
59697224 143AliTracker* AliTPCReconstructor::CreateTracker(AliRunLoader* runLoader) const
144{
145// create a TPC tracker
146
147 AliTPCParam* param = GetTPCParam(runLoader);
90c7886e 148 if (!param) {
149 AliWarning("Loading default TPC parameters !");
150 param = new AliTPCParamSR;
151 }
4fb6310b 152 param->ReadGeoMatrices();
59697224 153 return new AliTPCtrackerMI(param);
154}
155
156//_____________________________________________________________________________
157void AliTPCReconstructor::FillESD(AliRunLoader* /*runLoader*/,
158 AliESD* esd) const
159{
160// make PID
161
162 Double_t parTPC[] = {47., 0.10, 10.};
163 AliTPCpidESD tpcPID(parTPC);
164 tpcPID.MakePID(esd);
165}
166
167
168//_____________________________________________________________________________
3d37b790 169AliTPCParam* AliTPCReconstructor::GetTPCParam(AliRunLoader* /*runLoader*/) const
59697224 170{
171// get the TPC parameters
172
3d37b790 173// TDirectory* saveDir = gDirectory;
174//runLoader->CdGAFile();
6d75e4b6 175
3d37b790 176 AliTPCParam* param = AliTPCcalibDB::Instance()->GetParameters();
6d75e4b6 177
3d37b790 178 // AliTPCParam* param = (AliTPCParam*) gDirectory->Get("75x40_100x60_150x60");
179// if (!param) Error("GetTPCParam", "no TPC parameters found");
180
181// saveDir->cd();
6d75e4b6 182 return param;
59697224 183}