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