Transform1to2 - global to local system - taken from TGeoManager (M.Ivanov)
[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"
32
33
34ClassImp(AliTPCReconstructor)
35
8018bb90 36Double_t AliTPCReconstructor::fgCtgRange = 1.05;
3f82c4f2 37Double_t AliTPCReconstructor::fgMaxSnpTracker = 0.95; // max tangent in tracker - correspond to 3
38Double_t AliTPCReconstructor::fgMaxSnpTrack = 0.999; // tangent
34acb742 39Int_t AliTPCReconstructor::fgStreamLevel = 0; // stream (debug) level
59697224 40//_____________________________________________________________________________
41void AliTPCReconstructor::Reconstruct(AliRunLoader* runLoader) const
42{
43// reconstruct clusters
44
45 AliLoader* loader = runLoader->GetLoader("TPCLoader");
46 if (!loader) {
47 Error("Reconstruct", "TPC loader not found");
48 return;
49 }
50 loader->LoadRecPoints("recreate");
51 loader->LoadDigits("read");
52
53 AliTPCParam* param = GetTPCParam(runLoader);
54 if (!param) return;
55 AliTPCclustererMI clusterer(param);
56 Int_t nEvents = runLoader->GetNumberOfEvents();
57
58 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
59 runLoader->GetEvent(iEvent);
60
61 TTree* treeClusters = loader->TreeR();
62 if (!treeClusters) {
63 loader->MakeTree("R");
64 treeClusters = loader->TreeR();
65 }
66 TTree* treeDigits = loader->TreeD();
67 if (!treeDigits) {
68 Error("Reconstruct", "Can't get digits tree !");
69 return;
70 }
71
72 clusterer.SetInput(treeDigits);
73 clusterer.SetOutput(treeClusters);
74 clusterer.Digits2Clusters();
75
76 loader->WriteRecPoints("OVERWRITE");
77 }
78
79 loader->UnloadRecPoints();
80 loader->UnloadDigits();
81}
82
83//_____________________________________________________________________________
38e6e547 84void AliTPCReconstructor::Reconstruct(AliRunLoader* runLoader,
85 AliRawReader* rawReader) const
86{
87// reconstruct clusters from raw data
88
89 AliLoader* loader = runLoader->GetLoader("TPCLoader");
90 if (!loader) {
91 Error("Reconstruct", "TPC loader not found");
92 return;
93 }
94 loader->LoadRecPoints("recreate");
95
96 AliTPCParam* param = GetTPCParam(runLoader);
97 if (!param) return;
98 AliTPCclustererMI clusterer(param);
99
100 Int_t iEvent = 0;
101 while (rawReader->NextEvent()) {
102 runLoader->GetEvent(iEvent++);
103
104 TTree* treeClusters = loader->TreeR();
105 if (!treeClusters) {
106 loader->MakeTree("R");
107 treeClusters = loader->TreeR();
108 }
109
110 clusterer.SetOutput(treeClusters);
111 clusterer.Digits2Clusters(rawReader);
112
113 loader->WriteRecPoints("OVERWRITE");
114 }
115
116 loader->UnloadRecPoints();
117}
118
119//_____________________________________________________________________________
59697224 120AliTracker* AliTPCReconstructor::CreateTracker(AliRunLoader* runLoader) const
121{
122// create a TPC tracker
123
124 AliTPCParam* param = GetTPCParam(runLoader);
125 if (!param) return NULL;
126 return new AliTPCtrackerMI(param);
127}
128
129//_____________________________________________________________________________
130void AliTPCReconstructor::FillESD(AliRunLoader* /*runLoader*/,
131 AliESD* esd) const
132{
133// make PID
134
135 Double_t parTPC[] = {47., 0.10, 10.};
136 AliTPCpidESD tpcPID(parTPC);
137 tpcPID.MakePID(esd);
138}
139
140
141//_____________________________________________________________________________
142AliTPCParam* AliTPCReconstructor::GetTPCParam(AliRunLoader* runLoader) const
143{
144// get the TPC parameters
145
6d75e4b6 146 TDirectory* saveDir = gDirectory;
147 runLoader->CdGAFile();
148
149 AliTPCParam* param = (AliTPCParam*) gDirectory->Get("75x40_100x60_150x60");
150 if (!param) Error("GetTPCParam", "no TPC parameters found");
151
152 saveDir->cd();
153 return param;
59697224 154}