ffa6d63b |
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 | /* $Log: |
d75bea67 |
19 | 29.05.2001 Yuri Kharlov: |
20 | Everywhere reading the treese TTree->GetEvent(i) |
21 | is replaced by reading the branches TBranch->GetEntry(0) |
ffa6d63b |
22 | */ |
23 | |
24 | //_________________________________________________________________________ |
25 | // A singleton. This class should be used in the analysis stage to get |
26 | // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles, |
27 | // instead of directly reading them from galice.root file. This container |
28 | // ensures, that one reads Digits, made of these particular digits, RecPoints, |
29 | // made of these particular RecPoints, TrackSegments and RecParticles. |
30 | // This becomes non trivial if there are several identical branches, produced with |
d75bea67 |
31 | // different set of parameters. |
ffa6d63b |
32 | // |
33 | // An example of how to use (see also class AliEMCALAnalyser): |
34 | // AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ; |
d75bea67 |
35 | // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++) |
36 | // AliEMCALRecParticle * part = gime->RecParticle(1) ; |
ffa6d63b |
37 | // ................ |
38 | // please->GetEvent(event) ; // reads new event from galice.root |
39 | // |
d75bea67 |
40 | //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) |
41 | //*-- Completely redesigned by Dmitri Peressounko March 2001 |
42 | // |
43 | //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make |
44 | //*-- systematic usage of TFolders without changing the interface |
ffa6d63b |
45 | ////////////////////////////////////////////////////////////////////////////// |
46 | |
47 | |
48 | // --- ROOT system --- |
49 | |
50 | #include "TFile.h" |
51 | #include "TTree.h" |
52 | #include "TROOT.h" |
53 | #include "TObjString.h" |
54 | #include "TFolder.h" |
55 | |
56 | // --- Standard library --- |
57 | #include <iostream.h> |
58 | |
59 | // --- AliRoot header files --- |
60 | |
61 | #include "AliRun.h" |
62 | #include "AliConfig.h" |
63 | #include "AliEMCALGetter.h" |
472319e5 |
64 | #include "AliEMCALHit.h" |
ffa6d63b |
65 | #include "AliEMCALv1.h" |
66 | #include "AliEMCALDigitizer.h" |
67 | #include "AliEMCALSDigitizer.h" |
f07cab21 |
68 | #include "AliEMCALClusterizer.h" |
69 | #include "AliEMCALClusterizerv1.h" |
d75bea67 |
70 | //#include "AliEMCALTrackSegmentMaker.h" |
71 | //#include "AliEMCALTrackSegmentMakerv1.h" |
72 | //#include "AliEMCALTrackSegment.h" |
73 | //#include "AliEMCALPID.h" |
74 | //#include "AliEMCALPIDv1.h" |
ffa6d63b |
75 | #include "AliEMCALGeometry.h" |
76 | |
77 | ClassImp(AliEMCALGetter) |
78 | |
79 | AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ; |
52ea052c |
80 | TFile * AliEMCALGetter::fFile = 0 ; |
ffa6d63b |
81 | |
82 | //____________________________________________________________________________ |
472319e5 |
83 | AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Option_t * rw) |
ffa6d63b |
84 | { |
85 | //Initialize all lists |
86 | |
54b82aa4 |
87 | fDebug = 0 ; |
9bd3caba |
88 | |
89 | fAlice = 0 ; |
90 | |
ffa6d63b |
91 | fHeaderFile = headerFile ; |
92 | fBranchTitle = branchTitle ; |
93 | fSDigitsTitle = branchTitle ; |
94 | fDigitsTitle = branchTitle ; |
f07cab21 |
95 | fRecPointsTitle = branchTitle ; |
d75bea67 |
96 | //fRecParticlesTitle = branchTitle ; |
97 | //fTrackSegmentsTitle = branchTitle ; |
ffa6d63b |
98 | |
99 | fPrimaries = new TObjArray(1) ; |
d75bea67 |
100 | |
9bd3caba |
101 | fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules")); |
102 | fPrimariesFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data")); |
103 | fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits")); |
104 | fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits")); |
105 | fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data")); |
106 | fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData")); |
d75bea67 |
107 | //fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA")); |
9bd3caba |
108 | fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ; |
ffa6d63b |
109 | |
28b243ad |
110 | fFailed = kFALSE ; |
57125971 |
111 | |
ffa6d63b |
112 | if ( fHeaderFile != "aliroot" ) { // to call the getter without a file |
113 | |
114 | //open headers file |
4dcdb968 |
115 | fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ; |
ed215ae7 |
116 | if(!fFile){ //if file was not opened yet, read gAlice |
4505bd46 |
117 | if ( fHeaderFile.Contains("_") ) { |
118 | cerr << "AliPHOSGetter::AliPHOSGetter -> Invalid file name (_ not allowed) " << fHeaderFile.Data() << endl ; |
119 | abort() ; |
120 | } |
ba298680 |
121 | fFile = TFile::Open(fHeaderFile.Data(),rw) ; |
ffa6d63b |
122 | |
4dcdb968 |
123 | if (!fFile->IsOpen()) { |
ffa6d63b |
124 | cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ; |
28b243ad |
125 | fFailed = kTRUE ; |
126 | return ; |
ffa6d63b |
127 | } |
12eac0c2 |
128 | gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ; |
ffa6d63b |
129 | } |
d75bea67 |
130 | } |
6c58180f |
131 | |
ffa6d63b |
132 | |
d75bea67 |
133 | if (!gAlice) { |
134 | cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ; |
28b243ad |
135 | fFailed = kTRUE ; |
136 | return ; |
d75bea67 |
137 | } |
138 | if (!EMCAL()) { |
139 | if (fDebug) |
140 | cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ; |
ba298680 |
141 | if (gAlice->GetDetector("EMCAL")) { |
142 | AliConfig * conf = AliConfig::Instance() ; |
143 | conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ; |
144 | conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ; |
145 | } |
146 | else |
147 | cerr << "ERROR: AliEMCALGetter -> detector EMCAL not found" << endl ; |
ffa6d63b |
148 | } |
d75bea67 |
149 | |
150 | fDebug=0; |
ffa6d63b |
151 | } |
152 | //____________________________________________________________________________ |
ba298680 |
153 | AliEMCALGetter::~AliEMCALGetter() |
154 | { |
ededcd8c |
155 | if (fPrimaries) { |
156 | fPrimaries->Delete() ; |
157 | delete fPrimaries ; |
158 | } |
d489fb96 |
159 | |
160 | TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ; |
161 | TCollection * folderslist = emcalF->GetListOfFolders() ; |
162 | TIter next(folderslist) ; |
163 | TFolder * folder = 0 ; |
164 | while ( (folder = static_cast<TFolder*>(next())) ) |
165 | emcalF->Remove(folder) ; |
166 | |
4dcdb968 |
167 | delete fFile ; |
ba298680 |
168 | fFile = 0 ; |
65549808 |
169 | |
170 | fgObjGetter = 0 ; |
171 | |
ffa6d63b |
172 | } |
173 | |
174 | //____________________________________________________________________________ |
175 | void AliEMCALGetter::CreateWhiteBoard() const |
176 | { |
177 | |
178 | } |
179 | |
65549808 |
180 | //____________________________________________________________________________ |
181 | void AliEMCALGetter::CloseFile() |
182 | { |
b134c32f |
183 | delete gAlice ; |
184 | gAlice = 0 ; |
9bd3caba |
185 | delete fAlice ; |
186 | fAlice = 0 ; |
65549808 |
187 | } |
188 | |
ffa6d63b |
189 | //____________________________________________________________________________ |
0c87da39 |
190 | const TFolder * AliEMCALGetter::Folder(const TString what) const { |
191 | |
192 | // returns the EMCAL folder required by what |
193 | // what = hits, sdigits, digits |
194 | |
195 | if ( what == "hits" ) |
196 | return dynamic_cast<const TFolder *>(fHitsFolder->FindObject("EMCAL")) ; |
197 | else if ( what == "sdigits" ) |
198 | return dynamic_cast<const TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ; |
199 | else if ( what == "digits" ) |
200 | return dynamic_cast<const TFolder *>(fDigitsFolder->FindObject("EMCAL")) ; |
201 | else { |
202 | cerr << "ERROR: AliEMCALGetter::GetFolder -> " << what.Data() << " illegal option (hits, sdigits, digits) " << endl ; |
203 | return 0 ; |
204 | } |
205 | } |
206 | //____________________________________________________________________________ |
ffa6d63b |
207 | AliEMCALGetter * AliEMCALGetter::GetInstance() |
208 | { |
209 | // Returns the pointer of the unique instance already defined |
210 | |
b134c32f |
211 | if ( fgObjGetter ) { |
212 | fFile->cd() ; |
213 | return fgObjGetter ; |
214 | } |
215 | else { |
216 | // cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ; |
217 | return 0 ; |
218 | } |
ffa6d63b |
219 | } |
220 | |
221 | //____________________________________________________________________________ |
222 | AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile, |
472319e5 |
223 | const char* branchTitle, const Option_t * rw) |
ffa6d63b |
224 | { |
225 | // Creates and returns the pointer of the unique instance |
226 | // Must be called only when the environment has changed |
227 | |
65549808 |
228 | if ( fgObjGetter && fFile->IsOpen()) // an instance exists and the file is still open |
ffa6d63b |
229 | if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) && |
52ea052c |
230 | (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0)) { |
52ea052c |
231 | fFile->cd() ; |
6c58180f |
232 | return fgObjGetter ; |
52ea052c |
233 | } |
65549808 |
234 | else // another file than the existing one is required, scratch the getter |
ededcd8c |
235 | fgObjGetter->~AliEMCALGetter() ; // delete it already exists another version |
6c58180f |
236 | |
472319e5 |
237 | fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ; |
d489fb96 |
238 | |
239 | if (fgObjGetter->HasFailed() ) |
240 | fgObjGetter = 0 ; |
ffa6d63b |
241 | |
1ed27eeb |
242 | fFile->cd() ; |
ffa6d63b |
243 | return fgObjGetter ; |
244 | |
245 | } |
246 | |
247 | //____________________________________________________________________________ |
d75bea67 |
248 | const AliEMCALv1 * AliEMCALGetter::EMCAL() |
ffa6d63b |
249 | { |
250 | // returns the EMCAL object |
d75bea67 |
251 | AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ; |
ffa6d63b |
252 | if (!emcal) |
d75bea67 |
253 | if (fDebug) |
ffa6d63b |
254 | cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ; |
255 | return emcal ; |
256 | } |
257 | |
258 | //____________________________________________________________________________ |
f07cab21 |
259 | AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() |
ffa6d63b |
260 | { |
261 | AliEMCALGeometry * rv = 0 ; |
262 | if (EMCAL() ) |
d75bea67 |
263 | rv = EMCAL()->GetGeometry() ; |
ffa6d63b |
264 | return rv ; |
265 | } |
266 | |
9bd3caba |
267 | //____________________________________________________________________________ |
268 | Bool_t AliEMCALGetter::PostPrimaries(void) const |
269 | { //------- Primaries ---------------------- |
270 | |
271 | // the hierarchy is //Folders/RunMC/Event/Data/Primaries |
272 | |
273 | TFolder * primariesFolder = dynamic_cast<TFolder*>(fPrimariesFolder->FindObject("Primaries")) ; |
274 | if ( !primariesFolder ) { |
275 | if (fDebug) { |
276 | cout << "WARNING: AliEMCALGetter::Post Primaries -> Folder //" << fPrimariesFolder->GetName() << "/Primaries/ not found!" << endl; |
277 | cout << "INFO: AliEMCALGetter::Post Primaries -> Adding Folder //" << fPrimariesFolder->GetName() << "/Primaries/" << endl; |
278 | } |
279 | primariesFolder = fPrimariesFolder->AddFolder("Primaries", "Primaries particles from TreeK") ; |
280 | } |
281 | TClonesArray *primaries= new TClonesArray("TParticle",1000) ; |
282 | primaries->SetName("Primaries") ; |
283 | primariesFolder->Add(primaries) ; |
284 | |
285 | return kTRUE; |
286 | } |
287 | |
288 | //____________________________________________________________________________ |
289 | TObject** AliEMCALGetter::PrimariesRef(void) const |
290 | { //------- Primaries ---------------------- |
291 | |
292 | |
293 | // the hierarchy is //Folders/RunMC/Event/Data/Primaries |
294 | if ( !fPrimariesFolder ) { |
295 | cerr << "ERROR: AliEMCALGetter::PrimariesRef -> Folder //" << fPrimariesFolder << " not found!" << endl; |
296 | abort() ; |
297 | } |
298 | |
299 | TFolder * primariesFolder = dynamic_cast<TFolder *>(fPrimariesFolder->FindObject("Primaries")) ; |
300 | if ( !primariesFolder ) { |
301 | cerr << "ERROR: AliEMCALGetter::PrimariesRef -> Folder //" << fPrimariesFolder << "/Primaries/ not found!" << endl; |
302 | abort() ; |
303 | } |
304 | |
305 | TObject * p = primariesFolder->FindObject("Primaries") ; |
306 | if(!p) { |
307 | cerr << "ERROR: AliEMCALGetter::PrimariesRef -> " << primariesFolder->GetName() << "/Primaries not found !" << endl ; |
308 | abort() ; |
309 | } |
310 | else |
311 | return primariesFolder->GetListOfFolders()->GetObjectRef(p) ; |
312 | } |
313 | |
ffa6d63b |
314 | //____________________________________________________________________________ |
315 | Bool_t AliEMCALGetter::PostHits(void) const |
316 | { //------- Hits ---------------------- |
317 | |
318 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits |
319 | |
320 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ; |
321 | if ( !emcalFolder ) { |
d75bea67 |
322 | if (fDebug) { |
ffa6d63b |
323 | cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl; |
324 | cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl; |
d75bea67 |
325 | } |
ffa6d63b |
326 | emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ; |
327 | } |
328 | TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ; |
329 | hits->SetName("Hits") ; |
330 | emcalFolder->Add(hits) ; |
331 | |
332 | return kTRUE; |
333 | } |
334 | |
335 | //____________________________________________________________________________ |
472319e5 |
336 | TObject ** AliEMCALGetter::HitsRef(void) const |
ffa6d63b |
337 | { //------- Hits ---------------------- |
338 | |
339 | |
340 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits |
341 | if ( !fHitsFolder ) { |
342 | cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl; |
343 | return 0; |
344 | } |
345 | |
346 | TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ; |
347 | if ( !emcalFolder ) { |
348 | cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl; |
349 | return 0; |
350 | } |
351 | |
352 | TObject * h = emcalFolder->FindObject("Hits") ; |
353 | if(!h) { |
354 | cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ; |
355 | return 0 ; |
356 | } |
357 | else |
472319e5 |
358 | return emcalFolder->GetListOfFolders()->GetObjectRef(h) ; |
ffa6d63b |
359 | } |
360 | |
361 | //____________________________________________________________________________ |
362 | Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const |
363 | { //---------- SDigits ------------------------- |
364 | |
365 | |
366 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname |
367 | // because you can have sdigits from several hit files for mixing |
368 | |
369 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; |
370 | if ( !emcalFolder ) { |
d75bea67 |
371 | if (fDebug) { |
ffa6d63b |
372 | cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl; |
373 | cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl; |
d75bea67 |
374 | } |
ffa6d63b |
375 | emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; |
376 | } |
377 | TString subdir(headerFile) ; |
35014875 |
378 | subdir.ReplaceAll("/", "_") ; |
ffa6d63b |
379 | TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ; |
380 | if ( !emcalSubFolder ) |
381 | emcalSubFolder = emcalFolder->AddFolder(subdir, ""); |
382 | |
383 | TObject * sd = emcalSubFolder->FindObject(name); |
384 | if ( sd ) { |
d75bea67 |
385 | if (fDebug) |
ffa6d63b |
386 | cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir |
387 | << " already exists!" << endl ; |
388 | }else{ |
d75bea67 |
389 | TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ; |
ffa6d63b |
390 | sdigits->SetName(name) ; |
391 | emcalSubFolder->Add(sdigits) ; |
392 | } |
393 | |
394 | return kTRUE; |
395 | } |
396 | //____________________________________________________________________________ |
472319e5 |
397 | TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const |
ffa6d63b |
398 | { //------- SDigits ---------------------- |
399 | |
400 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits |
401 | |
402 | if ( !fSDigitsFolder ) { |
403 | cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl; |
404 | return 0; |
405 | } |
406 | |
407 | TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ; |
408 | if ( !emcalFolder ) { |
409 | cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl; |
410 | return 0; |
411 | } |
412 | |
413 | TFolder * emcalSubFolder = 0 ; |
414 | if(file) |
415 | emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ; |
416 | else |
417 | emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ; |
418 | |
419 | if(!emcalSubFolder) { |
420 | cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl; |
421 | return 0; |
422 | } |
423 | |
424 | TObject * dis = emcalSubFolder->FindObject(name) ; |
425 | if(!dis) |
426 | return 0 ; |
427 | else |
472319e5 |
428 | return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ; |
ffa6d63b |
429 | |
430 | } |
431 | |
432 | //____________________________________________________________________________ |
433 | Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const |
434 | { //---------- SDigitizer ------------------------- |
435 | |
436 | // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname |
437 | |
438 | |
439 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; |
440 | |
441 | if ( !sd ) { |
442 | cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; |
443 | return kFALSE ; |
444 | } |
445 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; |
446 | if ( !emcal ) { |
d75bea67 |
447 | if (fDebug) { |
ffa6d63b |
448 | cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl; |
449 | cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl; |
d75bea67 |
450 | } |
ffa6d63b |
451 | emcal = new TTask("EMCAL", "") ; |
452 | sd->Add(emcal) ; |
453 | } |
454 | AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() )); |
455 | if (emcalsd) { |
d75bea67 |
456 | if (fDebug) |
ffa6d63b |
457 | cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ; |
458 | emcal->GetListOfTasks()->Remove(emcalsd) ; |
459 | } |
460 | emcal->Add(sdigitizer) ; |
461 | return kTRUE; |
462 | |
463 | } |
464 | |
465 | //____________________________________________________________________________ |
472319e5 |
466 | TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const |
ffa6d63b |
467 | { |
468 | |
469 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; |
470 | if ( !sd ) { |
471 | cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; |
472 | abort(); |
473 | } |
474 | |
475 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; |
476 | if ( !emcal ) { |
477 | cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl; |
478 | abort(); |
479 | } |
480 | |
481 | TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ; |
482 | |
472319e5 |
483 | return emcal->GetListOfTasks()->GetObjectRef(task) ; |
ffa6d63b |
484 | |
485 | } |
486 | |
487 | //____________________________________________________________________________ |
488 | Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const |
489 | { //---------- SDigitizer ------------------------- |
490 | |
491 | // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname |
492 | |
493 | |
494 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; |
495 | if ( !sd ) { |
496 | cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; |
497 | return kFALSE ; |
498 | } |
499 | |
500 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; |
501 | if ( !emcal ) { |
d75bea67 |
502 | if (fDebug) { |
ffa6d63b |
503 | cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl; |
504 | cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl; |
d75bea67 |
505 | } |
ffa6d63b |
506 | emcal = new TTask("EMCAL", "") ; |
507 | sd->Add(emcal) ; |
508 | } |
509 | |
510 | TString sdname(name) ; |
511 | sdname.Append(":") ; |
512 | sdname.Append(file); |
54b82aa4 |
513 | sdname.ReplaceAll("/","_") ; |
ffa6d63b |
514 | AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname )); |
515 | if (!emcalsd) { |
516 | emcalsd = new AliEMCALSDigitizer() ; |
6c58180f |
517 | //Note, we can not call constructor with parameters: it will call Getter and screw up everething |
ffa6d63b |
518 | emcalsd->SetName(sdname) ; |
519 | emcalsd->SetTitle(file) ; |
520 | emcal->Add(emcalsd) ; |
521 | } |
522 | return kTRUE; |
523 | |
524 | } |
525 | |
526 | //____________________________________________________________________________ |
527 | Bool_t AliEMCALGetter::PostDigits(const char * name) const |
528 | { //---------- Digits ------------------------- |
529 | |
530 | // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name |
531 | |
532 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ; |
533 | |
534 | if ( !emcalFolder ) { |
d75bea67 |
535 | if (fDebug) { |
ffa6d63b |
536 | cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl; |
537 | cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl; |
d75bea67 |
538 | } |
ffa6d63b |
539 | emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ; |
540 | } |
541 | |
542 | TObject* dig = emcalFolder->FindObject( name ) ; |
543 | if ( !dig ) { |
544 | TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ; |
545 | digits->SetName(name) ; |
546 | emcalFolder->Add(digits) ; |
547 | } |
548 | return kTRUE; |
549 | } |
550 | |
551 | //____________________________________________________________________________ |
472319e5 |
552 | TObject ** AliEMCALGetter::DigitsRef(const char * name) const |
ffa6d63b |
553 | { //------- Digits ---------------------- |
554 | |
555 | // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name |
556 | |
557 | if ( !fDigitsFolder ) { |
558 | cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl; |
559 | return 0; |
560 | } |
561 | |
562 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ; |
563 | if ( !emcalFolder ) { |
564 | cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl; |
565 | return 0; |
566 | } |
567 | |
568 | TObject * d = emcalFolder->FindObject(name) ; |
569 | if(!d) |
570 | return 0 ; |
571 | else |
472319e5 |
572 | return emcalFolder->GetListOfFolders()->GetObjectRef(d) ; |
ffa6d63b |
573 | |
574 | } |
575 | |
576 | //____________________________________________________________________________ |
577 | Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const |
578 | { //---------- Digitizer ------------------------- |
579 | |
580 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; |
581 | |
582 | if ( !sd ) { |
583 | cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl; |
584 | return kFALSE ; |
585 | } |
586 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; |
587 | if ( !emcal ) { |
d75bea67 |
588 | if (fDebug) { |
ffa6d63b |
589 | cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl; |
590 | cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl; |
d75bea67 |
591 | } |
ffa6d63b |
592 | emcal = new TTask("EMCAL", "") ; |
593 | sd->Add(emcal) ; |
594 | } |
595 | |
596 | AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ; |
597 | if (emcald) { |
598 | emcald->Delete() ; |
599 | emcal->GetListOfTasks()->Remove(emcald) ; |
600 | } |
601 | emcal->Add(digitizer) ; |
602 | return kTRUE; |
603 | } |
604 | |
605 | //____________________________________________________________________________ |
606 | Bool_t AliEMCALGetter::PostDigitizer(const char * name) const |
607 | { //---------- Digitizer ------------------------- |
608 | |
609 | // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname |
610 | |
611 | TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; |
612 | if ( !d ) { |
613 | cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl; |
614 | return kFALSE ; |
615 | } |
616 | |
617 | TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ; |
618 | if ( !emcal ) { |
d75bea67 |
619 | if (fDebug) { |
ffa6d63b |
620 | cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl; |
621 | cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl; |
d75bea67 |
622 | } |
ffa6d63b |
623 | emcal = new TTask("EMCAL", "") ; |
624 | d->Add(emcal) ; |
625 | } |
626 | |
627 | AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ; |
628 | if (!emcald) { |
629 | emcald = new AliEMCALDigitizer() ; |
630 | emcald->SetName(fDigitsTitle) ; |
631 | emcald->SetTitle(fHeaderFile) ; |
632 | emcal->Add(emcald) ; |
633 | } |
634 | return kTRUE; |
635 | } |
636 | |
637 | //____________________________________________________________________________ |
472319e5 |
638 | TObject ** AliEMCALGetter::DigitizerRef(const char * name) const |
ffa6d63b |
639 | { |
640 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; |
641 | if ( !sd ) { |
92f521a9 |
642 | cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder->GetName() << "/Digitizer not found!" << endl; |
ffa6d63b |
643 | abort(); |
644 | } |
645 | |
646 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; |
647 | if ( !emcal ) { |
92f521a9 |
648 | cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder->GetName() << "/Digitizer/EMCAL" << endl; |
ffa6d63b |
649 | abort(); |
650 | } |
651 | |
652 | TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ; |
653 | |
472319e5 |
654 | return emcal->GetListOfTasks()->GetObjectRef(task) ; |
ffa6d63b |
655 | |
656 | } |
657 | |
d75bea67 |
658 | //____________________________________________________________________________ |
d75bea67 |
659 | Bool_t AliEMCALGetter::PostRecPoints(const char * name) const |
660 | { // -------------- RecPoints ------------------------------------------- |
661 | |
f07cab21 |
662 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name |
663 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name |
d75bea67 |
664 | |
665 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ; |
666 | |
667 | if ( !emcalFolder ) { |
668 | if (fDebug) { |
669 | cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; |
670 | cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl; |
671 | } |
672 | emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; |
673 | } |
674 | |
f07cab21 |
675 | // Tower RecPoints |
676 | TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ; |
677 | if ( !emcalRPoTowerFolder ) { |
d75bea67 |
678 | if (fDebug) { |
f07cab21 |
679 | cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl; |
680 | cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl; |
d75bea67 |
681 | } |
f07cab21 |
682 | emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ; |
d75bea67 |
683 | } |
684 | |
685 | TObject * erp = emcalFolder->FindObject( name ) ; |
686 | if ( !erp ) { |
f07cab21 |
687 | TObjArray * towerrp = new TObjArray(100) ; |
688 | towerrp->SetName(name) ; |
689 | emcalRPoTowerFolder->Add(towerrp) ; |
d75bea67 |
690 | } |
691 | |
f07cab21 |
692 | // Pre Shower RecPoints |
693 | TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ; |
694 | if ( !emcalRPoPreShoFolder ) { |
d75bea67 |
695 | if (fDebug) { |
f07cab21 |
696 | cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl; |
697 | cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl; |
d75bea67 |
698 | } |
f07cab21 |
699 | emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ; |
d75bea67 |
700 | } |
701 | |
f07cab21 |
702 | TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ; |
d75bea67 |
703 | if ( !crp ) { |
f07cab21 |
704 | TObjArray * preshorp = new TObjArray(100) ; |
705 | preshorp->SetName(name) ; |
706 | emcalRPoPreShoFolder->Add(preshorp) ; |
d75bea67 |
707 | } |
708 | return kTRUE; |
709 | } |
710 | |
711 | //____________________________________________________________________________ |
f07cab21 |
712 | TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const |
d75bea67 |
713 | { // -------------- RecPoints ------------------------------------------- |
714 | |
f07cab21 |
715 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name |
d75bea67 |
716 | |
717 | if ( !fRecoFolder ) { |
f07cab21 |
718 | cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl; |
52ea052c |
719 | abort() ; |
d75bea67 |
720 | } |
721 | |
f07cab21 |
722 | TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; |
723 | if ( !towerFolder ) { |
724 | cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl; |
52ea052c |
725 | abort() ; |
d75bea67 |
726 | } |
727 | |
728 | |
f07cab21 |
729 | TObject * trp = towerFolder->FindObject(name ) ; |
730 | if ( !trp ) { |
52ea052c |
731 | cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Object " << name << " not found!" << endl ; |
732 | abort() ; |
d75bea67 |
733 | } |
f07cab21 |
734 | return towerFolder->GetListOfFolders()->GetObjectRef(trp) ; |
d75bea67 |
735 | |
736 | } |
737 | |
738 | //____________________________________________________________________________ |
f07cab21 |
739 | TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const |
d75bea67 |
740 | { // -------------- RecPoints ------------------------------------------- |
741 | |
f07cab21 |
742 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name |
d75bea67 |
743 | |
744 | if ( !fRecoFolder ) { |
f07cab21 |
745 | cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl; |
52ea052c |
746 | abort() ; |
d75bea67 |
747 | } |
748 | |
f07cab21 |
749 | TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ; |
750 | if ( !preshoFolder ) { |
751 | cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl; |
52ea052c |
752 | abort() ; |
d75bea67 |
753 | } |
754 | |
f07cab21 |
755 | TObject * prp = preshoFolder->FindObject(name ) ; |
756 | if ( !prp ) { |
52ea052c |
757 | cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Object " << name << " not found! " << endl ; |
758 | abort() ; |
d75bea67 |
759 | } |
f07cab21 |
760 | return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ; |
d75bea67 |
761 | |
762 | } |
763 | |
764 | //____________________________________________________________________________ |
ea4de7a2 |
765 | Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const |
d75bea67 |
766 | { // ------------------ AliEMCALClusterizer ------------------------ |
767 | |
768 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname |
769 | |
770 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; |
771 | |
772 | if ( !tasks ) { |
773 | cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; |
774 | return kFALSE ; |
775 | } |
776 | |
777 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; |
778 | if ( !emcal ) { |
779 | if (fDebug) { |
780 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl; |
781 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; |
782 | } |
783 | emcal = new TTask("EMCAL", "") ; |
784 | tasks->Add(emcal) ; |
785 | } |
786 | |
ea4de7a2 |
787 | AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ; |
d75bea67 |
788 | if (emcalcl) { |
789 | if (fDebug) |
790 | cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ; |
791 | emcalcl->Delete() ; |
792 | emcal->GetListOfTasks()->Remove(emcalcl) ; |
793 | } |
794 | emcal->Add(clu) ; |
795 | return kTRUE; |
796 | } |
797 | |
798 | //____________________________________________________________________________ |
472319e5 |
799 | TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const |
d75bea67 |
800 | { // ------------------ AliEMCALClusterizer ------------------------ |
801 | |
802 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; |
803 | |
804 | if ( !tasks ) { |
92f521a9 |
805 | cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
52ea052c |
806 | abort() ; |
d75bea67 |
807 | } |
808 | |
809 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; |
810 | if ( !emcal ) { |
92f521a9 |
811 | cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl; |
52ea052c |
812 | abort() ; |
d75bea67 |
813 | } |
814 | |
815 | TList * l = emcal->GetListOfTasks() ; |
816 | TIter it(l) ; |
817 | TTask * task ; |
818 | TTask * clu = 0 ; |
819 | TString cluname(name) ; |
820 | cluname+=":clu-" ; |
821 | while((task = static_cast<TTask *>(it.Next()) )){ |
822 | TString taskname(task->GetName()) ; |
823 | if(taskname.BeginsWith(cluname)){ |
824 | clu = task ; |
825 | break ; |
826 | } |
827 | } |
828 | |
829 | if(clu) |
472319e5 |
830 | return l->GetObjectRef(clu) ; |
52ea052c |
831 | else { |
832 | cerr << "ERROR: AliEMCALGetter::Post RerRef -> task " << task->GetName() << " not found! " << endl ; |
833 | abort() ; |
834 | } |
d75bea67 |
835 | } |
836 | |
837 | //____________________________________________________________________________ |
838 | Bool_t AliEMCALGetter::PostClusterizer(const char * name) const |
839 | { // ------------------ AliEMCALClusterizer ------------------------ |
840 | |
841 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname |
842 | |
843 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; |
844 | |
845 | if ( !tasks ) { |
92f521a9 |
846 | cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
d75bea67 |
847 | return kFALSE ; |
848 | } |
849 | |
850 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; |
851 | if ( !emcal ) { |
852 | if (fDebug) { |
853 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; |
854 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; |
855 | } |
856 | emcal = new TTask("EMCAL", "") ; |
857 | tasks->Add(emcal) ; |
858 | } |
859 | |
b134c32f |
860 | TList * l = emcal->GetListOfTasks() ; |
861 | TIter it(l) ; |
d75bea67 |
862 | TString clun(name) ; |
b134c32f |
863 | clun+=":clu" ; |
864 | TTask * task ; |
865 | while((task = static_cast<TTask *>(it.Next()) )){ |
866 | TString taskname(task->GetName()) ; |
867 | if(taskname.BeginsWith(clun)) |
868 | return kTRUE ; |
869 | } |
870 | |
871 | AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ; |
d75bea67 |
872 | emcal->Add(emcalcl) ; |
873 | return kTRUE; |
874 | |
875 | } |
876 | |
877 | //____________________________________________________________________________ |
f07cab21 |
878 | /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const |
d75bea67 |
879 | { // ---------------TrackSegments ----------------------------------- |
880 | |
881 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name |
882 | |
883 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ; |
884 | |
885 | if ( !emcalFolder ) { |
886 | if (fDebug) { |
887 | cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; |
888 | cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl; |
889 | } |
890 | emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; |
891 | } |
892 | |
893 | TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ; |
894 | if ( !emcalTSFolder ) { |
895 | if (fDebug) { |
896 | cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl; |
897 | cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl; |
898 | } |
899 | emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ; |
900 | } |
901 | |
902 | TObject * tss = emcalTSFolder->FindObject( name ) ; |
903 | if (!tss) { |
904 | TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ; |
905 | ts->SetName(name) ; |
906 | emcalTSFolder->Add(ts) ; |
907 | } |
908 | return kTRUE; |
909 | } |
910 | |
911 | //____________________________________________________________________________ |
472319e5 |
912 | TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const |
d75bea67 |
913 | { // ---------------TrackSegments ----------------------------------- |
914 | |
915 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name |
916 | |
917 | if ( !fRecoFolder ) { |
918 | cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl; |
52ea052c |
919 | abort() ; |
d75bea67 |
920 | } |
921 | |
922 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; |
923 | if ( !emcalFolder ) { |
924 | cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl; |
52ea052c |
925 | abort(); |
d75bea67 |
926 | } |
927 | |
928 | TObject * tss = emcalFolder->FindObject(name) ; |
929 | if (!tss) { |
52ea052c |
930 | cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> object " << name << " not found! " << endl ; |
931 | abort() ; |
d75bea67 |
932 | } |
472319e5 |
933 | return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ; |
d75bea67 |
934 | } |
935 | |
936 | //____________________________________________________________________________ |
937 | Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const |
938 | { //------------Track Segment Maker ------------------------------ |
939 | |
940 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname |
941 | |
942 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; |
943 | |
944 | if ( !tasks ) { |
945 | cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; |
946 | return kFALSE ; |
947 | } |
948 | |
949 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; |
950 | if ( !emcal ) { |
951 | if (fDebug) { |
952 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; |
953 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; |
954 | } |
955 | emcal = new TTask("EMCAL", "") ; |
956 | tasks->Add(emcal) ; |
957 | } |
958 | |
959 | AliEMCALTrackSegmentMaker * emcalts = |
960 | dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ; |
961 | if (emcalts) { |
962 | emcalts->Delete() ; |
963 | emcal->GetListOfTasks()->Remove(emcalts) ; |
964 | } |
965 | emcal->Add(tsmaker) ; |
966 | return kTRUE; |
967 | |
968 | } |
969 | //____________________________________________________________________________ |
970 | Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const |
971 | { //------------Track Segment Maker ------------------------------ |
972 | |
973 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname |
974 | |
975 | |
976 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; |
977 | |
978 | if ( !tasks ) { |
979 | cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; |
980 | return kFALSE ; |
981 | } |
982 | |
983 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; |
984 | if ( !emcal ) { |
985 | if (fDebug) { |
986 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; |
92f521a9 |
987 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl; |
d75bea67 |
988 | } |
989 | emcal = new TTask("EMCAL", "") ; |
990 | tasks->Add(emcal) ; |
991 | } |
992 | |
993 | AliEMCALTrackSegmentMaker * emcalts = |
994 | dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ; |
995 | if (!emcalts) { |
996 | emcalts = new AliEMCALTrackSegmentMakerv1() ; |
997 | TString tsn(name); |
998 | tsn+=":tsm-v1" ; |
999 | emcalts->SetName(tsn) ; |
1000 | emcal->Add(emcalts) ; |
1001 | } |
1002 | return kTRUE; |
1003 | |
1004 | } |
1005 | |
1006 | //____________________________________________________________________________ |
472319e5 |
1007 | TObject ** AliEMCALGetter::TSMakerRef(const char * name) const |
d75bea67 |
1008 | { //------------Track Segment Maker ------------------------------ |
1009 | |
1010 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; |
1011 | |
1012 | if ( !tasks ) { |
92f521a9 |
1013 | cerr << "ERROR: AliEMCALGetter::TSLakerRef TerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
52ea052c |
1014 | abort() ; |
d75bea67 |
1015 | } |
1016 | |
1017 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; |
1018 | if ( !emcal ) { |
92f521a9 |
1019 | cerr <<"WARNING: AliEMCALGetter::TSMakerRef TerRef -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl; |
52ea052c |
1020 | abort() ; |
d75bea67 |
1021 | } |
1022 | |
1023 | TList * l = emcal->GetListOfTasks() ; |
1024 | TIter it(l) ; |
1025 | TTask * task ; |
1026 | TTask * tsm = 0 ; |
1027 | TString tsmname(name) ; |
1028 | tsmname+=":tsm-" ; |
1029 | while((task = static_cast<TTask *>(it.Next()) )){ |
1030 | TString taskname(task->GetName()) ; |
1031 | if(taskname.BeginsWith(tsmname)){ |
1032 | tsm = task ; |
1033 | break ; |
1034 | } |
1035 | } |
1036 | |
1037 | if(tsm) |
472319e5 |
1038 | return l->GetObjectRef(tsm) ; |
52ea052c |
1039 | else { |
1040 | cerr << "ERROR: AliEMCALGetter::TSLakerRef -> task " << task->GetName() << " not found! " << endl ; |
1041 | abort() ; |
1042 | } |
d75bea67 |
1043 | } |
1044 | |
1045 | //____________________________________________________________________________ |
1046 | Bool_t AliEMCALGetter::PostRecParticles(const char * name) const |
1047 | { // -------------------- RecParticles ------------------------ |
1048 | |
1049 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name |
1050 | |
1051 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ; |
1052 | |
1053 | if ( !emcalFolder ) { |
1054 | if (fDebug) { |
1055 | cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; |
1056 | cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl; |
1057 | } |
1058 | emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; |
1059 | } |
1060 | |
1061 | TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ; |
1062 | if ( !emcalRPaFolder ) { |
1063 | if (fDebug) { |
1064 | cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl; |
1065 | cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl; |
1066 | } |
1067 | emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ; |
1068 | } |
1069 | |
1070 | TObject * rps = emcalRPaFolder->FindObject( name ) ; |
1071 | if ( !rps ) { |
1072 | TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ; |
1073 | rp->SetName(name) ; |
1074 | emcalRPaFolder->Add(rp) ; |
1075 | } |
1076 | return kTRUE; |
1077 | } |
1078 | |
1079 | //____________________________________________________________________________ |
472319e5 |
1080 | TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const |
d75bea67 |
1081 | { // ---------------TrackSegments ----------------------------------- |
1082 | |
1083 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name |
1084 | |
1085 | if ( !fRecoFolder ) { |
1086 | cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl; |
52ea052c |
1087 | abort() ; |
d75bea67 |
1088 | } |
1089 | |
1090 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ; |
1091 | if ( !emcalFolder ) { |
1092 | cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl; |
52ea052c |
1093 | abort() ; |
d75bea67 |
1094 | } |
1095 | |
52ea052c |
1096 | TObject * tss = emcalFolder->FindObject(name) ; |
d75bea67 |
1097 | if (!tss) { |
52ea052c |
1098 | cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> object " << name << " not found! " << endl ; |
1099 | abort() ; |
d75bea67 |
1100 | } |
472319e5 |
1101 | return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ; |
d75bea67 |
1102 | } |
1103 | |
1104 | //____________________________________________________________________________ |
1105 | Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const |
1106 | { // ------------AliEMCAL PID ----------------------------- |
1107 | |
1108 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; |
1109 | |
1110 | if ( !tasks ) { |
92f521a9 |
1111 | cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
d75bea67 |
1112 | return kFALSE ; |
1113 | } |
1114 | |
1115 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; |
1116 | if ( !emcal ) { |
1117 | if (fDebug) { |
92f521a9 |
1118 | cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl; |
1119 | cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl; |
d75bea67 |
1120 | } |
1121 | emcal = new TTask("EMCAL", "") ; |
1122 | tasks->Add(emcal) ; |
1123 | } |
1124 | |
1125 | AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ; |
1126 | if (emcalpid) { |
1127 | if (fDebug) |
1128 | cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName() |
1129 | << " already exists" << endl ; |
1130 | emcal->GetListOfTasks()->Remove(emcalpid) ; |
1131 | } |
1132 | |
1133 | emcal->Add(pid) ; |
1134 | return kTRUE; |
1135 | } |
1136 | |
1137 | //____________________________________________________________________________ |
1138 | Bool_t AliEMCALGetter::PostPID(const char * name) const |
1139 | { |
1140 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname |
1141 | |
1142 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; |
1143 | |
1144 | if ( !tasks ) { |
92f521a9 |
1145 | cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
d75bea67 |
1146 | return kFALSE ; |
1147 | } |
1148 | |
1149 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; |
1150 | if ( !emcal ) { |
1151 | if (fDebug) { |
92f521a9 |
1152 | cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl; |
1153 | cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl; |
d75bea67 |
1154 | } |
1155 | emcal = new TTask("EMCAL", "") ; |
1156 | tasks->Add(emcal) ; |
1157 | } |
1158 | |
1159 | TList * l = emcal->GetListOfTasks() ; |
1160 | TIter it(l) ; |
1161 | TString pidname(name) ; |
1162 | pidname+=":pid" ; |
1163 | TTask * task ; |
1164 | while((task = static_cast<TTask *>(it.Next()) )){ |
1165 | TString taskname(task->GetName()) ; |
1166 | if(taskname.BeginsWith(pidname)) |
1167 | return kTRUE ; |
1168 | } |
1169 | |
1170 | AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ; |
1171 | pidname+="-v1" ; |
1172 | emcalpid->SetName(pidname) ; |
1173 | emcal->Add(emcalpid) ; |
1174 | |
1175 | return kTRUE; |
1176 | } |
1177 | |
1178 | //____________________________________________________________________________ |
472319e5 |
1179 | TObject ** AliEMCALGetter::PIDRef(const char * name) const |
d75bea67 |
1180 | { //------------PID ------------------------------ |
1181 | |
1182 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; |
1183 | |
1184 | if ( !tasks ) { |
92f521a9 |
1185 | cerr << "ERROR: AliEMCALGetter::PIDRef PerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl; |
52ea052c |
1186 | abort() ; |
d75bea67 |
1187 | } |
1188 | |
1189 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; |
1190 | if ( !emcal ) { |
92f521a9 |
1191 | cerr <<"WARNING: AliEMCALGetter::PIDRef PerRef -> //" << fTasksFolder->GetName() << "/ReconstructionerEMCAL not found!" << endl; |
52ea052c |
1192 | abort() ; |
d75bea67 |
1193 | } |
1194 | |
1195 | TList * l = emcal->GetListOfTasks() ; |
1196 | TIter it(l) ; |
1197 | TTask * task ; |
1198 | TTask * pid = 0 ; |
1199 | TString pidname(name) ; |
1200 | pidname+=":pid-" ; |
1201 | while((task = static_cast<TTask *>(it.Next()) )){ |
1202 | TString taskname(task->GetName()) ; |
1203 | if(taskname.BeginsWith(pidname)){ |
1204 | pid = task ; |
1205 | break ; |
1206 | } |
1207 | } |
1208 | |
1209 | if(pid) |
472319e5 |
1210 | return l->GetObjectRef(pid) ; |
52ea052c |
1211 | else { |
1212 | cerr << "ERROR: AliEMCALGetter::PIDRef -> task " << task->GetName() << " not found! " << endl ; |
1213 | abort() ; |
1214 | } |
d75bea67 |
1215 | } |
1216 | |
1217 | //____________________________________________________________________________ |
1218 | Bool_t AliEMCALGetter::PostQA(void) const |
1219 | { // ------------------ QA --------------------------------- |
1220 | |
1221 | // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName |
1222 | |
1223 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ; |
1224 | if ( !emcalFolder ) { |
1225 | if (fDebug) { |
1226 | cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl; |
1227 | cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl; |
1228 | } |
1229 | emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ; |
1230 | } |
1231 | |
1232 | return kTRUE; |
1233 | } |
1234 | |
1235 | //____________________________________________________________________________ |
472319e5 |
1236 | TObject ** AliEMCALGetter::AlarmsRef(void) const |
d75bea67 |
1237 | { //------- Alarms ---------------------- |
1238 | |
1239 | |
1240 | // the hierarchy is //Folders/Run/Conditions/QA/EMCAL |
1241 | if ( !fQAFolder ) { |
52ea052c |
1242 | cerr << "ERROR: AliEMCALGetter::AlarmsRef QRef -> Folder //" << fQAFolder << " not found!" << endl; |
1243 | abort() ; |
d75bea67 |
1244 | } |
1245 | |
1246 | TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ; |
1247 | if ( !emcalFolder ) { |
52ea052c |
1248 | cerr << "ERROR: AliEMCALGetter::AlarmsRef QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl; |
1249 | abort() ; |
d75bea67 |
1250 | } |
1251 | |
472319e5 |
1252 | return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ; |
d75bea67 |
1253 | } |
1254 | */ |
ffa6d63b |
1255 | //____________________________________________________________________________ |
1256 | const TParticle * AliEMCALGetter::Primary(Int_t index) const |
1257 | { |
1258 | // Return primary particle numbered by <index> |
f07cab21 |
1259 | |
ffa6d63b |
1260 | if(index < 0) |
1261 | return 0 ; |
9bd3caba |
1262 | TParticle * p = 0 ; |
1263 | if (fAlice) |
1264 | p = fAlice->Particle(index) ; |
1265 | else |
1266 | p = gAlice->Particle(index) ; |
1267 | // if (p->GetFirstMother() != -1 ) { |
1268 | // cout << "AliEMCALGetter::Primary : Not a primary " << endl ; |
1269 | // } |
1270 | |
1271 | return p ; |
1272 | |
ffa6d63b |
1273 | } |
1274 | |
1275 | //____________________________________________________________________________ |
1276 | void AliEMCALGetter::ReadTreeD() |
1277 | { |
1278 | // Read the digit tree gAlice->TreeD() |
9bd3caba |
1279 | |
1280 | TTree * treeD = gAlice->TreeD() ; |
d75bea67 |
1281 | |
9bd3caba |
1282 | if(!treeD) { // TreeD not found in header file |
1283 | |
1284 | if (fDebug) |
1285 | cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find TreeD in " << fHeaderFile << endl ; |
1286 | |
1287 | TString searchFileName("") ; |
1288 | |
1289 | if (Digitizer()) // Digitizer found in header file |
1290 | searchFileName = Digitizer()->GetTitle() ; |
1291 | |
1292 | else if (Clusterizer()) // Clusterizer found in header file |
1293 | searchFileName = Clusterizer()->GetDigitsFileName() ; |
1294 | |
1295 | if (treeD = TreeD(searchFileName)) { //found TreeD in the file which contains the hits |
1296 | if (fDebug) |
1297 | cout << "INFO: AliEMCALGetter::ReadTreeD -> TreeD found in " << searchFileName.Data() << endl ; |
1298 | |
1299 | } else { |
1300 | cerr << "ERROR: AliEMCALGetter::ReadTreeD -> TreeD not found " << endl ; |
1301 | return ; |
1302 | } |
1303 | } |
ffa6d63b |
1304 | TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ; |
1305 | TIter next(lob) ; |
1306 | TBranch * branch = 0 ; |
1307 | TBranch * digitsbranch = 0 ; |
1308 | TBranch * digitizerbranch = 0 ; |
1309 | Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ; |
1310 | |
1311 | while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) { |
1312 | if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { |
1313 | digitsbranch = branch ; |
1314 | emcalfound = kTRUE ; |
1315 | } |
1316 | else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { |
1317 | digitizerbranch = branch ; |
1318 | digitizerfound = kTRUE ; |
1319 | } |
1320 | } |
1321 | |
1322 | if ( !emcalfound || !digitizerfound ) { |
d75bea67 |
1323 | if (fDebug) |
ffa6d63b |
1324 | cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name " |
1325 | << fDigitsTitle << endl ; |
1326 | return ; |
1327 | } |
1328 | |
1329 | //read digits |
1330 | if(!Digits(fDigitsTitle) ) |
1331 | PostDigits(fDigitsTitle); |
1332 | digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ; |
1333 | digitsbranch->GetEntry(0) ; |
1334 | |
1335 | |
1336 | // read the Digitizer |
1337 | if(!Digitizer(fDigitsTitle)) |
1338 | PostDigitizer(fDigitsTitle) ; |
b134c32f |
1339 | |
92f521a9 |
1340 | digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ; |
1341 | digitizerbranch->GetEntry(0) ; |
ffa6d63b |
1342 | |
1343 | |
1344 | } |
1345 | |
1346 | //____________________________________________________________________________ |
1347 | void AliEMCALGetter::ReadTreeH() |
1348 | { |
1349 | // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() |
1350 | |
9bd3caba |
1351 | TTree * treeH = gAlice->TreeH() ; |
1352 | |
1353 | if(!treeH) {// TreeH not found in header file |
1354 | |
1355 | if (fDebug) |
1356 | cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find TreeH in " << fHeaderFile << endl ; |
1357 | |
1358 | TString searchFileName("") ; |
1359 | |
1360 | if (SDigitizer()) // SDigitizer found in header file |
1361 | searchFileName = SDigitizer()->GetTitle() ; |
1362 | |
1363 | else if (Digitizer()) // Digitizer found in header file |
1364 | searchFileName = Digitizer()->GetHitsFileName() ; |
1365 | |
1366 | else if (Clusterizer()) // Clusterizer found in header file |
1367 | searchFileName = Clusterizer()->GetHitsFileName() ; |
1368 | |
1369 | if (treeH = TreeH(searchFileName)) { //found TreeH in the file which contains the hits |
1370 | if (fDebug) |
1371 | cout << "INFO: AliEMCALGetter::ReadTreeH -> TreeH found in " << searchFileName.Data() << endl ; |
1372 | |
1373 | } else { |
1374 | cerr << "ERROR: AliEMCALGetter::ReadTreeH -> TreeH not found " << endl ; |
1375 | return ; |
1376 | } |
1377 | } |
ffa6d63b |
1378 | |
1379 | TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ; |
1380 | if ( !hitsbranch ) { |
d75bea67 |
1381 | if (fDebug) |
ffa6d63b |
1382 | cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ; |
1383 | return ; |
1384 | } |
1385 | if(!Hits()) |
1386 | PostHits() ; |
472319e5 |
1387 | |
1388 | if (hitsbranch->GetEntries() > 1 ) { |
1389 | TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ; |
1390 | TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ; |
1391 | hitsbranch->SetAddress(&tempo) ; |
1392 | Int_t index = 0 ; |
1393 | Int_t i = 0 ; |
1394 | for (i = 0 ; i < hitsbranch->GetEntries() ; i++) { |
1395 | hitsbranch->GetEntry(i) ; |
1396 | Int_t j = 0 ; |
1397 | for ( j = 0 ; j < tempo->GetEntries() ; j++) { |
1398 | const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ; |
1399 | new((*hits)[index]) AliEMCALHit( *hit ) ; |
1400 | index++ ; |
1401 | } |
1402 | } |
1403 | delete tempo ; |
1404 | } |
1405 | else { |
ffa6d63b |
1406 | hitsbranch->SetAddress(HitsRef()) ; |
ffa6d63b |
1407 | hitsbranch->GetEntry(0) ; |
472319e5 |
1408 | } |
ffa6d63b |
1409 | } |
1410 | |
1411 | //____________________________________________________________________________ |
1412 | void AliEMCALGetter::Track(Int_t itrack) |
1413 | { |
1414 | // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() |
1415 | |
1416 | if(gAlice->TreeH()== 0){ |
1417 | cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ; |
1418 | return ; |
1419 | } |
1420 | |
1421 | TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ; |
1422 | if ( !hitsbranch ) { |
d75bea67 |
1423 | if (fDebug) |
ffa6d63b |
1424 | cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ; |
1425 | return ; |
1426 | } |
1427 | if(!Hits()) |
1428 | PostHits() ; |
1429 | hitsbranch->SetAddress(HitsRef()) ; |
1430 | hitsbranch->GetEntry(itrack) ; |
1431 | |
f07cab21 |
1432 | |
ffa6d63b |
1433 | } |
9bd3caba |
1434 | |
1435 | |
1436 | //____________________________________________________________________________ |
1437 | TTree * AliEMCALGetter::TreeK(TString filename) |
1438 | { |
1439 | |
1440 | // returns TreeK from file filename |
1441 | // usefull in case of split file |
1442 | |
1443 | if ( filename.IsNull() ) |
1444 | filename = fHeaderFile ; |
1445 | |
1446 | TFile * file = 0 ; |
1447 | // file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ; |
1448 | if (!file) { // file not open yet |
1449 | // file->Close() ; |
1450 | file = TFile::Open(filename.Data(), "read") ; |
1451 | delete fAlice ; |
1452 | fAlice = static_cast<AliRun *>(file->Get("gAlice")) ; |
1453 | } |
1454 | |
1455 | TString treeName("TreeK") ; |
1456 | treeName += EventNumber() ; |
1457 | TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ; |
1458 | if (!tree && fDebug) |
1459 | cout << "WARNING: AliEMCALGetter::TreeK -> " << treeName.Data() << " not found in " << filename.Data() << endl ; |
1460 | |
1461 | return tree ; |
1462 | } |
1463 | |
1464 | //____________________________________________________________________________ |
1465 | TTree * AliEMCALGetter::TreeH(TString filename) |
1466 | { |
1467 | |
1468 | // returns TreeH from file filename |
1469 | // usefull in case of split file |
1470 | |
1471 | if ( filename.IsNull() ) |
1472 | filename = fHeaderFile ; |
1473 | |
1474 | TFile * file = 0 ; |
1475 | file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ; |
1476 | if (!file) { // file not open yet |
1477 | file = TFile::Open(filename.Data(), "read") ; |
1478 | } |
1479 | TString treeName("TreeH") ; |
1480 | treeName += EventNumber() ; |
1481 | TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ; |
1482 | if (!tree && fDebug) |
1483 | cout << "WARNING: AliEMCALGetter::TreeH -> " << treeName.Data() << " not found in " << filename.Data() << endl ; |
1484 | |
1485 | return tree ; |
1486 | } |
1487 | |
1488 | //____________________________________________________________________________ |
1489 | TTree * AliEMCALGetter::TreeS(TString filename) |
1490 | { |
1491 | |
1492 | // returns TreeS from file filename |
1493 | // usefull in case of split file |
1494 | |
1495 | if ( filename.IsNull() ) |
1496 | filename = fHeaderFile ; |
1497 | |
1498 | TFile * file = 0 ; |
1499 | file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ; |
1500 | if (!file) { // file not open yet |
1501 | file = TFile::Open(filename.Data(), "read") ; |
1502 | } |
1503 | TString treeName("TreeS") ; |
1504 | treeName += EventNumber() ; |
1505 | TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ; |
1506 | if (!tree && fDebug) |
1507 | cout << "WARNING: AliEMCALGetter::TreeS -> " << treeName.Data() << " not found in " << filename.Data() << endl ; |
1508 | |
1509 | return tree ; |
1510 | } |
1511 | |
1512 | //____________________________________________________________________________ |
1513 | TTree * AliEMCALGetter::TreeD(TString filename) |
1514 | { |
1515 | |
1516 | // returns TreeD from file filename |
1517 | // usefull in case of split file |
1518 | |
1519 | if ( filename.IsNull() ) |
1520 | filename = fHeaderFile ; |
1521 | |
1522 | TFile * file = 0 ; |
1523 | file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ; |
1524 | if (!file) { // file not open yet |
1525 | file = TFile::Open(filename.Data(), "read") ; |
1526 | } |
1527 | TString treeName("TreeD") ; |
1528 | treeName += EventNumber() ; |
1529 | TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ; |
1530 | if (!tree && fDebug) |
1531 | cout << "WARNING: AliEMCALGetter::TreeD -> " << treeName.Data() << " not found in " << filename.Data() << endl ; |
1532 | |
1533 | return tree ; |
1534 | } |
1535 | |
ffa6d63b |
1536 | //____________________________________________________________________________ |
f07cab21 |
1537 | // void AliEMCALGetter::ReadTreeQA() |
1538 | //{ |
d75bea67 |
1539 | // Read the digit tree gAlice->TreeQA() |
1540 | // so far only EMCAL knows about this Tree |
1541 | |
f07cab21 |
1542 | // if(EMCAL()->TreeQA()== 0){ |
1543 | // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ; |
1544 | // return ; |
1545 | // } |
d75bea67 |
1546 | |
f07cab21 |
1547 | // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ; |
1548 | // if (!qabranch) { |
1549 | // if (fDebug) |
1550 | // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ; |
1551 | // return ; |
1552 | // } |
d75bea67 |
1553 | |
f07cab21 |
1554 | // if(!Alarms()) |
1555 | // PostQA() ; |
d75bea67 |
1556 | |
f07cab21 |
1557 | // qabranch->SetAddress(AlarmsRef()) ; |
d75bea67 |
1558 | |
f07cab21 |
1559 | // qabranch->GetEntry(0) ; |
d75bea67 |
1560 | |
1561 | // PostQA("EMCAL") ; |
1562 | // TFolder * alarmsF = Alarms() ; |
1563 | // alarmsF->Clear() ; |
1564 | // qabranch->SetAddress(&alarmsF) ; |
1565 | // qabranch->GetEntry(0) ; |
1566 | |
f07cab21 |
1567 | //} |
1568 | |
d75bea67 |
1569 | //____________________________________________________________________________ |
1570 | void AliEMCALGetter::ReadTreeR() |
1571 | { |
f07cab21 |
1572 | // Read the reconstrunction tree gAlice->TreeR() |
d75bea67 |
1573 | |
1574 | if(gAlice->TreeR()== 0){ |
9bd3caba |
1575 | if (fDebug) |
1576 | cout << "WARNING: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ; |
d75bea67 |
1577 | return ; |
1578 | } |
1579 | |
1580 | // RecPoints |
1581 | TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ; |
1582 | TIter next(lob) ; |
1583 | TBranch * branch = 0 ; |
f07cab21 |
1584 | TBranch * towerbranch = 0 ; |
1585 | TBranch * preshobranch = 0 ; |
d75bea67 |
1586 | TBranch * clusterizerbranch = 0 ; |
f07cab21 |
1587 | Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ; |
d75bea67 |
1588 | |
f07cab21 |
1589 | while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) ) |
d75bea67 |
1590 | if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) { |
f07cab21 |
1591 | if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) { |
1592 | towerbranch = branch ; |
1593 | emcaltowerrpfound = kTRUE ; |
d75bea67 |
1594 | } |
f07cab21 |
1595 | else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) { |
1596 | preshobranch = branch ; |
1597 | emcalpreshorpfound = kTRUE ; |
d75bea67 |
1598 | } |
1599 | else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){ |
1600 | clusterizerbranch = branch ; |
1601 | clusterizerfound = kTRUE ; |
1602 | } |
1603 | } |
1604 | |
f07cab21 |
1605 | if ( !emcaltowerrpfound ) { |
d75bea67 |
1606 | if (fDebug) |
f07cab21 |
1607 | cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title " |
d75bea67 |
1608 | << fRecPointsTitle << endl ; |
1609 | return ; |
1610 | } |
f07cab21 |
1611 | if ( !emcalpreshorpfound ) { |
d75bea67 |
1612 | if (fDebug) |
f07cab21 |
1613 | cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title " |
d75bea67 |
1614 | << fRecPointsTitle << endl ; |
1615 | return ; |
1616 | } |
1617 | if ( !clusterizerfound ) { |
1618 | if (fDebug) |
1619 | cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title " |
1620 | << fRecPointsTitle << endl ; |
1621 | return ; |
1622 | } |
1623 | |
1624 | // Read and Post the RecPoints |
f07cab21 |
1625 | if(!TowerRecPoints(fRecPointsTitle) ) |
d75bea67 |
1626 | PostRecPoints(fRecPointsTitle) ; |
f07cab21 |
1627 | towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ; |
1628 | towerbranch->GetEntry(0) ; |
d75bea67 |
1629 | |
f07cab21 |
1630 | preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ; |
1631 | preshobranch->GetEntry(0) ; |
d75bea67 |
1632 | |
1633 | if(!Clusterizer(fRecPointsTitle) ) |
1634 | PostClusterizer(fRecPointsTitle) ; |
92f521a9 |
1635 | |
1636 | clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ; |
1637 | clusterizerbranch->GetEntry(0) ; |
d75bea67 |
1638 | |
1639 | |
1640 | //------------------- TrackSegments --------------------- |
f07cab21 |
1641 | // next.Reset() ; |
1642 | // TBranch * tsbranch = 0 ; |
1643 | // TBranch * tsmakerbranch = 0 ; |
1644 | // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ; |
d75bea67 |
1645 | |
f07cab21 |
1646 | // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) ) |
1647 | // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) { |
1648 | // if ( strcmp(branch->GetName(), "EMCALTS")==0){ |
1649 | // tsbranch = branch ; |
1650 | // emcaltsfound = kTRUE ; |
1651 | // } |
1652 | // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) { |
1653 | // tsmakerbranch = branch ; |
1654 | // tsmakerfound = kTRUE ; |
1655 | // } |
1656 | // } |
1657 | |
1658 | // if ( !emcaltsfound || !tsmakerfound ) { |
1659 | // if (fDebug) |
1660 | // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name " |
1661 | // << fTrackSegmentsTitle << endl ; |
1662 | // return ; |
1663 | // } |
1664 | |
1665 | // // Read and Post the TrackSegments |
1666 | // if(!TrackSegments(fTrackSegmentsTitle)) |
1667 | // PostTrackSegments(fTrackSegmentsTitle) ; |
1668 | // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ; |
1669 | // tsbranch->GetEntry(0) ; |
1670 | |
1671 | // // Read and Post the TrackSegment Maker |
1672 | // if(!TrackSegmentMaker(fTrackSegmentsTitle)) |
1673 | // PostTrackSegmentMaker(fTrackSegmentsTitle) ; |
92f521a9 |
1674 | // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ; |
1675 | // tsmakerbranch->GetEntry(0) ; |
f07cab21 |
1676 | |
1677 | |
1678 | // //------------ RecParticles ---------------------------- |
1679 | // next.Reset() ; |
1680 | // TBranch * rpabranch = 0 ; |
1681 | // TBranch * pidbranch = 0 ; |
1682 | // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ; |
1683 | |
1684 | // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) ) |
1685 | // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) { |
1686 | // if ( strcmp(branch->GetName(), "EMCALRP")==0) { |
1687 | // rpabranch = branch ; |
1688 | // emcalrpafound = kTRUE ; |
1689 | // } |
1690 | // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) { |
1691 | // pidbranch = branch ; |
1692 | // pidfound = kTRUE ; |
1693 | // } |
1694 | // } |
1695 | |
1696 | // if ( !emcalrpafound || !pidfound ) { |
1697 | // if (fDebug) |
1698 | // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name " |
1699 | // << fRecParticlesTitle << endl ; |
1700 | // return ; |
1701 | // } |
1702 | |
1703 | // // Read and Post the RecParticles |
1704 | // if(!RecParticles(fRecParticlesTitle)) |
1705 | // PostRecParticles(fRecParticlesTitle) ; |
1706 | // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ; |
1707 | // rpabranch->GetEntry(0) ; |
1708 | |
1709 | // // Read and Post the PID |
1710 | // if(!PID(fRecParticlesTitle)) |
1711 | // PostPID(fRecParticlesTitle) ; |
92f521a9 |
1712 | // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ; |
1713 | // pidbranch->GetEntry(0) ; |
d75bea67 |
1714 | |
1715 | |
1716 | } |
f07cab21 |
1717 | |
d75bea67 |
1718 | //____________________________________________________________________________ |
ffa6d63b |
1719 | void AliEMCALGetter::ReadTreeS(Int_t event) |
1720 | { |
1721 | // Read the summable digits tree gAlice->TreeS() |
1722 | |
1723 | // loop over all opened files and read their SDigits to the White Board |
1724 | TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ; |
1725 | if (!emcalF) |
1726 | emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; |
1727 | TCollection * folderslist = emcalF->GetListOfFolders() ; |
1728 | |
1729 | //Add current file to list if it is not there yet |
4e5c8d4c |
1730 | |
1731 | TString subdir(fHeaderFile) ; |
1732 | subdir.ReplaceAll("/","_") ; |
1733 | |
1734 | if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){ |
1735 | emcalF->AddFolder(subdir, ""); |
ffa6d63b |
1736 | } |
54b82aa4 |
1737 | |
ffa6d63b |
1738 | TIter next(folderslist) ; |
1739 | TFolder * folder = 0 ; |
1740 | TFile * file; |
1741 | TTree * treeS = 0; |
1742 | while ( (folder = static_cast<TFolder*>(next())) ) { |
4e5c8d4c |
1743 | TString fileName(folder->GetName()) ; |
1744 | fileName.ReplaceAll("_","/") ; |
1745 | if(fHeaderFile.CompareTo(fileName) == 0 ) |
d75bea67 |
1746 | treeS=gAlice->TreeS() ; |
ffa6d63b |
1747 | else{ |
4e5c8d4c |
1748 | file = static_cast<TFile*>(gROOT->GetFile(fileName)); |
ffa6d63b |
1749 | file->cd() ; |
1750 | |
1751 | // Get SDigits Tree header from file |
1752 | TString treeName("TreeS") ; |
1753 | treeName += event ; |
1754 | treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data())); |
1755 | } |
9bd3caba |
1756 | if(!treeS){ // TreeS not found in header file |
1757 | |
1758 | if (fDebug) |
1759 | cout << "WARNING: AliEMCALGetter::ReadTreeS -> Cannot find TreeS in " << fHeaderFile << endl; |
1760 | |
1761 | TString searchFileName("") ; |
1762 | |
1763 | if (SDigitizer()) // SDigitizer found in header file |
1764 | searchFileName = SDigitizer()->GetTitle() ; |
1765 | |
1766 | else if (Digitizer()) // Digitizer found in header file |
1767 | searchFileName = Digitizer()->GetSDigitsFileName() ; |
1768 | |
1769 | else if (Clusterizer()) // Clusterizer found in header file |
1770 | searchFileName = Clusterizer()->GetSDigitsFileName() ; |
1771 | |
1772 | if (treeS = TreeS(searchFileName)) { //found TreeS in the file which contains the hits |
1773 | if (fDebug) |
1774 | cout << "INFO: AliEMCALGetter::ReadTreeS -> TreeS found in " << searchFileName.Data() << endl ; |
1775 | |
1776 | } else { |
1777 | cerr << "ERROR: AliEMCALGetter::ReadTreeS -> TreeS not found " << endl ; |
1778 | return ; |
1779 | } |
1780 | } |
1781 | |
1782 | //set address of the SDigits and SDigitizer |
1783 | TBranch * sdigitsBranch = 0; |
1784 | TBranch * sdigitizerBranch = 0; |
1785 | TBranch * branch = 0 ; |
1786 | TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ; |
1787 | TIter next(lob) ; |
1788 | Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; |
54b82aa4 |
1789 | |
9bd3caba |
1790 | while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) { |
1791 | if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { |
1792 | emcalfound = kTRUE ; |
1793 | sdigitsBranch = branch ; |
1794 | } |
1795 | |
1796 | else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { |
1797 | sdigitizerfound = kTRUE ; |
1798 | sdigitizerBranch = branch ; |
1799 | } |
1800 | } |
1801 | if ( !emcalfound || !sdigitizerfound ) { |
1802 | if (fDebug) |
1803 | cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle |
1804 | << " not found" << endl ; |
1805 | return ; |
1806 | } |
1807 | |
1808 | if ( !folder->FindObject(fSDigitsTitle) ) |
1809 | PostSDigits(fSDigitsTitle,folder->GetName()) ; |
1810 | sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ; |
1811 | sdigitsBranch->GetEntry(0) ; |
1812 | |
1813 | TString sdname(fSDigitsTitle) ; |
1814 | sdname+=":" ; |
1815 | sdname+=folder->GetName() ; |
1816 | if(!SDigitizer(sdname) ) |
1817 | PostSDigitizer(fSDigitsTitle,folder->GetName()) ; |
1818 | |
1819 | sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; |
1820 | sdigitizerBranch->GetEntry(0) ; |
1821 | |
1822 | } |
ffa6d63b |
1823 | |
1824 | // After SDigits have been read from all files, return to the first one |
1825 | |
1826 | next.Reset(); |
1827 | folder = static_cast<TFolder*>(next()); |
1828 | if(folder){ |
4e5c8d4c |
1829 | TString fileName(folder->GetName()) ; |
1830 | fileName.ReplaceAll("_","/") ; |
1831 | file = static_cast<TFile*>(gROOT->GetFile(fileName)); |
ffa6d63b |
1832 | file ->cd() ; |
1833 | } |
1834 | |
1835 | } |
9bd3caba |
1836 | |
ffa6d63b |
1837 | //____________________________________________________________________________ |
1838 | void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input) |
1839 | { // Read the summable digits fron treeS() |
1840 | |
1841 | |
1842 | TString filename("mergefile") ; |
1843 | filename+= input ; |
1844 | |
1845 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; |
1846 | if ( !emcalFolder ) { |
1847 | emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; |
1848 | } |
1849 | TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ; |
1850 | //set address of the SDigits and SDigitizer |
1851 | TBranch * sdigitsBranch = 0; |
1852 | TBranch * sdigitizerBranch = 0; |
1853 | TBranch * branch = 0 ; |
1854 | TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ; |
1855 | TIter next(lob) ; |
1856 | Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; |
1857 | |
1858 | while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) { |
1859 | if ( strcmp(branch->GetName(), "EMCAL")==0) { |
1860 | emcalfound = kTRUE ; |
1861 | sdigitsBranch = branch ; |
1862 | } |
1863 | |
1864 | else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) { |
1865 | sdigitizerfound = kTRUE ; |
1866 | sdigitizerBranch = branch ; |
1867 | } |
1868 | } |
1869 | if ( !emcalfound || !sdigitizerfound ) { |
d75bea67 |
1870 | if (fDebug) |
ffa6d63b |
1871 | cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ; |
1872 | return ; |
1873 | } |
1874 | |
1875 | if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) ) |
1876 | PostSDigits(sdigitsBranch->GetTitle(),filename) ; |
1877 | |
1878 | sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ; |
d75bea67 |
1879 | sdigitsBranch->GetEntry(0) ; |
ffa6d63b |
1880 | |
1881 | TString sdname(sdigitsBranch->GetTitle()) ; |
1882 | sdname+=":" ; |
1883 | sdname+=filename ; |
1884 | if(!SDigitizer(sdigitsBranch->GetTitle()) ) |
1885 | PostSDigitizer(sdigitsBranch->GetTitle(),filename) ; |
d75bea67 |
1886 | |
ffa6d63b |
1887 | sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; |
ffa6d63b |
1888 | sdigitizerBranch->GetEntry(0) ; |
1889 | |
1890 | } |
1891 | |
1892 | |
1893 | //____________________________________________________________________________ |
1894 | void AliEMCALGetter::ReadPrimaries() |
1895 | { |
1896 | // Reads specific branches of primaries |
1897 | |
9bd3caba |
1898 | TClonesArray * ar = 0 ; |
1899 | if(! (ar = Primaries()) ) { |
1900 | PostPrimaries() ; |
1901 | ar = Primaries() ; |
1902 | } |
1903 | ar->Delete() ; |
1904 | |
1905 | if (TreeK(fHeaderFile)) { // treeK found in header file |
1906 | if (fDebug) |
1907 | cout << "INFO: AliEMCALGetter::ReadPrimaries -> TreeK found in " << fHeaderFile.Data() << endl ; |
1908 | fNPrimaries = gAlice->GetNtrack() ; |
9e8c7fb3 |
1909 | fAlice = 0 ; |
1910 | |
9bd3caba |
1911 | } else { // treeK not found in header file |
ffa6d63b |
1912 | |
9bd3caba |
1913 | TString searchFileName("") ; |
ffa6d63b |
1914 | |
9bd3caba |
1915 | if (SDigitizer()) // SDigitizer found in header file |
1916 | searchFileName = SDigitizer()->GetTitle() ; |
ffa6d63b |
1917 | |
9bd3caba |
1918 | else if (Digitizer()) // Digitizer found in header file |
1919 | searchFileName = Digitizer()->GetHitsFileName() ; |
ffa6d63b |
1920 | |
9bd3caba |
1921 | else if (Clusterizer()) // Clusterizer found in header file |
1922 | searchFileName = Clusterizer()->GetHitsFileName() ; |
ffa6d63b |
1923 | |
9bd3caba |
1924 | if (TreeK(searchFileName)) { //found TreeK in the file which contains the hits |
1925 | if (fDebug) |
1926 | cout << "INFO: AliEMCALGetter::ReadPrimaries -> TreeK found in " << searchFileName.Data() << endl ; |
1927 | fAlice->GetEvent(EventNumber()) ; |
1928 | fNPrimaries = fAlice->GetNtrack() ; |
ffa6d63b |
1929 | |
9bd3caba |
1930 | } else { |
1931 | cerr << "ERROR: AliEMCALGetter::ReadPrimaries -> TreeK not found " << endl ; |
1932 | return ; |
1933 | } |
ffa6d63b |
1934 | |
9bd3caba |
1935 | } |
1936 | Int_t index = 0 ; |
1937 | for (index = 0 ; index < fNPrimaries; index++) { |
1938 | new ((*ar)[index]) TParticle(*(Primary(index))); |
1939 | } |
ffa6d63b |
1940 | } |
9bd3caba |
1941 | |
ffa6d63b |
1942 | //____________________________________________________________________________ |
1943 | void AliEMCALGetter::Event(const Int_t event, const char* opt) |
1944 | { |
1945 | // Reads the content of all Tree's S, D and R |
1946 | |
1947 | if (event >= gAlice->TreeE()->GetEntries() ) { |
1948 | cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ; |
1949 | return ; |
1950 | } |
1951 | gAlice->GetEvent(event) ; |
1952 | |
9bd3caba |
1953 | // Carefull the order of reading is important |
ffa6d63b |
1954 | |
9bd3caba |
1955 | if( strstr(opt,"R") ) |
1956 | ReadTreeR() ; |
ffa6d63b |
1957 | |
1958 | if( strstr(opt,"D") ) |
1959 | ReadTreeD() ; |
1960 | |
9bd3caba |
1961 | if(strstr(opt,"S") ) |
1962 | ReadTreeS(event) ; |
1963 | |
1964 | if(strstr(opt,"H") ) |
1965 | ReadTreeH() ; |
ffa6d63b |
1966 | |
d75bea67 |
1967 | // if( strstr(opt,"Q") ) |
1968 | // ReadTreeQA() ; |
ffa6d63b |
1969 | |
9bd3caba |
1970 | if( strstr(opt,"P") || (strcmp(opt,"")==0) ) |
1971 | ReadPrimaries() ; |
1972 | |
ffa6d63b |
1973 | } |
1974 | |
1975 | //____________________________________________________________________________ |
472319e5 |
1976 | TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const |
ffa6d63b |
1977 | { |
1978 | // get the object named "what" from the folder |
1979 | // folders are named like //Folders |
1980 | |
1981 | if ( file.IsNull() ) |
1982 | file = fHeaderFile ; |
1983 | |
1984 | TFolder * folder = 0 ; |
1985 | TObject * emcalO = 0 ; |
1986 | |
1987 | // if ( name.IsNull() ) { |
1988 | if ( what.CompareTo("Hits") == 0 ) { |
1989 | folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ; |
1990 | if (folder) |
1991 | emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ; |
1992 | } |
1993 | else if ( what.CompareTo("SDigits") == 0 ) { |
4e5c8d4c |
1994 | file.ReplaceAll("/","_") ; |
ffa6d63b |
1995 | TString path = "EMCAL/" + file ; |
1996 | folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ; |
1997 | if (folder) { |
d75bea67 |
1998 | if (name.IsNull()) |
ffa6d63b |
1999 | name = fSDigitsTitle ; |
2000 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; |
2001 | } |
2002 | } |
2003 | else if ( what.CompareTo("Digits") == 0 ){ |
2004 | folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ; |
2005 | if (folder) { |
2006 | if (name.IsNull()) |
2007 | name = fDigitsTitle ; |
2008 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; |
2009 | } |
2010 | } |
f07cab21 |
2011 | else if ( what.CompareTo("TowerRecPoints") == 0 ) { |
2012 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; |
d75bea67 |
2013 | if (folder) { |
2014 | if (name.IsNull()) |
2015 | name = fRecPointsTitle ; |
2016 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; |
2017 | } |
2018 | } |
f07cab21 |
2019 | else if ( what.CompareTo("PreShoRecPoints") == 0 ) { |
2020 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ; |
d75bea67 |
2021 | if (folder) { |
2022 | if (name.IsNull()) |
2023 | name = fRecPointsTitle ; |
2024 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; |
2025 | } |
2026 | } |
f07cab21 |
2027 | /* |
d75bea67 |
2028 | else if ( what.CompareTo("TrackSegments") == 0 ) { |
2029 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; |
2030 | if (folder) { |
2031 | if (name.IsNull()) |
2032 | name = fTrackSegmentsTitle ; |
2033 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; |
2034 | } |
2035 | } |
2036 | else if ( what.CompareTo("RecParticles") == 0 ) { |
2037 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ; |
2038 | if (folder) { |
2039 | if (name.IsNull()) |
2040 | name = fRecParticlesTitle ; |
2041 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; |
2042 | } |
2043 | } |
2044 | else if ( what.CompareTo("Alarms") == 0 ){ |
2045 | if (name.IsNull() ) |
2046 | emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ; |
2047 | else { |
2048 | folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ; |
2049 | if (!folder) |
2050 | emcalO = 0 ; |
2051 | else |
2052 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; |
2053 | } |
2054 | } |
2055 | */ |
ffa6d63b |
2056 | if (!emcalO) { |
d75bea67 |
2057 | if(fDebug) |
9bd3caba |
2058 | cout << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ; |
ffa6d63b |
2059 | return 0 ; |
2060 | } |
2061 | return emcalO ; |
2062 | } |
2063 | |
2064 | //____________________________________________________________________________ |
2065 | const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const |
2066 | { |
2067 | // get the TTask named "what" from the folder |
2068 | // folders are named like //Folders/Tasks/what/EMCAL/name |
2069 | |
2070 | TString search(what) ; |
f07cab21 |
2071 | if ( what.CompareTo("Clusterizer") == 0 ) |
d75bea67 |
2072 | search = "Reconstructioner" ; |
2073 | else if ( what.CompareTo("TrackSegmentMaker") == 0 ) |
2074 | search = "Reconstructioner" ; |
2075 | else if ( what.CompareTo("PID") == 0 ) |
2076 | search = "Reconstructioner" ; |
2077 | else if ( what.CompareTo("QATasks") == 0 ) |
2078 | search = "QA" ; |
f07cab21 |
2079 | |
ffa6d63b |
2080 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ; |
2081 | |
2082 | if (!tasks) { |
2083 | cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ; |
2084 | return 0 ; |
2085 | } |
2086 | |
2087 | TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; |
2088 | if (!emcalT) { |
2089 | cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ; |
2090 | return 0 ; |
2091 | } |
2092 | |
2093 | TList * list = emcalT->GetListOfTasks() ; |
2094 | |
2095 | if (what.CompareTo("SDigitizer") == 0) { |
2096 | if ( name.IsNull() ) |
2097 | name = fSDigitsTitle ; |
2098 | } else if (what.CompareTo("Digitizer") == 0){ |
2099 | if ( name.IsNull() ) |
2100 | name = fDigitsTitle ; |
f07cab21 |
2101 | } else if (what.CompareTo("Clusterizer") == 0){ |
d75bea67 |
2102 | if ( name.IsNull() ) |
2103 | name = fRecPointsTitle ; |
2104 | name.Append(":clu") ; |
2105 | } |
f07cab21 |
2106 | // else if (what.CompareTo("TrackSegmentMaker") == 0){ |
2107 | // if ( name.IsNull() ) |
2108 | // name = fTrackSegmentsTitle ; |
2109 | // name.Append(":tsm") ; |
2110 | // } |
2111 | // else if (what.CompareTo("PID") == 0){ |
2112 | // if ( name.IsNull() ) |
2113 | // name = fRecParticlesTitle ; |
2114 | // name.Append(":pid") ; |
2115 | // } |
2116 | // else if (what.CompareTo("QATasks") == 0){ |
2117 | // if ( name.IsNull() ) |
2118 | // return emcalT ; |
2119 | // } |
ffa6d63b |
2120 | |
2121 | TIter it(list) ; |
2122 | TTask * task = 0 ; |
2123 | while((task = static_cast<TTask *>(it.Next()) )){ |
2124 | TString taskname(task->GetName()) ; |
54b82aa4 |
2125 | if(taskname.BeginsWith(name)){ |
2126 | return task ;} |
ffa6d63b |
2127 | } |
2128 | |
d75bea67 |
2129 | if(fDebug) |
ffa6d63b |
2130 | cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ; |
2131 | return 0 ; |
2132 | } |
65549808 |
2133 | |
2134 | |
2135 | //____________________________________________________________________________ |
2136 | void AliEMCALGetter::RemoveTask(TString opt, TString name) const |
2137 | { |
2138 | // remove a task from the folder |
9bd3caba |
2139 | // path is fTasksFolder/SDigitizer/EMCAL/name |
65549808 |
2140 | |
2141 | TTask * task = 0 ; |
2142 | TTask * emcal = 0 ; |
2143 | TList * lofTasks = 0 ; |
2144 | |
b134c32f |
2145 | if (opt == "S") { // SDigitizer |
65549808 |
2146 | task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; |
2147 | if (!task) |
2148 | return ; |
2149 | } |
2150 | |
b134c32f |
2151 | else if (opt == "D") { // Digitizer |
65549808 |
2152 | task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; |
2153 | if (!task) |
2154 | return ; |
2155 | } |
b134c32f |
2156 | else if (opt == "C") { // Clusterizer |
2157 | task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; |
2158 | if (!task) |
2159 | return ; |
2160 | } |
65549808 |
2161 | else { |
b134c32f |
2162 | cerr << "WARNING: AliEMCALGetter::RemoveTask -> Unknown option " << opt.Data() << endl ; |
65549808 |
2163 | return ; |
2164 | } |
b134c32f |
2165 | |
65549808 |
2166 | emcal = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ; |
2167 | if (!emcal) |
2168 | return ; |
2169 | lofTasks = emcal->GetListOfTasks() ; |
2170 | if (!lofTasks) |
2171 | return ; |
2172 | TObject * obj = lofTasks->FindObject(name) ; |
2173 | if (obj) |
2174 | lofTasks->Remove(obj) ; |
2175 | } |
b134c32f |
2176 | |
65549808 |
2177 | //____________________________________________________________________________ |
2178 | void AliEMCALGetter::RemoveObjects(TString opt, TString name) const |
2179 | { |
2180 | // remove SDigits from the folder |
2181 | // path is fSDigitsFolder/fHeaderFileName/name |
2182 | |
2183 | TFolder * emcal = 0 ; |
2184 | TFolder * emcalmain = 0 ; |
2185 | |
b134c32f |
2186 | if (opt == "H") { // Hits |
65549808 |
2187 | emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ; |
2188 | if (!emcal) |
2189 | return ; |
2190 | name = "Hits" ; |
2191 | } |
2192 | |
b134c32f |
2193 | else if ( opt == "S") { // SDigits |
65549808 |
2194 | emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; |
2195 | if (!emcalmain) |
2196 | return ; |
2197 | emcal = dynamic_cast<TFolder*>(emcalmain->FindObject(fHeaderFile)) ; |
2198 | if (!emcal) |
2199 | return ; |
2200 | } |
2201 | |
b134c32f |
2202 | else if (opt == "D") { // Digits |
65549808 |
2203 | emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ; |
2204 | if (!emcal) |
2205 | return ; |
2206 | } |
b134c32f |
2207 | |
2208 | else if (opt == "RT") { // Tower RecPoints |
2209 | emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; |
2210 | if (!emcal) |
2211 | return ; |
2212 | } |
2213 | |
2214 | else if (opt == "RP") { // Preshower RecPoints |
2215 | emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ; |
2216 | if (!emcal) |
2217 | return ; |
2218 | } |
2219 | |
65549808 |
2220 | else { |
2221 | cerr << "WARNING: AliEMCALGetter::RemoveObjects -> Unknown option " << opt.Data() << endl ; |
2222 | return ; |
2223 | } |
2224 | |
2225 | TObjArray * ar = dynamic_cast<TObjArray*>(emcal->FindObject(name)) ; |
2226 | if (ar) { |
2227 | emcal->Remove(ar) ; |
2228 | ar->Delete() ; |
2229 | delete ar ; |
2230 | } |
2231 | |
2232 | if (opt == "S") |
2233 | emcalmain->Remove(emcal) ; |
2234 | |
2235 | } |
2236 | |
2237 | //____________________________________________________________________________ |
2238 | void AliEMCALGetter::RemoveSDigits() const |
2239 | { |
2240 | TFolder * emcal= dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; |
2241 | if (!emcal) |
2242 | return ; |
2243 | |
2244 | emcal->SetOwner() ; |
2245 | emcal->Clear() ; |
2246 | } |