]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCReconstructor.cxx
Set higher precision magnetic field integration method,
[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
34 ClassImp(AliTPCReconstructor)
35
36 Double_t AliTPCReconstructor::fgCtgRange = 1.05;
37 Double_t AliTPCReconstructor::fgMaxSnpTracker   = 0.95;   // max tangent in tracker - correspond to 3    
38 Double_t AliTPCReconstructor::fgMaxSnpTrack     = 0.999;  // tangent    
39 Int_t    AliTPCReconstructor::fgStreamLevel     = 0;      // stream (debug) level
40 //_____________________________________________________________________________
41 void 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 //_____________________________________________________________________________
84 void 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 //_____________________________________________________________________________
120 AliTracker* AliTPCReconstructor::CreateTracker(AliRunLoader* runLoader) const
121 {
122 // create a TPC tracker
123
124   AliTPCParam* param = GetTPCParam(runLoader);
125   if (!param) return NULL;
126   param->ReadGeoMatrices();
127   return new AliTPCtrackerMI(param);
128 }
129
130 //_____________________________________________________________________________
131 void AliTPCReconstructor::FillESD(AliRunLoader* /*runLoader*/, 
132                                   AliESD* esd) const
133 {
134 // make PID
135
136   Double_t parTPC[] = {47., 0.10, 10.};
137   AliTPCpidESD tpcPID(parTPC);
138   tpcPID.MakePID(esd);
139 }
140
141
142 //_____________________________________________________________________________
143 AliTPCParam* AliTPCReconstructor::GetTPCParam(AliRunLoader* runLoader) const
144 {
145 // get the TPC parameters
146
147   TDirectory* saveDir = gDirectory;
148   runLoader->CdGAFile();
149
150   AliTPCParam* param = (AliTPCParam*) gDirectory->Get("75x40_100x60_150x60");
151   if (!param) Error("GetTPCParam", "no TPC parameters found");
152
153   saveDir->cd();
154   return param;
155 }