SetRunReconstruction renamed to SetRunLoaclReconstruction. First implementation of...
[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"
28#include "AliTPC.h"
29#include "AliTPCclustererMI.h"
30#include "AliTPCtrackerMI.h"
31#include "AliTPCpidESD.h"
32
33
34ClassImp(AliTPCReconstructor)
35
36
37//_____________________________________________________________________________
38void AliTPCReconstructor::Reconstruct(AliRunLoader* runLoader) const
39{
40// reconstruct clusters
41
42 AliLoader* loader = runLoader->GetLoader("TPCLoader");
43 if (!loader) {
44 Error("Reconstruct", "TPC loader not found");
45 return;
46 }
47 loader->LoadRecPoints("recreate");
48 loader->LoadDigits("read");
49
50 AliTPCParam* param = GetTPCParam(runLoader);
51 if (!param) return;
52 AliTPCclustererMI clusterer(param);
53 Int_t nEvents = runLoader->GetNumberOfEvents();
54
55 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
56 runLoader->GetEvent(iEvent);
57
58 TTree* treeClusters = loader->TreeR();
59 if (!treeClusters) {
60 loader->MakeTree("R");
61 treeClusters = loader->TreeR();
62 }
63 TTree* treeDigits = loader->TreeD();
64 if (!treeDigits) {
65 Error("Reconstruct", "Can't get digits tree !");
66 return;
67 }
68
69 clusterer.SetInput(treeDigits);
70 clusterer.SetOutput(treeClusters);
71 clusterer.Digits2Clusters();
72
73 loader->WriteRecPoints("OVERWRITE");
74 }
75
76 loader->UnloadRecPoints();
77 loader->UnloadDigits();
78}
79
80//_____________________________________________________________________________
81AliTracker* AliTPCReconstructor::CreateTracker(AliRunLoader* runLoader) const
82{
83// create a TPC tracker
84
85 AliTPCParam* param = GetTPCParam(runLoader);
86 if (!param) return NULL;
87 return new AliTPCtrackerMI(param);
88}
89
90//_____________________________________________________________________________
91void AliTPCReconstructor::FillESD(AliRunLoader* /*runLoader*/,
92 AliESD* esd) const
93{
94// make PID
95
96 Double_t parTPC[] = {47., 0.10, 10.};
97 AliTPCpidESD tpcPID(parTPC);
98 tpcPID.MakePID(esd);
99}
100
101
102//_____________________________________________________________________________
103AliTPCParam* AliTPCReconstructor::GetTPCParam(AliRunLoader* runLoader) const
104{
105// get the TPC parameters
106
107 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
108 if (!runLoader->GetAliRun()) {
109 Error("GetTPCParam", "couldn't get AliRun object");
110 return NULL;
111 }
112 AliTPC* tpc = (AliTPC*) runLoader->GetAliRun()->GetDetector("TPC");
113 if (!tpc) {
114 Error("GetTPCParam", "couldn't get TPC detector");
115 return NULL;
116 }
117 if (!tpc->GetParam()) {
118 Error("GetTPCParam", "no TPC parameters available");
119 return NULL;
120 }
121 return tpc->GetParam();
122}