]>
Commit | Line | Data |
---|---|---|
051a0e2d | 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 | /////////////////////////////////////////////////////////////////////////////// | |
17 | // // | |
18 | // TRD cluster finder // | |
19 | // // | |
20 | /////////////////////////////////////////////////////////////////////////////// | |
21 | ||
22 | #include <TF1.h> | |
23 | #include <TTree.h> | |
24 | #include <TH1.h> | |
25 | #include <TFile.h> | |
26 | ||
27 | #include "AliRunLoader.h" | |
28 | #include "AliLoader.h" | |
29 | #include "AliRawReader.h" | |
30 | #include "AliLog.h" | |
31 | ||
32 | #include "AliTRDclusterizerHLT.h" | |
33 | #include "AliTRDgeometry.h" | |
34 | #include "AliTRDdataArrayF.h" | |
35 | #include "AliTRDdataArrayI.h" | |
36 | #include "AliTRDdigitsManager.h" | |
37 | #include "AliTRDpadPlane.h" | |
38 | #include "AliTRDrawData.h" | |
39 | #include "AliTRDcalibDB.h" | |
40 | #include "AliTRDSimParam.h" | |
41 | #include "AliTRDRecParam.h" | |
42 | #include "AliTRDCommonParam.h" | |
43 | #include "AliTRDcluster.h" | |
44 | ||
45 | #include "Cal/AliTRDCalROC.h" | |
46 | #include "Cal/AliTRDCalDet.h" | |
47 | ||
48 | ClassImp(AliTRDclusterizerHLT) | |
49 | ||
50 | //_____________________________________________________________________________ | |
51 | AliTRDclusterizerHLT::AliTRDclusterizerHLT() | |
52 | : AliTRDclusterizer(), | |
53 | fTreeCreatedHere(kFALSE), | |
54 | fNclusters(-1), | |
55 | fRawDataSource(0) | |
56 | { | |
57 | // | |
58 | // AliTRDclusterizerHLT default constructor | |
59 | // | |
60 | } | |
61 | ||
62 | //_____________________________________________________________________________ | |
63 | AliTRDclusterizerHLT::AliTRDclusterizerHLT(const Text_t *name, const Text_t *title) | |
64 | : AliTRDclusterizer(name,title), | |
65 | fTreeCreatedHere(kFALSE), | |
66 | fNclusters(-1), | |
67 | fRawDataSource(0) | |
68 | { | |
69 | // | |
70 | // AliTRDclusterizerHLT constructor | |
71 | // | |
72 | } | |
73 | ||
74 | //_____________________________________________________________________________ | |
75 | AliTRDclusterizerHLT::AliTRDclusterizerHLT(const AliTRDclusterizerHLT &c) | |
76 | : AliTRDclusterizer(c), | |
77 | fTreeCreatedHere(kFALSE), | |
78 | fNclusters(-1), | |
79 | fRawDataSource(0) | |
80 | { | |
81 | // | |
82 | // AliTRDclusterizerHLT copy constructor | |
83 | // | |
84 | } | |
85 | ||
86 | //_____________________________________________________________________________ | |
87 | AliTRDclusterizerHLT::~AliTRDclusterizerHLT() | |
88 | { | |
89 | // | |
90 | // AliTRDclusterizerHLT destructor | |
91 | // | |
92 | if (fTreeCreatedHere == kTRUE) | |
93 | delete fClusterTree; | |
94 | ||
95 | delete fRawDataSource; | |
96 | ||
97 | } | |
98 | ||
99 | //_____________________________________________________________________________ | |
100 | AliTRDclusterizerHLT &AliTRDclusterizerHLT::operator=(const AliTRDclusterizerHLT &c) | |
101 | { | |
102 | // | |
103 | // Assignment operator | |
104 | // | |
105 | ||
106 | this->fRawDataSource = 0; | |
107 | if (this != &c) ((AliTRDclusterizerHLT &) c).Copy(*this); | |
108 | return *this; | |
109 | ||
110 | } | |
111 | ||
112 | //_____________________________________________________________________________ | |
113 | void AliTRDclusterizerHLT::Copy(TObject &c) const | |
114 | { | |
115 | // | |
116 | // Copy function | |
117 | // | |
118 | ||
119 | AliFatal("Not implemented"); | |
120 | ||
121 | //use the parameter c - no warning... | |
122 | ((AliTRDclusterizerHLT &) c).fDigitsManager = 0; | |
123 | // ((AliTRDclusterizerHLT &) c).fDigitsManager = 0; | |
124 | // ((AliTRDclusterizerHLT &) c).fTreeCreatedHere = kFALSE; | |
125 | // AliTRDclusterizer::Copy(c); | |
126 | ||
127 | } | |
128 | ||
129 | //_____________________________________________________________________________ | |
130 | Bool_t AliTRDclusterizerHLT::ReadDigits(AliRawReaderMemory *rawReader) | |
131 | { | |
132 | // | |
133 | // Reads the digits arrays from the ddl file | |
134 | // | |
135 | ||
136 | if (fRawDataSource == 0) | |
137 | fRawDataSource = new AliTRDrawData; | |
138 | ||
139 | //PH fRawDataSource->SetRawVersion(fRawVersion); | |
140 | fDigitsManager = fRawDataSource->Raw2Digits((AliRawReader*)rawReader); | |
141 | //AliInfo(Form("Digits manager at 0x%x", fDigitsManager)); | |
142 | AliDebug(1, Form("Digits manager at 0x%x", fDigitsManager)); | |
143 | if (fDigitsManager) | |
144 | return kTRUE; | |
145 | else | |
146 | return kFALSE; | |
147 | ||
148 | } | |
149 | ||
150 | //_____________________________________________________________________________ | |
151 | Bool_t AliTRDclusterizerHLT::InitClusterTree() | |
152 | { | |
153 | // | |
154 | // This has to be called on HLT - creation of the cluster Tree used by the offline clusterizer (base class) | |
155 | // | |
156 | Bool_t kReturn = kFALSE; | |
157 | if (fClusterTree == 0) | |
158 | { | |
159 | fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree"); | |
160 | fTreeCreatedHere = kTRUE; | |
161 | } | |
162 | ||
163 | if (fClusterTree != 0) | |
164 | kReturn = kTRUE; | |
165 | ||
166 | return kReturn; | |
167 | } | |
168 | ||
169 | //_____________________________________________________________________________ | |
170 | Bool_t AliTRDclusterizerHLT::InsertClusters(TObjArray *tobjarr, Int_t idet) | |
171 | { | |
172 | // | |
173 | // Fill the tree with clusters - from a different component for example | |
174 | // | |
175 | ||
176 | //clear the current | |
177 | ResetRecPoints(); | |
178 | delete fRecPoints; | |
179 | fRecPoints = 0; | |
180 | ||
181 | //set the pointer used in WriteClusters | |
182 | fRecPoints = tobjarr; | |
183 | Bool_t kRet = kFALSE; | |
184 | if (InitClusterTree()) | |
185 | kRet = WriteClusters(idet); | |
186 | ||
187 | fRecPoints = 0; | |
188 | ||
189 | return kRet; | |
190 | } | |
191 | //_____________________________________________________________________________ | |
192 | Int_t AliTRDclusterizerHLT::GetNclusters() | |
193 | { | |
194 | // | |
195 | // Returns the number of clusters AliTRDclusterizerHLT::fNclusters | |
196 | // Count them first if fNclusters < 0 | |
197 | // | |
198 | ||
199 | if (fNclusters < 0) | |
200 | { | |
201 | CountClusters(); | |
202 | } | |
203 | return fNclusters; | |
204 | } | |
205 | ||
206 | //_____________________________________________________________________________ | |
207 | Bool_t AliTRDclusterizerHLT::ResetTree() | |
208 | { | |
209 | // | |
210 | // Recreate the cluster tree | |
211 | // | |
212 | ||
213 | // if (fClusterTree != 0) | |
214 | // fClusterTree->Reset(); | |
215 | // well we'd better delete the whole tree and branches | |
216 | delete fClusterTree; | |
217 | fClusterTree = NULL; | |
218 | fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree"); | |
219 | if (fClusterTree) | |
220 | { | |
221 | fTreeCreatedHere = kTRUE; | |
222 | fNclusters = -1; | |
223 | //AliInfo("Tree Reset Successful"); | |
224 | AliDebug(1,Form("Tree Reset Successful")); | |
225 | } | |
226 | else | |
227 | { | |
228 | fTreeCreatedHere = kFALSE; | |
229 | AliError("Reset Tree Error!\n"); | |
230 | } | |
231 | ||
232 | return fTreeCreatedHere; | |
233 | } | |
234 | ||
235 | //_____________________________________________________________________________ | |
236 | Int_t AliTRDclusterizerHLT::CountClusters() | |
237 | { | |
238 | // | |
239 | // Count the clusters - runs over the cluster tree | |
240 | // | |
241 | ||
242 | fNclusters = -1; | |
243 | if (fClusterTree == 0) | |
244 | { | |
245 | AliError("No tree to count clusters!\n"); | |
246 | return -1; | |
247 | } | |
248 | TList *lt = (TList*)fClusterTree->GetListOfBranches(); | |
249 | TIter it(lt); | |
250 | it.Reset(); | |
251 | TBranch *tb = 0; | |
252 | Int_t icount = 0; | |
253 | while ((tb = (TBranch*)it.Next()) != 0) | |
254 | { | |
255 | TObjArray *clusters = 0; | |
256 | tb->SetAddress(&clusters); | |
257 | for (Int_t icb = 0; icb < tb->GetEntries(); icb++) | |
258 | { | |
259 | tb->GetEntry(icb); | |
260 | icount += clusters->GetEntries(); | |
261 | } | |
262 | } | |
263 | fNclusters = icount; | |
264 | //AliInfo(Form("Recounted clusters %d", fNclusters)); | |
265 | AliDebug(2, Form("Recounted clusters %d", fNclusters)); | |
266 | ||
267 | return fNclusters; | |
268 | } |