]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCReconstructor.cxx
Remove obsolete class AliTPCclusterLMI (Marian)
[u/mrichter/AliRoot.git] / TPC / AliTPCReconstructor.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 /* $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"
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"
35
36 ClassImp(AliTPCReconstructor)
37
38
39 AliTPCRecoParam *    AliTPCReconstructor::fgkRecoParam =0;  // reconstruction parameters
40 Int_t    AliTPCReconstructor::fgStreamLevel     = 0;        // stream (debug) level
41
42
43 AliTPCReconstructor::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
54 //_____________________________________________________________________________
55 void 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 //_____________________________________________________________________________
98 void 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);
111   if (!param) {
112     AliWarning("Loading default TPC parameters !");
113     param = new AliTPCParamSR;
114   }
115   AliTPCclustererMI clusterer(param);
116
117   TString option = GetOption();
118   //  if (option.Contains("PedestalSubtraction"))
119   //  clusterer.SetPedSubtraction(kTRUE);
120   if (option.Contains("OldRCUFormat"))
121     clusterer.SetOldRCUFormat(kTRUE);
122  
123   Int_t iEvent = 0;
124   while (rawReader->NextEvent()) {  
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 //_____________________________________________________________________________
143 AliTracker* AliTPCReconstructor::CreateTracker(AliRunLoader* runLoader) const
144 {
145 // create a TPC tracker
146
147   AliTPCParam* param = GetTPCParam(runLoader);
148   if (!param) {
149     AliWarning("Loading default TPC parameters !");
150     param = new AliTPCParamSR;
151   }
152   param->ReadGeoMatrices();
153   return new AliTPCtrackerMI(param);
154 }
155
156 //_____________________________________________________________________________
157 void 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 //_____________________________________________________________________________
169 AliTPCParam* AliTPCReconstructor::GetTPCParam(AliRunLoader* /*runLoader*/) const
170 {
171 // get the TPC parameters
172
173 //  TDirectory* saveDir = gDirectory;
174 //runLoader->CdGAFile();
175
176   AliTPCParam* param =  AliTPCcalibDB::Instance()->GetParameters();
177
178  //  AliTPCParam* param = (AliTPCParam*) gDirectory->Get("75x40_100x60_150x60");
179 //   if (!param) Error("GetTPCParam", "no TPC parameters found");
180
181 //  saveDir->cd();
182   return param;
183 }