]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDReconstructor.cxx
Latest version of zero suppressed raw data by Ken and Mateusz
[u/mrichter/AliRoot.git] / TRD / AliTRDReconstructor.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 TRD reconstruction                                              //
21 //                                                                           //
22 ///////////////////////////////////////////////////////////////////////////////
23
24 #include <TFile.h>
25
26 #include "AliRunLoader.h"
27 #include "AliRawReader.h"
28 #include "AliLog.h"
29 #include "AliESDTrdTrack.h"
30 #include "AliESDEvent.h"
31
32 #include "AliTRDReconstructor.h"
33 #include "AliTRDclusterizerV1.h"
34 #include "AliTRDclusterizerV2.h"
35 #include "AliTRDtracker.h"
36 #include "AliTRDpidESD.h"
37 #include "AliTRDgtuTrack.h"
38 #include "AliTRDrawData.h"
39 #include "AliTRDdigitsManager.h"
40
41 ClassImp(AliTRDReconstructor)
42
43 Bool_t AliTRDReconstructor::fgkSeedingOn  = kFALSE;
44 Int_t  AliTRDReconstructor::fgStreamLevel = 0;      // Stream (debug) level
45
46 //_____________________________________________________________________________
47 void AliTRDReconstructor::ConvertDigits(AliRawReader *rawReader
48                                       , TTree *digitsTree) const
49 {
50   //
51   // Convert raw data digits into digit objects in a root tree
52   //
53
54   AliInfo("Convert raw data digits into digit objects [RawReader -> Digit TTree]");
55
56   AliTRDrawData rawData;
57   rawReader->Reset();
58   rawReader->Select("TRD");
59   AliTRDdigitsManager *manager = rawData.Raw2Digits(rawReader);
60   manager->MakeBranch(digitsTree);
61   manager->WriteDigits();
62
63 }
64
65 //_____________________________________________________________________________
66 void AliTRDReconstructor::Reconstruct(AliRunLoader *runLoader
67                                     , AliRawReader *rawReader) const
68 {
69   //
70   // Reconstruct clusters
71   //
72
73   AliInfo("Reconstruct TRD clusters from RAW data [RunLoader, RawReader]");
74
75   AliLoader *loader = runLoader->GetLoader("TRDLoader");
76   loader->LoadRecPoints("recreate");
77
78   runLoader->CdGAFile();
79   Int_t nEvents = runLoader->GetNumberOfEvents();
80
81   rawReader->Reset();
82   rawReader->Select("TRD");
83
84   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
85
86     if (!rawReader->NextEvent()) break;
87
88     // Old (slow) cluster finder
89     //AliTRDclusterizerV1 clusterer("clusterer","TRD clusterizer");
90     //clusterer.Open(runLoader->GetFileName(),iEvent);
91     //clusterer.ReadDigits(rawReader);
92     //clusterer.MakeClusters();
93
94     // New (fast) cluster finder
95     AliTRDclusterizerV2 clusterer("clusterer","TRD clusterizer");
96     clusterer.Open(runLoader->GetFileName(),iEvent);
97     clusterer.Raw2ClustersChamber(rawReader);
98
99     clusterer.WriteClusters(-1);
100
101   }
102
103   loader->UnloadRecPoints();
104
105 }
106
107 //_____________________________________________________________________________
108 void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
109                                     , TTree *clusterTree) const
110 {
111   //
112   // Reconstruct clusters
113   //
114
115   AliInfo("Reconstruct TRD clusters from RAW data [RawReader -> Cluster TTree]");
116
117   rawReader->Reset();
118   rawReader->Select("TRD");
119
120   // Old (slow) cluster finder
121   //AliTRDclusterizerV1 clusterer("clusterer","TRD clusterizer");
122   //clusterer.OpenOutput(clusterTree);
123   //clusterer.ReadDigits(rawReader);
124   //clusterer.MakeClusters();
125
126   // New (fast) cluster finder
127   AliTRDclusterizerV2 clusterer("clusterer","TRD clusterizer");
128   clusterer.OpenOutput(clusterTree);
129   clusterer.SetAddLabels(kFALSE);
130   clusterer.Raw2ClustersChamber(rawReader);
131 }
132
133 //_____________________________________________________________________________
134 void AliTRDReconstructor::Reconstruct(TTree *digitsTree
135                                     , TTree *clusterTree) const
136 {
137   //
138   // Reconstruct clusters
139   //
140   AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]");
141
142   //AliTRDclusterizerV1 clusterer("clusterer","TRD clusterizer");
143   AliTRDclusterizerV2 clusterer("clusterer","TRD clusterizer");
144   clusterer.OpenOutput(clusterTree);
145   clusterer.ReadDigits(digitsTree);
146   clusterer.MakeClusters();
147 }
148
149 //_____________________________________________________________________________
150 void AliTRDReconstructor::Reconstruct(AliRunLoader *runLoader) const
151 {
152   //
153   // Reconstruct clusters
154   //
155
156   AliInfo("Reconstruct TRD clusters [AliRunLoader]");
157   AliLoader *loader = runLoader->GetLoader("TRDLoader");
158   loader->LoadRecPoints("recreate");
159
160   runLoader->CdGAFile();
161   Int_t nEvents = runLoader->GetNumberOfEvents();
162
163   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
164     AliTRDclusterizerV1 clusterer("clusterer","TRD clusterizer");
165     //AliTRDclusterizerV2 clusterer("clusterer","TRD clusterizer");
166     clusterer.Open(runLoader->GetFileName(),iEvent);
167     clusterer.ReadDigits();
168     clusterer.MakeClusters();
169     clusterer.WriteClusters(-1);
170   }
171
172   loader->UnloadRecPoints();
173
174 }
175
176 //_____________________________________________________________________________
177 AliTracker *AliTRDReconstructor::CreateTracker(AliRunLoader *runLoader) const
178 {
179   //
180   // Create a TRD tracker
181   //
182
183   runLoader->CdGAFile();
184
185   return new AliTRDtracker(gFile);
186
187 }
188
189 //_____________________________________________________________________________
190 void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/
191                                 , AliRawReader* /*rawReader*/
192                                 , AliESDEvent* /*esd*/) const
193 {
194   //
195   // Make PID
196   //
197
198   //AliTRDpidESD trdPID;
199   //trdPID.MakePID(esd);
200
201 }
202
203 //_____________________________________________________________________________
204 void AliTRDReconstructor::FillESD(AliRawReader* /*rawReader*/
205                                 , TTree* /*clusterTree*/
206                                 , AliESDEvent* /*esd*/) const
207 {
208   //
209   // Make PID
210   //
211
212   //AliTRDpidESD trdPID;
213   //trdPID.MakePID(esd);
214
215 }
216
217 //_____________________________________________________________________________
218 void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/
219                                 , TTree* /*clusterTree*/
220                                 , AliESDEvent* /*esd*/) const
221 {
222   //
223   // Make PID
224   //
225
226   //AliTRDpidESD trdPID;
227   //trdPID.MakePID(esd);
228
229 }
230
231 //_____________________________________________________________________________
232 void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/
233                                 , AliESDEvent* /*esd*/) const
234 {
235   //
236   // Make PID
237   //
238
239   //AliTRDpidESD trdPID;
240   //trdPID.MakePID(esd);
241
242 }