1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // class for TPC reconstruction //
22 ///////////////////////////////////////////////////////////////////////////////
25 #include "AliTPCReconstructor.h"
26 #include "AliRunLoader.h"
28 #include "AliRawReader.h"
29 #include "AliTPCclustererMI.h"
30 #include "AliTPCtrackerMI.h"
31 #include "AliTPCpidESD.h"
32 #include "AliTPCParam.h"
33 #include "AliTPCParamSR.h"
34 #include "AliTPCcalibDB.h"
36 ClassImp(AliTPCReconstructor)
39 AliTPCRecoParam * AliTPCReconstructor::fgkRecoParam =0; // reconstruction parameters
40 Int_t AliTPCReconstructor::fgStreamLevel = 0; // stream (debug) level
43 AliTPCReconstructor::AliTPCReconstructor():
48 // default constructor
51 AliError("The Reconstruction parameters nonitialized - Used default one");
52 fgkRecoParam = AliTPCRecoParam::GetHighFluxParam();
55 AliTPCParam* param = GetTPCParam();
57 AliWarning("Loading default TPC parameters !");
58 param = new AliTPCParamSR;
60 fClusterer = new AliTPCclustererMI(param);
63 //_____________________________________________________________________________
64 AliTPCReconstructor::~AliTPCReconstructor()
66 if (fgkRecoParam) delete fgkRecoParam;
67 if (fClusterer) delete fClusterer;
70 //_____________________________________________________________________________
71 void AliTPCReconstructor::Reconstruct(AliRunLoader* runLoader) const
73 // reconstruct clusters
75 AliLoader* loader = runLoader->GetLoader("TPCLoader");
77 Error("Reconstruct", "TPC loader not found");
80 loader->LoadRecPoints("recreate");
81 loader->LoadDigits("read");
83 Int_t nEvents = runLoader->GetNumberOfEvents();
85 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
86 runLoader->GetEvent(iEvent);
88 TTree* treeClusters = loader->TreeR();
90 loader->MakeTree("R");
91 treeClusters = loader->TreeR();
93 TTree* treeDigits = loader->TreeD();
95 Error("Reconstruct", "Can't get digits tree !");
99 fClusterer->SetInput(treeDigits);
100 fClusterer->SetOutput(treeClusters);
101 fClusterer->Digits2Clusters();
103 loader->WriteRecPoints("OVERWRITE");
106 loader->UnloadRecPoints();
107 loader->UnloadDigits();
110 //_____________________________________________________________________________
111 void AliTPCReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const {
112 // single event local reconstruction
114 fClusterer->SetInput(digitsTree);
115 fClusterer->SetOutput(clustersTree);
116 fClusterer->Digits2Clusters();
119 //_____________________________________________________________________________
120 void AliTPCReconstructor::Reconstruct(AliRunLoader* runLoader,
121 AliRawReader* rawReader) const
123 // reconstruct clusters from raw data
125 AliLoader* loader = runLoader->GetLoader("TPCLoader");
127 Error("Reconstruct", "TPC loader not found");
130 loader->LoadRecPoints("recreate");
132 TString option = GetOption();
133 if (option.Contains("OldRCUFormat"))
134 fClusterer->SetOldRCUFormat(kTRUE);
137 while (rawReader->NextEvent()) {
138 runLoader->GetEvent(iEvent++);
140 TTree* treeClusters = loader->TreeR();
142 loader->MakeTree("R");
143 treeClusters = loader->TreeR();
146 fClusterer->SetOutput(treeClusters);
147 fClusterer->Digits2Clusters(rawReader);
149 loader->WriteRecPoints("OVERWRITE");
152 loader->UnloadRecPoints();
155 //_____________________________________________________________________________
156 void AliTPCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const {
157 // single event local reconstruction
158 // of TPC data starting from raw data
159 TString option = GetOption();
160 if (option.Contains("OldRCUFormat"))
161 fClusterer->SetOldRCUFormat(kTRUE);
163 fClusterer->SetOutput(clustersTree);
164 fClusterer->Digits2Clusters(rawReader);
167 //_____________________________________________________________________________
168 AliTracker* AliTPCReconstructor::CreateTracker(AliRunLoader* /* runLoader */) const
170 // create a TPC tracker
172 AliTPCParam* param = GetTPCParam();
174 AliWarning("Loading default TPC parameters !");
175 param = new AliTPCParamSR;
177 param->ReadGeoMatrices();
178 return new AliTPCtrackerMI(param);
181 //_____________________________________________________________________________
182 void AliTPCReconstructor::FillESD(AliRunLoader* /*runLoader*/,
187 Double_t parTPC[] = {47., 0.10, 10.};
188 AliTPCpidESD tpcPID(parTPC);
193 //_____________________________________________________________________________
194 AliTPCParam* AliTPCReconstructor::GetTPCParam() const
196 // get the TPC parameters
198 AliTPCParam* param = AliTPCcalibDB::Instance()->GetParameters();