]>
Commit | Line | Data |
---|---|---|
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 ; | |
80 | ||
81 | //____________________________________________________________________________ | |
472319e5 | 82 | AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Option_t * rw) |
ffa6d63b | 83 | { |
84 | //Initialize all lists | |
85 | ||
54b82aa4 | 86 | fDebug = 0 ; |
87 | ||
ffa6d63b | 88 | fHeaderFile = headerFile ; |
89 | fBranchTitle = branchTitle ; | |
90 | fSDigitsTitle = branchTitle ; | |
91 | fDigitsTitle = branchTitle ; | |
f07cab21 | 92 | fRecPointsTitle = branchTitle ; |
d75bea67 | 93 | //fRecParticlesTitle = branchTitle ; |
94 | //fTrackSegmentsTitle = branchTitle ; | |
ffa6d63b | 95 | |
96 | fPrimaries = new TObjArray(1) ; | |
d75bea67 | 97 | |
98 | fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules")); | |
ffa6d63b | 99 | fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits")); |
100 | fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits")); | |
101 | fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data")); | |
f07cab21 | 102 | fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData")); |
d75bea67 | 103 | //fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA")); |
ffa6d63b | 104 | fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ; |
105 | ||
106 | if ( fHeaderFile != "aliroot" ) { // to call the getter without a file | |
107 | ||
108 | //open headers file | |
109 | TFile * file = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ; | |
110 | ||
111 | if(file == 0){ //if file was not opened yet, read gAlice | |
112 | if(fHeaderFile.Contains("rfio")) // if we read file using HPSS | |
472319e5 | 113 | file = TFile::Open(fHeaderFile.Data(),rw) ; |
ffa6d63b | 114 | else |
472319e5 | 115 | file = new TFile(fHeaderFile.Data(),rw) ; |
ffa6d63b | 116 | |
117 | if (!file->IsOpen()) { | |
118 | cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ; | |
119 | abort() ; | |
120 | } | |
121 | ||
122 | gAlice = static_cast<AliRun *>(file->Get("gAlice")) ; | |
ffa6d63b | 123 | } |
d75bea67 | 124 | } |
ffa6d63b | 125 | |
d75bea67 | 126 | if (!gAlice) { |
127 | cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ; | |
128 | abort() ; | |
129 | } | |
130 | if (!EMCAL()) { | |
131 | if (fDebug) | |
132 | cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ; | |
133 | AliConfig * conf = AliConfig::Instance() ; | |
134 | conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ; | |
135 | conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ; | |
ffa6d63b | 136 | } |
d75bea67 | 137 | |
138 | fDebug=0; | |
ffa6d63b | 139 | } |
140 | //____________________________________________________________________________ | |
141 | AliEMCALGetter::~AliEMCALGetter(){ | |
142 | ||
143 | } | |
144 | ||
145 | //____________________________________________________________________________ | |
146 | void AliEMCALGetter::CreateWhiteBoard() const | |
147 | { | |
148 | ||
149 | } | |
150 | ||
151 | //____________________________________________________________________________ | |
152 | AliEMCALGetter * AliEMCALGetter::GetInstance() | |
153 | { | |
154 | // Returns the pointer of the unique instance already defined | |
155 | ||
156 | AliEMCALGetter * rv = 0 ; | |
157 | if ( fgObjGetter ) | |
158 | rv = fgObjGetter ; | |
159 | else | |
160 | cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ; | |
161 | ||
162 | return rv ; | |
163 | } | |
164 | ||
165 | //____________________________________________________________________________ | |
166 | AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile, | |
472319e5 | 167 | const char* branchTitle, const Option_t * rw) |
ffa6d63b | 168 | { |
169 | // Creates and returns the pointer of the unique instance | |
170 | // Must be called only when the environment has changed | |
171 | ||
172 | if ( fgObjGetter ) | |
173 | if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) && | |
174 | (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0)) | |
175 | return fgObjGetter ; | |
176 | else | |
177 | fgObjGetter->~AliEMCALGetter() ; // delete it if already exists another version | |
178 | ||
472319e5 | 179 | fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ; |
ffa6d63b | 180 | |
181 | // Posts a few item to the white board (folders) | |
182 | // fgObjGetter->CreateWhiteBoard() ; | |
183 | ||
184 | return fgObjGetter ; | |
185 | ||
186 | } | |
187 | ||
188 | //____________________________________________________________________________ | |
d75bea67 | 189 | const AliEMCALv1 * AliEMCALGetter::EMCAL() |
ffa6d63b | 190 | { |
191 | // returns the EMCAL object | |
d75bea67 | 192 | AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ; |
ffa6d63b | 193 | if (!emcal) |
d75bea67 | 194 | if (fDebug) |
ffa6d63b | 195 | cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ; |
196 | return emcal ; | |
197 | } | |
198 | ||
199 | //____________________________________________________________________________ | |
f07cab21 | 200 | AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() |
ffa6d63b | 201 | { |
202 | AliEMCALGeometry * rv = 0 ; | |
203 | if (EMCAL() ) | |
d75bea67 | 204 | rv = EMCAL()->GetGeometry() ; |
ffa6d63b | 205 | return rv ; |
206 | } | |
207 | ||
208 | //____________________________________________________________________________ | |
209 | Bool_t AliEMCALGetter::PostHits(void) const | |
210 | { //------- Hits ---------------------- | |
211 | ||
212 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits | |
213 | ||
214 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ; | |
215 | if ( !emcalFolder ) { | |
d75bea67 | 216 | if (fDebug) { |
ffa6d63b | 217 | cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl; |
218 | cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl; | |
d75bea67 | 219 | } |
ffa6d63b | 220 | emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ; |
221 | } | |
222 | TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ; | |
223 | hits->SetName("Hits") ; | |
224 | emcalFolder->Add(hits) ; | |
225 | ||
226 | return kTRUE; | |
227 | } | |
228 | ||
229 | //____________________________________________________________________________ | |
472319e5 | 230 | TObject ** AliEMCALGetter::HitsRef(void) const |
ffa6d63b | 231 | { //------- Hits ---------------------- |
232 | ||
233 | ||
234 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits | |
235 | if ( !fHitsFolder ) { | |
236 | cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl; | |
237 | return 0; | |
238 | } | |
239 | ||
240 | TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ; | |
241 | if ( !emcalFolder ) { | |
242 | cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl; | |
243 | return 0; | |
244 | } | |
245 | ||
246 | TObject * h = emcalFolder->FindObject("Hits") ; | |
247 | if(!h) { | |
248 | cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ; | |
249 | return 0 ; | |
250 | } | |
251 | else | |
472319e5 | 252 | return emcalFolder->GetListOfFolders()->GetObjectRef(h) ; |
ffa6d63b | 253 | } |
254 | ||
255 | //____________________________________________________________________________ | |
256 | Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const | |
257 | { //---------- SDigits ------------------------- | |
258 | ||
259 | ||
260 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname | |
261 | // because you can have sdigits from several hit files for mixing | |
262 | ||
263 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; | |
264 | if ( !emcalFolder ) { | |
d75bea67 | 265 | if (fDebug) { |
ffa6d63b | 266 | cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl; |
267 | cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl; | |
d75bea67 | 268 | } |
ffa6d63b | 269 | emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; |
270 | } | |
271 | TString subdir(headerFile) ; | |
35014875 | 272 | subdir.ReplaceAll("/", "_") ; |
ffa6d63b | 273 | TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ; |
274 | if ( !emcalSubFolder ) | |
275 | emcalSubFolder = emcalFolder->AddFolder(subdir, ""); | |
276 | ||
277 | TObject * sd = emcalSubFolder->FindObject(name); | |
278 | if ( sd ) { | |
d75bea67 | 279 | if (fDebug) |
ffa6d63b | 280 | cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir |
281 | << " already exists!" << endl ; | |
282 | }else{ | |
d75bea67 | 283 | TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ; |
ffa6d63b | 284 | sdigits->SetName(name) ; |
285 | emcalSubFolder->Add(sdigits) ; | |
286 | } | |
287 | ||
288 | return kTRUE; | |
289 | } | |
290 | //____________________________________________________________________________ | |
472319e5 | 291 | TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const |
ffa6d63b | 292 | { //------- SDigits ---------------------- |
293 | ||
294 | // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits | |
295 | ||
296 | if ( !fSDigitsFolder ) { | |
297 | cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl; | |
298 | return 0; | |
299 | } | |
300 | ||
301 | TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ; | |
302 | if ( !emcalFolder ) { | |
303 | cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl; | |
304 | return 0; | |
305 | } | |
306 | ||
307 | TFolder * emcalSubFolder = 0 ; | |
308 | if(file) | |
309 | emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ; | |
310 | else | |
311 | emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ; | |
312 | ||
313 | if(!emcalSubFolder) { | |
314 | cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl; | |
315 | return 0; | |
316 | } | |
317 | ||
318 | TObject * dis = emcalSubFolder->FindObject(name) ; | |
319 | if(!dis) | |
320 | return 0 ; | |
321 | else | |
472319e5 | 322 | return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ; |
ffa6d63b | 323 | |
324 | } | |
325 | ||
326 | //____________________________________________________________________________ | |
327 | Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const | |
328 | { //---------- SDigitizer ------------------------- | |
329 | ||
330 | // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname | |
331 | ||
332 | ||
333 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; | |
334 | ||
335 | if ( !sd ) { | |
336 | cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; | |
337 | return kFALSE ; | |
338 | } | |
339 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; | |
340 | if ( !emcal ) { | |
d75bea67 | 341 | if (fDebug) { |
ffa6d63b | 342 | cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl; |
343 | cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl; | |
d75bea67 | 344 | } |
ffa6d63b | 345 | emcal = new TTask("EMCAL", "") ; |
346 | sd->Add(emcal) ; | |
347 | } | |
348 | AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() )); | |
349 | if (emcalsd) { | |
d75bea67 | 350 | if (fDebug) |
ffa6d63b | 351 | cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ; |
352 | emcal->GetListOfTasks()->Remove(emcalsd) ; | |
353 | } | |
354 | emcal->Add(sdigitizer) ; | |
355 | return kTRUE; | |
356 | ||
357 | } | |
358 | ||
359 | //____________________________________________________________________________ | |
472319e5 | 360 | TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const |
ffa6d63b | 361 | { |
362 | ||
363 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; | |
364 | if ( !sd ) { | |
365 | cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; | |
366 | abort(); | |
367 | } | |
368 | ||
369 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; | |
370 | if ( !emcal ) { | |
371 | cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl; | |
372 | abort(); | |
373 | } | |
374 | ||
375 | TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ; | |
376 | ||
472319e5 | 377 | return emcal->GetListOfTasks()->GetObjectRef(task) ; |
ffa6d63b | 378 | |
379 | } | |
380 | ||
381 | //____________________________________________________________________________ | |
382 | Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const | |
383 | { //---------- SDigitizer ------------------------- | |
384 | ||
385 | // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname | |
386 | ||
387 | ||
388 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ; | |
389 | if ( !sd ) { | |
390 | cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl; | |
391 | return kFALSE ; | |
392 | } | |
393 | ||
394 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; | |
395 | if ( !emcal ) { | |
d75bea67 | 396 | if (fDebug) { |
ffa6d63b | 397 | cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl; |
398 | cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl; | |
d75bea67 | 399 | } |
ffa6d63b | 400 | emcal = new TTask("EMCAL", "") ; |
401 | sd->Add(emcal) ; | |
402 | } | |
403 | ||
404 | TString sdname(name) ; | |
405 | sdname.Append(":") ; | |
406 | sdname.Append(file); | |
54b82aa4 | 407 | sdname.ReplaceAll("/","_") ; |
ffa6d63b | 408 | AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname )); |
409 | if (!emcalsd) { | |
410 | emcalsd = new AliEMCALSDigitizer() ; | |
411 | //Note, we can not call constructor with parameters: it will call Getter and scrud up everething | |
412 | emcalsd->SetName(sdname) ; | |
413 | emcalsd->SetTitle(file) ; | |
414 | emcal->Add(emcalsd) ; | |
415 | } | |
416 | return kTRUE; | |
417 | ||
418 | } | |
419 | ||
420 | //____________________________________________________________________________ | |
421 | Bool_t AliEMCALGetter::PostDigits(const char * name) const | |
422 | { //---------- Digits ------------------------- | |
423 | ||
424 | // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name | |
425 | ||
426 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ; | |
427 | ||
428 | if ( !emcalFolder ) { | |
d75bea67 | 429 | if (fDebug) { |
ffa6d63b | 430 | cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl; |
431 | cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl; | |
d75bea67 | 432 | } |
ffa6d63b | 433 | emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ; |
434 | } | |
435 | ||
436 | TObject* dig = emcalFolder->FindObject( name ) ; | |
437 | if ( !dig ) { | |
438 | TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ; | |
439 | digits->SetName(name) ; | |
440 | emcalFolder->Add(digits) ; | |
441 | } | |
442 | return kTRUE; | |
443 | } | |
444 | ||
445 | //____________________________________________________________________________ | |
472319e5 | 446 | TObject ** AliEMCALGetter::DigitsRef(const char * name) const |
ffa6d63b | 447 | { //------- Digits ---------------------- |
448 | ||
449 | // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name | |
450 | ||
451 | if ( !fDigitsFolder ) { | |
452 | cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl; | |
453 | return 0; | |
454 | } | |
455 | ||
456 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ; | |
457 | if ( !emcalFolder ) { | |
458 | cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl; | |
459 | return 0; | |
460 | } | |
461 | ||
462 | TObject * d = emcalFolder->FindObject(name) ; | |
463 | if(!d) | |
464 | return 0 ; | |
465 | else | |
472319e5 | 466 | return emcalFolder->GetListOfFolders()->GetObjectRef(d) ; |
ffa6d63b | 467 | |
468 | } | |
469 | ||
470 | //____________________________________________________________________________ | |
471 | Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const | |
472 | { //---------- Digitizer ------------------------- | |
473 | ||
474 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; | |
475 | ||
476 | if ( !sd ) { | |
477 | cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl; | |
478 | return kFALSE ; | |
479 | } | |
480 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; | |
481 | if ( !emcal ) { | |
d75bea67 | 482 | if (fDebug) { |
ffa6d63b | 483 | cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl; |
484 | cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl; | |
d75bea67 | 485 | } |
ffa6d63b | 486 | emcal = new TTask("EMCAL", "") ; |
487 | sd->Add(emcal) ; | |
488 | } | |
489 | ||
490 | AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ; | |
491 | if (emcald) { | |
492 | emcald->Delete() ; | |
493 | emcal->GetListOfTasks()->Remove(emcald) ; | |
494 | } | |
495 | emcal->Add(digitizer) ; | |
496 | return kTRUE; | |
497 | } | |
498 | ||
499 | //____________________________________________________________________________ | |
500 | Bool_t AliEMCALGetter::PostDigitizer(const char * name) const | |
501 | { //---------- Digitizer ------------------------- | |
502 | ||
503 | // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname | |
504 | ||
505 | TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; | |
506 | if ( !d ) { | |
507 | cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl; | |
508 | return kFALSE ; | |
509 | } | |
510 | ||
511 | TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ; | |
512 | if ( !emcal ) { | |
d75bea67 | 513 | if (fDebug) { |
ffa6d63b | 514 | cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl; |
515 | cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl; | |
d75bea67 | 516 | } |
ffa6d63b | 517 | emcal = new TTask("EMCAL", "") ; |
518 | d->Add(emcal) ; | |
519 | } | |
520 | ||
521 | AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ; | |
522 | if (!emcald) { | |
523 | emcald = new AliEMCALDigitizer() ; | |
524 | emcald->SetName(fDigitsTitle) ; | |
525 | emcald->SetTitle(fHeaderFile) ; | |
526 | emcal->Add(emcald) ; | |
527 | } | |
528 | return kTRUE; | |
529 | } | |
530 | ||
531 | //____________________________________________________________________________ | |
472319e5 | 532 | TObject ** AliEMCALGetter::DigitizerRef(const char * name) const |
ffa6d63b | 533 | { |
534 | TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ; | |
535 | if ( !sd ) { | |
536 | cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl; | |
537 | abort(); | |
538 | } | |
539 | ||
540 | TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ; | |
541 | if ( !emcal ) { | |
542 | cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl; | |
543 | abort(); | |
544 | } | |
545 | ||
546 | TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ; | |
547 | ||
472319e5 | 548 | return emcal->GetListOfTasks()->GetObjectRef(task) ; |
ffa6d63b | 549 | |
550 | } | |
551 | ||
d75bea67 | 552 | //____________________________________________________________________________ |
d75bea67 | 553 | Bool_t AliEMCALGetter::PostRecPoints(const char * name) const |
554 | { // -------------- RecPoints ------------------------------------------- | |
555 | ||
f07cab21 | 556 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name |
557 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name | |
d75bea67 | 558 | |
559 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ; | |
560 | ||
561 | if ( !emcalFolder ) { | |
562 | if (fDebug) { | |
563 | cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; | |
564 | cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl; | |
565 | } | |
566 | emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; | |
567 | } | |
568 | ||
f07cab21 | 569 | // Tower RecPoints |
570 | TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ; | |
571 | if ( !emcalRPoTowerFolder ) { | |
d75bea67 | 572 | if (fDebug) { |
f07cab21 | 573 | cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl; |
574 | cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl; | |
d75bea67 | 575 | } |
f07cab21 | 576 | emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ; |
d75bea67 | 577 | } |
578 | ||
579 | TObject * erp = emcalFolder->FindObject( name ) ; | |
580 | if ( !erp ) { | |
f07cab21 | 581 | TObjArray * towerrp = new TObjArray(100) ; |
582 | towerrp->SetName(name) ; | |
583 | emcalRPoTowerFolder->Add(towerrp) ; | |
d75bea67 | 584 | } |
585 | ||
f07cab21 | 586 | // Pre Shower RecPoints |
587 | TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ; | |
588 | if ( !emcalRPoPreShoFolder ) { | |
d75bea67 | 589 | if (fDebug) { |
f07cab21 | 590 | cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl; |
591 | cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl; | |
d75bea67 | 592 | } |
f07cab21 | 593 | emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ; |
d75bea67 | 594 | } |
595 | ||
f07cab21 | 596 | TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ; |
d75bea67 | 597 | if ( !crp ) { |
f07cab21 | 598 | TObjArray * preshorp = new TObjArray(100) ; |
599 | preshorp->SetName(name) ; | |
600 | emcalRPoPreShoFolder->Add(preshorp) ; | |
d75bea67 | 601 | } |
602 | return kTRUE; | |
603 | } | |
604 | ||
605 | //____________________________________________________________________________ | |
f07cab21 | 606 | TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const |
d75bea67 | 607 | { // -------------- RecPoints ------------------------------------------- |
608 | ||
f07cab21 | 609 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name |
d75bea67 | 610 | |
611 | if ( !fRecoFolder ) { | |
f07cab21 | 612 | cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl; |
d75bea67 | 613 | return 0 ; |
614 | } | |
615 | ||
f07cab21 | 616 | TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; |
617 | if ( !towerFolder ) { | |
618 | cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl; | |
d75bea67 | 619 | return 0; |
620 | } | |
621 | ||
622 | ||
f07cab21 | 623 | TObject * trp = towerFolder->FindObject(name ) ; |
624 | if ( !trp ) { | |
d75bea67 | 625 | return 0 ; |
626 | } | |
f07cab21 | 627 | return towerFolder->GetListOfFolders()->GetObjectRef(trp) ; |
d75bea67 | 628 | |
629 | } | |
630 | ||
631 | //____________________________________________________________________________ | |
f07cab21 | 632 | TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const |
d75bea67 | 633 | { // -------------- RecPoints ------------------------------------------- |
634 | ||
f07cab21 | 635 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name |
d75bea67 | 636 | |
637 | if ( !fRecoFolder ) { | |
f07cab21 | 638 | cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl; |
d75bea67 | 639 | return 0 ; |
640 | } | |
641 | ||
f07cab21 | 642 | TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ; |
643 | if ( !preshoFolder ) { | |
644 | cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl; | |
d75bea67 | 645 | return 0; |
646 | } | |
647 | ||
f07cab21 | 648 | TObject * prp = preshoFolder->FindObject(name ) ; |
649 | if ( !prp ) { | |
d75bea67 | 650 | return 0 ; |
651 | } | |
f07cab21 | 652 | return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ; |
d75bea67 | 653 | |
654 | } | |
655 | ||
656 | //____________________________________________________________________________ | |
ea4de7a2 | 657 | Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const |
d75bea67 | 658 | { // ------------------ AliEMCALClusterizer ------------------------ |
659 | ||
660 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname | |
661 | ||
662 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
663 | ||
664 | if ( !tasks ) { | |
665 | cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
666 | return kFALSE ; | |
667 | } | |
668 | ||
669 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
670 | if ( !emcal ) { | |
671 | if (fDebug) { | |
672 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl; | |
673 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; | |
674 | } | |
675 | emcal = new TTask("EMCAL", "") ; | |
676 | tasks->Add(emcal) ; | |
677 | } | |
678 | ||
ea4de7a2 | 679 | AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ; |
d75bea67 | 680 | if (emcalcl) { |
681 | if (fDebug) | |
682 | cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ; | |
683 | emcalcl->Delete() ; | |
684 | emcal->GetListOfTasks()->Remove(emcalcl) ; | |
685 | } | |
686 | emcal->Add(clu) ; | |
687 | return kTRUE; | |
688 | } | |
689 | ||
690 | //____________________________________________________________________________ | |
472319e5 | 691 | TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const |
d75bea67 | 692 | { // ------------------ AliEMCALClusterizer ------------------------ |
693 | ||
694 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
695 | ||
696 | if ( !tasks ) { | |
697 | cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
698 | return kFALSE ; | |
699 | } | |
700 | ||
701 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
702 | if ( !emcal ) { | |
703 | cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; | |
704 | return 0 ; | |
705 | } | |
706 | ||
707 | TList * l = emcal->GetListOfTasks() ; | |
708 | TIter it(l) ; | |
709 | TTask * task ; | |
710 | TTask * clu = 0 ; | |
711 | TString cluname(name) ; | |
712 | cluname+=":clu-" ; | |
713 | while((task = static_cast<TTask *>(it.Next()) )){ | |
714 | TString taskname(task->GetName()) ; | |
715 | if(taskname.BeginsWith(cluname)){ | |
716 | clu = task ; | |
717 | break ; | |
718 | } | |
719 | } | |
720 | ||
721 | if(clu) | |
472319e5 | 722 | return l->GetObjectRef(clu) ; |
d75bea67 | 723 | else |
724 | return 0 ; | |
725 | } | |
726 | ||
727 | //____________________________________________________________________________ | |
728 | Bool_t AliEMCALGetter::PostClusterizer(const char * name) const | |
729 | { // ------------------ AliEMCALClusterizer ------------------------ | |
730 | ||
731 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname | |
732 | ||
733 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
734 | ||
735 | if ( !tasks ) { | |
736 | cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
737 | return kFALSE ; | |
738 | } | |
739 | ||
740 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
741 | if ( !emcal ) { | |
742 | if (fDebug) { | |
743 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; | |
744 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; | |
745 | } | |
746 | emcal = new TTask("EMCAL", "") ; | |
747 | tasks->Add(emcal) ; | |
748 | } | |
749 | ||
ea4de7a2 | 750 | AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ; |
d75bea67 | 751 | TString clun(name) ; |
752 | clun+=":clu-v1" ; | |
753 | emcalcl->SetName(clun) ; | |
754 | emcal->Add(emcalcl) ; | |
755 | return kTRUE; | |
756 | ||
757 | } | |
758 | ||
759 | //____________________________________________________________________________ | |
f07cab21 | 760 | /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const |
d75bea67 | 761 | { // ---------------TrackSegments ----------------------------------- |
762 | ||
763 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name | |
764 | ||
765 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ; | |
766 | ||
767 | if ( !emcalFolder ) { | |
768 | if (fDebug) { | |
769 | cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; | |
770 | cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl; | |
771 | } | |
772 | emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; | |
773 | } | |
774 | ||
775 | TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ; | |
776 | if ( !emcalTSFolder ) { | |
777 | if (fDebug) { | |
778 | cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl; | |
779 | cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl; | |
780 | } | |
781 | emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ; | |
782 | } | |
783 | ||
784 | TObject * tss = emcalTSFolder->FindObject( name ) ; | |
785 | if (!tss) { | |
786 | TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ; | |
787 | ts->SetName(name) ; | |
788 | emcalTSFolder->Add(ts) ; | |
789 | } | |
790 | return kTRUE; | |
791 | } | |
792 | ||
793 | //____________________________________________________________________________ | |
472319e5 | 794 | TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const |
d75bea67 | 795 | { // ---------------TrackSegments ----------------------------------- |
796 | ||
797 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name | |
798 | ||
799 | if ( !fRecoFolder ) { | |
800 | cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl; | |
801 | return 0 ; | |
802 | } | |
803 | ||
804 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; | |
805 | if ( !emcalFolder ) { | |
806 | cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl; | |
807 | return 0; | |
808 | } | |
809 | ||
810 | TObject * tss = emcalFolder->FindObject(name) ; | |
811 | if (!tss) { | |
812 | return 0 ; | |
813 | } | |
472319e5 | 814 | return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ; |
d75bea67 | 815 | } |
816 | ||
817 | //____________________________________________________________________________ | |
818 | Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const | |
819 | { //------------Track Segment Maker ------------------------------ | |
820 | ||
821 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname | |
822 | ||
823 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
824 | ||
825 | if ( !tasks ) { | |
826 | cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
827 | return kFALSE ; | |
828 | } | |
829 | ||
830 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
831 | if ( !emcal ) { | |
832 | if (fDebug) { | |
833 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; | |
834 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; | |
835 | } | |
836 | emcal = new TTask("EMCAL", "") ; | |
837 | tasks->Add(emcal) ; | |
838 | } | |
839 | ||
840 | AliEMCALTrackSegmentMaker * emcalts = | |
841 | dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ; | |
842 | if (emcalts) { | |
843 | emcalts->Delete() ; | |
844 | emcal->GetListOfTasks()->Remove(emcalts) ; | |
845 | } | |
846 | emcal->Add(tsmaker) ; | |
847 | return kTRUE; | |
848 | ||
849 | } | |
850 | //____________________________________________________________________________ | |
851 | Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const | |
852 | { //------------Track Segment Maker ------------------------------ | |
853 | ||
854 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname | |
855 | ||
856 | ||
857 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
858 | ||
859 | if ( !tasks ) { | |
860 | cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
861 | return kFALSE ; | |
862 | } | |
863 | ||
864 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
865 | if ( !emcal ) { | |
866 | if (fDebug) { | |
867 | cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; | |
868 | cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; | |
869 | } | |
870 | emcal = new TTask("EMCAL", "") ; | |
871 | tasks->Add(emcal) ; | |
872 | } | |
873 | ||
874 | AliEMCALTrackSegmentMaker * emcalts = | |
875 | dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ; | |
876 | if (!emcalts) { | |
877 | emcalts = new AliEMCALTrackSegmentMakerv1() ; | |
878 | TString tsn(name); | |
879 | tsn+=":tsm-v1" ; | |
880 | emcalts->SetName(tsn) ; | |
881 | emcal->Add(emcalts) ; | |
882 | } | |
883 | return kTRUE; | |
884 | ||
885 | } | |
886 | ||
887 | //____________________________________________________________________________ | |
472319e5 | 888 | TObject ** AliEMCALGetter::TSMakerRef(const char * name) const |
d75bea67 | 889 | { //------------Track Segment Maker ------------------------------ |
890 | ||
891 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
892 | ||
893 | if ( !tasks ) { | |
894 | cerr << "ERROR: AliEMCALGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
895 | return kFALSE ; | |
896 | } | |
897 | ||
898 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
899 | if ( !emcal ) { | |
900 | cerr <<"WARNING: AliEMCALGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; | |
901 | return 0 ; | |
902 | } | |
903 | ||
904 | TList * l = emcal->GetListOfTasks() ; | |
905 | TIter it(l) ; | |
906 | TTask * task ; | |
907 | TTask * tsm = 0 ; | |
908 | TString tsmname(name) ; | |
909 | tsmname+=":tsm-" ; | |
910 | while((task = static_cast<TTask *>(it.Next()) )){ | |
911 | TString taskname(task->GetName()) ; | |
912 | if(taskname.BeginsWith(tsmname)){ | |
913 | tsm = task ; | |
914 | break ; | |
915 | } | |
916 | } | |
917 | ||
918 | if(tsm) | |
472319e5 | 919 | return l->GetObjectRef(tsm) ; |
d75bea67 | 920 | else |
921 | return 0 ; | |
922 | ||
923 | } | |
924 | ||
925 | //____________________________________________________________________________ | |
926 | Bool_t AliEMCALGetter::PostRecParticles(const char * name) const | |
927 | { // -------------------- RecParticles ------------------------ | |
928 | ||
929 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name | |
930 | ||
931 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ; | |
932 | ||
933 | if ( !emcalFolder ) { | |
934 | if (fDebug) { | |
935 | cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl; | |
936 | cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl; | |
937 | } | |
938 | emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ; | |
939 | } | |
940 | ||
941 | TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ; | |
942 | if ( !emcalRPaFolder ) { | |
943 | if (fDebug) { | |
944 | cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl; | |
945 | cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl; | |
946 | } | |
947 | emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ; | |
948 | } | |
949 | ||
950 | TObject * rps = emcalRPaFolder->FindObject( name ) ; | |
951 | if ( !rps ) { | |
952 | TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ; | |
953 | rp->SetName(name) ; | |
954 | emcalRPaFolder->Add(rp) ; | |
955 | } | |
956 | return kTRUE; | |
957 | } | |
958 | ||
959 | //____________________________________________________________________________ | |
472319e5 | 960 | TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const |
d75bea67 | 961 | { // ---------------TrackSegments ----------------------------------- |
962 | ||
963 | // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name | |
964 | ||
965 | if ( !fRecoFolder ) { | |
966 | cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl; | |
967 | return 0 ; | |
968 | } | |
969 | ||
970 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ; | |
971 | if ( !emcalFolder ) { | |
972 | cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl; | |
973 | return 0; | |
974 | } | |
975 | ||
976 | TObject * tss = emcalFolder->FindObject(name ) ; | |
977 | if (!tss) { | |
978 | return 0 ; | |
979 | } | |
472319e5 | 980 | return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ; |
d75bea67 | 981 | } |
982 | ||
983 | //____________________________________________________________________________ | |
984 | Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const | |
985 | { // ------------AliEMCAL PID ----------------------------- | |
986 | ||
987 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
988 | ||
989 | if ( !tasks ) { | |
990 | cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
991 | return kFALSE ; | |
992 | } | |
993 | ||
994 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
995 | if ( !emcal ) { | |
996 | if (fDebug) { | |
997 | cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; | |
998 | cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; | |
999 | } | |
1000 | emcal = new TTask("EMCAL", "") ; | |
1001 | tasks->Add(emcal) ; | |
1002 | } | |
1003 | ||
1004 | AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ; | |
1005 | if (emcalpid) { | |
1006 | if (fDebug) | |
1007 | cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName() | |
1008 | << " already exists" << endl ; | |
1009 | emcal->GetListOfTasks()->Remove(emcalpid) ; | |
1010 | } | |
1011 | ||
1012 | emcal->Add(pid) ; | |
1013 | return kTRUE; | |
1014 | } | |
1015 | ||
1016 | //____________________________________________________________________________ | |
1017 | Bool_t AliEMCALGetter::PostPID(const char * name) const | |
1018 | { | |
1019 | // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname | |
1020 | ||
1021 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
1022 | ||
1023 | if ( !tasks ) { | |
1024 | cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
1025 | return kFALSE ; | |
1026 | } | |
1027 | ||
1028 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
1029 | if ( !emcal ) { | |
1030 | if (fDebug) { | |
1031 | cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl; | |
1032 | cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl; | |
1033 | } | |
1034 | emcal = new TTask("EMCAL", "") ; | |
1035 | tasks->Add(emcal) ; | |
1036 | } | |
1037 | ||
1038 | TList * l = emcal->GetListOfTasks() ; | |
1039 | TIter it(l) ; | |
1040 | TString pidname(name) ; | |
1041 | pidname+=":pid" ; | |
1042 | TTask * task ; | |
1043 | while((task = static_cast<TTask *>(it.Next()) )){ | |
1044 | TString taskname(task->GetName()) ; | |
1045 | if(taskname.BeginsWith(pidname)) | |
1046 | return kTRUE ; | |
1047 | } | |
1048 | ||
1049 | AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ; | |
1050 | pidname+="-v1" ; | |
1051 | emcalpid->SetName(pidname) ; | |
1052 | emcal->Add(emcalpid) ; | |
1053 | ||
1054 | return kTRUE; | |
1055 | } | |
1056 | ||
1057 | //____________________________________________________________________________ | |
472319e5 | 1058 | TObject ** AliEMCALGetter::PIDRef(const char * name) const |
d75bea67 | 1059 | { //------------PID ------------------------------ |
1060 | ||
1061 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ; | |
1062 | ||
1063 | if ( !tasks ) { | |
1064 | cerr << "ERROR: AliEMCALGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl; | |
1065 | return kFALSE ; | |
1066 | } | |
1067 | ||
1068 | TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
1069 | if ( !emcal ) { | |
1070 | cerr <<"WARNING: AliEMCALGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl; | |
1071 | return 0 ; | |
1072 | } | |
1073 | ||
1074 | TList * l = emcal->GetListOfTasks() ; | |
1075 | TIter it(l) ; | |
1076 | TTask * task ; | |
1077 | TTask * pid = 0 ; | |
1078 | TString pidname(name) ; | |
1079 | pidname+=":pid-" ; | |
1080 | while((task = static_cast<TTask *>(it.Next()) )){ | |
1081 | TString taskname(task->GetName()) ; | |
1082 | if(taskname.BeginsWith(pidname)){ | |
1083 | pid = task ; | |
1084 | break ; | |
1085 | } | |
1086 | } | |
1087 | ||
1088 | if(pid) | |
472319e5 | 1089 | return l->GetObjectRef(pid) ; |
d75bea67 | 1090 | else |
1091 | return 0 ; | |
1092 | ||
1093 | } | |
1094 | ||
1095 | //____________________________________________________________________________ | |
1096 | Bool_t AliEMCALGetter::PostQA(void) const | |
1097 | { // ------------------ QA --------------------------------- | |
1098 | ||
1099 | // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName | |
1100 | ||
1101 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ; | |
1102 | if ( !emcalFolder ) { | |
1103 | if (fDebug) { | |
1104 | cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl; | |
1105 | cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl; | |
1106 | } | |
1107 | emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ; | |
1108 | } | |
1109 | ||
1110 | return kTRUE; | |
1111 | } | |
1112 | ||
1113 | //____________________________________________________________________________ | |
472319e5 | 1114 | TObject ** AliEMCALGetter::AlarmsRef(void) const |
d75bea67 | 1115 | { //------- Alarms ---------------------- |
1116 | ||
1117 | ||
1118 | // the hierarchy is //Folders/Run/Conditions/QA/EMCAL | |
1119 | if ( !fQAFolder ) { | |
1120 | cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl; | |
1121 | return 0; | |
1122 | } | |
1123 | ||
1124 | TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ; | |
1125 | if ( !emcalFolder ) { | |
1126 | cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl; | |
1127 | return 0; | |
1128 | } | |
1129 | ||
472319e5 | 1130 | return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ; |
d75bea67 | 1131 | } |
1132 | */ | |
ffa6d63b | 1133 | //____________________________________________________________________________ |
1134 | const TParticle * AliEMCALGetter::Primary(Int_t index) const | |
1135 | { | |
1136 | // Return primary particle numbered by <index> | |
f07cab21 | 1137 | |
ffa6d63b | 1138 | if(index < 0) |
1139 | return 0 ; | |
1140 | ||
1141 | Int_t primaryIndex = index % 10000000 ; | |
1142 | Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ; | |
1143 | ||
1144 | if ( primaryList > 0 ) { | |
d75bea67 | 1145 | if (fDebug) { |
ffa6d63b | 1146 | cout << " Getter does not support currently Mixing of primary " << endl ; |
1147 | cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ; | |
d75bea67 | 1148 | } |
ffa6d63b | 1149 | return 0; |
1150 | } | |
1151 | ||
1152 | return gAlice->Particle(primaryIndex) ; | |
1153 | ||
1154 | } | |
1155 | ||
1156 | //____________________________________________________________________________ | |
1157 | void AliEMCALGetter::ReadTreeD() | |
1158 | { | |
1159 | // Read the digit tree gAlice->TreeD() | |
1160 | if(gAlice->TreeD()== 0){ | |
1161 | cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ; | |
1162 | return ; | |
1163 | } | |
d75bea67 | 1164 | |
ffa6d63b | 1165 | TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ; |
1166 | TIter next(lob) ; | |
1167 | TBranch * branch = 0 ; | |
1168 | TBranch * digitsbranch = 0 ; | |
1169 | TBranch * digitizerbranch = 0 ; | |
1170 | Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ; | |
1171 | ||
1172 | while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) { | |
1173 | if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { | |
1174 | digitsbranch = branch ; | |
1175 | emcalfound = kTRUE ; | |
1176 | } | |
1177 | else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) { | |
1178 | digitizerbranch = branch ; | |
1179 | digitizerfound = kTRUE ; | |
1180 | } | |
1181 | } | |
1182 | ||
1183 | if ( !emcalfound || !digitizerfound ) { | |
d75bea67 | 1184 | if (fDebug) |
ffa6d63b | 1185 | cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name " |
1186 | << fDigitsTitle << endl ; | |
1187 | return ; | |
1188 | } | |
1189 | ||
1190 | //read digits | |
1191 | if(!Digits(fDigitsTitle) ) | |
1192 | PostDigits(fDigitsTitle); | |
1193 | digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ; | |
1194 | digitsbranch->GetEntry(0) ; | |
1195 | ||
1196 | ||
1197 | // read the Digitizer | |
1198 | if(!Digitizer(fDigitsTitle)) | |
1199 | PostDigitizer(fDigitsTitle) ; | |
1200 | digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ; | |
1201 | digitizerbranch->GetEntry(0) ; | |
1202 | ||
1203 | ||
1204 | } | |
1205 | ||
1206 | //____________________________________________________________________________ | |
1207 | void AliEMCALGetter::ReadTreeH() | |
1208 | { | |
1209 | // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() | |
1210 | ||
1211 | if(gAlice->TreeH()== 0){ | |
1212 | cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ; | |
1213 | return ; | |
1214 | } | |
1215 | ||
1216 | TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ; | |
1217 | if ( !hitsbranch ) { | |
d75bea67 | 1218 | if (fDebug) |
ffa6d63b | 1219 | cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ; |
1220 | return ; | |
1221 | } | |
1222 | if(!Hits()) | |
1223 | PostHits() ; | |
472319e5 | 1224 | |
1225 | if (hitsbranch->GetEntries() > 1 ) { | |
1226 | TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ; | |
1227 | TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ; | |
1228 | hitsbranch->SetAddress(&tempo) ; | |
1229 | Int_t index = 0 ; | |
1230 | Int_t i = 0 ; | |
1231 | for (i = 0 ; i < hitsbranch->GetEntries() ; i++) { | |
1232 | hitsbranch->GetEntry(i) ; | |
1233 | Int_t j = 0 ; | |
1234 | for ( j = 0 ; j < tempo->GetEntries() ; j++) { | |
1235 | const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ; | |
1236 | new((*hits)[index]) AliEMCALHit( *hit ) ; | |
1237 | index++ ; | |
1238 | } | |
1239 | } | |
1240 | delete tempo ; | |
1241 | } | |
1242 | else { | |
ffa6d63b | 1243 | hitsbranch->SetAddress(HitsRef()) ; |
ffa6d63b | 1244 | hitsbranch->GetEntry(0) ; |
472319e5 | 1245 | } |
ffa6d63b | 1246 | } |
1247 | ||
1248 | //____________________________________________________________________________ | |
1249 | void AliEMCALGetter::Track(Int_t itrack) | |
1250 | { | |
1251 | // Read the first entry of EMCAL branch in hit tree gAlice->TreeH() | |
1252 | ||
1253 | if(gAlice->TreeH()== 0){ | |
1254 | cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ; | |
1255 | return ; | |
1256 | } | |
1257 | ||
1258 | TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ; | |
1259 | if ( !hitsbranch ) { | |
d75bea67 | 1260 | if (fDebug) |
ffa6d63b | 1261 | cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ; |
1262 | return ; | |
1263 | } | |
1264 | if(!Hits()) | |
1265 | PostHits() ; | |
1266 | hitsbranch->SetAddress(HitsRef()) ; | |
1267 | hitsbranch->GetEntry(itrack) ; | |
1268 | ||
f07cab21 | 1269 | |
ffa6d63b | 1270 | } |
1271 | //____________________________________________________________________________ | |
f07cab21 | 1272 | // void AliEMCALGetter::ReadTreeQA() |
1273 | //{ | |
d75bea67 | 1274 | // Read the digit tree gAlice->TreeQA() |
1275 | // so far only EMCAL knows about this Tree | |
1276 | ||
f07cab21 | 1277 | // if(EMCAL()->TreeQA()== 0){ |
1278 | // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ; | |
1279 | // return ; | |
1280 | // } | |
d75bea67 | 1281 | |
f07cab21 | 1282 | // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ; |
1283 | // if (!qabranch) { | |
1284 | // if (fDebug) | |
1285 | // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ; | |
1286 | // return ; | |
1287 | // } | |
d75bea67 | 1288 | |
f07cab21 | 1289 | // if(!Alarms()) |
1290 | // PostQA() ; | |
d75bea67 | 1291 | |
f07cab21 | 1292 | // qabranch->SetAddress(AlarmsRef()) ; |
d75bea67 | 1293 | |
f07cab21 | 1294 | // qabranch->GetEntry(0) ; |
d75bea67 | 1295 | |
1296 | // PostQA("EMCAL") ; | |
1297 | // TFolder * alarmsF = Alarms() ; | |
1298 | // alarmsF->Clear() ; | |
1299 | // qabranch->SetAddress(&alarmsF) ; | |
1300 | // qabranch->GetEntry(0) ; | |
1301 | ||
f07cab21 | 1302 | //} |
1303 | ||
d75bea67 | 1304 | //____________________________________________________________________________ |
1305 | void AliEMCALGetter::ReadTreeR() | |
1306 | { | |
f07cab21 | 1307 | // Read the reconstrunction tree gAlice->TreeR() |
d75bea67 | 1308 | |
1309 | if(gAlice->TreeR()== 0){ | |
1310 | cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ; | |
1311 | return ; | |
1312 | } | |
1313 | ||
1314 | // RecPoints | |
1315 | TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ; | |
1316 | TIter next(lob) ; | |
1317 | TBranch * branch = 0 ; | |
f07cab21 | 1318 | TBranch * towerbranch = 0 ; |
1319 | TBranch * preshobranch = 0 ; | |
d75bea67 | 1320 | TBranch * clusterizerbranch = 0 ; |
f07cab21 | 1321 | Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ; |
d75bea67 | 1322 | |
f07cab21 | 1323 | while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) ) |
d75bea67 | 1324 | if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) { |
f07cab21 | 1325 | if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) { |
1326 | towerbranch = branch ; | |
1327 | emcaltowerrpfound = kTRUE ; | |
d75bea67 | 1328 | } |
f07cab21 | 1329 | else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) { |
1330 | preshobranch = branch ; | |
1331 | emcalpreshorpfound = kTRUE ; | |
d75bea67 | 1332 | } |
1333 | else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){ | |
1334 | clusterizerbranch = branch ; | |
1335 | clusterizerfound = kTRUE ; | |
1336 | } | |
1337 | } | |
1338 | ||
f07cab21 | 1339 | if ( !emcaltowerrpfound ) { |
d75bea67 | 1340 | if (fDebug) |
f07cab21 | 1341 | cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title " |
d75bea67 | 1342 | << fRecPointsTitle << endl ; |
1343 | return ; | |
1344 | } | |
f07cab21 | 1345 | if ( !emcalpreshorpfound ) { |
d75bea67 | 1346 | if (fDebug) |
f07cab21 | 1347 | cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title " |
d75bea67 | 1348 | << fRecPointsTitle << endl ; |
1349 | return ; | |
1350 | } | |
1351 | if ( !clusterizerfound ) { | |
1352 | if (fDebug) | |
1353 | cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title " | |
1354 | << fRecPointsTitle << endl ; | |
1355 | return ; | |
1356 | } | |
1357 | ||
1358 | // Read and Post the RecPoints | |
f07cab21 | 1359 | if(!TowerRecPoints(fRecPointsTitle) ) |
d75bea67 | 1360 | PostRecPoints(fRecPointsTitle) ; |
f07cab21 | 1361 | towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ; |
1362 | towerbranch->GetEntry(0) ; | |
d75bea67 | 1363 | |
f07cab21 | 1364 | preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ; |
1365 | preshobranch->GetEntry(0) ; | |
d75bea67 | 1366 | |
1367 | if(!Clusterizer(fRecPointsTitle) ) | |
1368 | PostClusterizer(fRecPointsTitle) ; | |
1369 | clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ; | |
1370 | clusterizerbranch->GetEntry(0) ; | |
1371 | ||
1372 | ||
1373 | //------------------- TrackSegments --------------------- | |
f07cab21 | 1374 | // next.Reset() ; |
1375 | // TBranch * tsbranch = 0 ; | |
1376 | // TBranch * tsmakerbranch = 0 ; | |
1377 | // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ; | |
d75bea67 | 1378 | |
f07cab21 | 1379 | // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) ) |
1380 | // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) { | |
1381 | // if ( strcmp(branch->GetName(), "EMCALTS")==0){ | |
1382 | // tsbranch = branch ; | |
1383 | // emcaltsfound = kTRUE ; | |
1384 | // } | |
1385 | // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) { | |
1386 | // tsmakerbranch = branch ; | |
1387 | // tsmakerfound = kTRUE ; | |
1388 | // } | |
1389 | // } | |
1390 | ||
1391 | // if ( !emcaltsfound || !tsmakerfound ) { | |
1392 | // if (fDebug) | |
1393 | // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name " | |
1394 | // << fTrackSegmentsTitle << endl ; | |
1395 | // return ; | |
1396 | // } | |
1397 | ||
1398 | // // Read and Post the TrackSegments | |
1399 | // if(!TrackSegments(fTrackSegmentsTitle)) | |
1400 | // PostTrackSegments(fTrackSegmentsTitle) ; | |
1401 | // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ; | |
1402 | // tsbranch->GetEntry(0) ; | |
1403 | ||
1404 | // // Read and Post the TrackSegment Maker | |
1405 | // if(!TrackSegmentMaker(fTrackSegmentsTitle)) | |
1406 | // PostTrackSegmentMaker(fTrackSegmentsTitle) ; | |
1407 | // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ; | |
1408 | // tsmakerbranch->GetEntry(0) ; | |
1409 | ||
1410 | ||
1411 | // //------------ RecParticles ---------------------------- | |
1412 | // next.Reset() ; | |
1413 | // TBranch * rpabranch = 0 ; | |
1414 | // TBranch * pidbranch = 0 ; | |
1415 | // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ; | |
1416 | ||
1417 | // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) ) | |
1418 | // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) { | |
1419 | // if ( strcmp(branch->GetName(), "EMCALRP")==0) { | |
1420 | // rpabranch = branch ; | |
1421 | // emcalrpafound = kTRUE ; | |
1422 | // } | |
1423 | // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) { | |
1424 | // pidbranch = branch ; | |
1425 | // pidfound = kTRUE ; | |
1426 | // } | |
1427 | // } | |
1428 | ||
1429 | // if ( !emcalrpafound || !pidfound ) { | |
1430 | // if (fDebug) | |
1431 | // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name " | |
1432 | // << fRecParticlesTitle << endl ; | |
1433 | // return ; | |
1434 | // } | |
1435 | ||
1436 | // // Read and Post the RecParticles | |
1437 | // if(!RecParticles(fRecParticlesTitle)) | |
1438 | // PostRecParticles(fRecParticlesTitle) ; | |
1439 | // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ; | |
1440 | // rpabranch->GetEntry(0) ; | |
1441 | ||
1442 | // // Read and Post the PID | |
1443 | // if(!PID(fRecParticlesTitle)) | |
1444 | // PostPID(fRecParticlesTitle) ; | |
1445 | // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ; | |
1446 | // pidbranch->GetEntry(0) ; | |
d75bea67 | 1447 | |
1448 | ||
1449 | } | |
f07cab21 | 1450 | |
d75bea67 | 1451 | //____________________________________________________________________________ |
ffa6d63b | 1452 | void AliEMCALGetter::ReadTreeS(Int_t event) |
1453 | { | |
1454 | // Read the summable digits tree gAlice->TreeS() | |
1455 | ||
1456 | // loop over all opened files and read their SDigits to the White Board | |
1457 | TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ; | |
1458 | if (!emcalF) | |
1459 | emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; | |
1460 | TCollection * folderslist = emcalF->GetListOfFolders() ; | |
1461 | ||
1462 | //Add current file to list if it is not there yet | |
4e5c8d4c | 1463 | |
1464 | TString subdir(fHeaderFile) ; | |
1465 | subdir.ReplaceAll("/","_") ; | |
1466 | ||
1467 | if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){ | |
1468 | emcalF->AddFolder(subdir, ""); | |
ffa6d63b | 1469 | } |
54b82aa4 | 1470 | |
ffa6d63b | 1471 | TIter next(folderslist) ; |
1472 | TFolder * folder = 0 ; | |
1473 | TFile * file; | |
1474 | TTree * treeS = 0; | |
1475 | while ( (folder = static_cast<TFolder*>(next())) ) { | |
4e5c8d4c | 1476 | TString fileName(folder->GetName()) ; |
1477 | fileName.ReplaceAll("_","/") ; | |
1478 | if(fHeaderFile.CompareTo(fileName) == 0 ) | |
d75bea67 | 1479 | treeS=gAlice->TreeS() ; |
ffa6d63b | 1480 | else{ |
4e5c8d4c | 1481 | file = static_cast<TFile*>(gROOT->GetFile(fileName)); |
ffa6d63b | 1482 | file->cd() ; |
1483 | ||
1484 | // Get SDigits Tree header from file | |
1485 | TString treeName("TreeS") ; | |
1486 | treeName += event ; | |
1487 | treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data())); | |
1488 | } | |
1489 | if(treeS==0){ | |
1490 | cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl; | |
1491 | return ; | |
1492 | } | |
54b82aa4 | 1493 | |
ffa6d63b | 1494 | //set address of the SDigits and SDigitizer |
1495 | TBranch * sdigitsBranch = 0; | |
1496 | TBranch * sdigitizerBranch = 0; | |
1497 | TBranch * branch = 0 ; | |
1498 | TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ; | |
1499 | TIter next(lob) ; | |
1500 | Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; | |
1501 | ||
1502 | while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) { | |
d75bea67 | 1503 | if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { |
ffa6d63b | 1504 | emcalfound = kTRUE ; |
1505 | sdigitsBranch = branch ; | |
d75bea67 | 1506 | } |
ffa6d63b | 1507 | |
1508 | else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) { | |
1509 | sdigitizerfound = kTRUE ; | |
1510 | sdigitizerBranch = branch ; | |
ffa6d63b | 1511 | } |
1512 | } | |
1513 | if ( !emcalfound || !sdigitizerfound ) { | |
d75bea67 | 1514 | if (fDebug) |
472319e5 | 1515 | cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle |
ffa6d63b | 1516 | << " not found" << endl ; |
1517 | return ; | |
1518 | } | |
1519 | ||
1520 | if ( !folder->FindObject(fSDigitsTitle) ) | |
d75bea67 | 1521 | PostSDigits(fSDigitsTitle,folder->GetName()) ; |
ffa6d63b | 1522 | sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ; |
ffa6d63b | 1523 | sdigitsBranch->GetEntry(0) ; |
1524 | ||
1525 | TString sdname(fSDigitsTitle) ; | |
ffa6d63b | 1526 | sdname+=":" ; |
1527 | sdname+=folder->GetName() ; | |
1528 | if(!SDigitizer(sdname) ) | |
1529 | PostSDigitizer(fSDigitsTitle,folder->GetName()) ; | |
1530 | sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; | |
1531 | sdigitizerBranch->GetEntry(0) ; | |
1532 | ||
1533 | } | |
1534 | ||
1535 | // After SDigits have been read from all files, return to the first one | |
1536 | ||
1537 | next.Reset(); | |
1538 | folder = static_cast<TFolder*>(next()); | |
1539 | if(folder){ | |
4e5c8d4c | 1540 | TString fileName(folder->GetName()) ; |
1541 | fileName.ReplaceAll("_","/") ; | |
1542 | file = static_cast<TFile*>(gROOT->GetFile(fileName)); | |
ffa6d63b | 1543 | file ->cd() ; |
1544 | } | |
1545 | ||
1546 | } | |
1547 | //____________________________________________________________________________ | |
1548 | void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input) | |
1549 | { // Read the summable digits fron treeS() | |
1550 | ||
1551 | ||
1552 | TString filename("mergefile") ; | |
1553 | filename+= input ; | |
1554 | ||
1555 | TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; | |
1556 | if ( !emcalFolder ) { | |
1557 | emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ; | |
1558 | } | |
1559 | TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ; | |
1560 | //set address of the SDigits and SDigitizer | |
1561 | TBranch * sdigitsBranch = 0; | |
1562 | TBranch * sdigitizerBranch = 0; | |
1563 | TBranch * branch = 0 ; | |
1564 | TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ; | |
1565 | TIter next(lob) ; | |
1566 | Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; | |
1567 | ||
1568 | while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) { | |
1569 | if ( strcmp(branch->GetName(), "EMCAL")==0) { | |
1570 | emcalfound = kTRUE ; | |
1571 | sdigitsBranch = branch ; | |
1572 | } | |
1573 | ||
1574 | else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) { | |
1575 | sdigitizerfound = kTRUE ; | |
1576 | sdigitizerBranch = branch ; | |
1577 | } | |
1578 | } | |
1579 | if ( !emcalfound || !sdigitizerfound ) { | |
d75bea67 | 1580 | if (fDebug) |
ffa6d63b | 1581 | cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ; |
1582 | return ; | |
1583 | } | |
1584 | ||
1585 | if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) ) | |
1586 | PostSDigits(sdigitsBranch->GetTitle(),filename) ; | |
1587 | ||
1588 | sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ; | |
d75bea67 | 1589 | sdigitsBranch->GetEntry(0) ; |
ffa6d63b | 1590 | |
1591 | TString sdname(sdigitsBranch->GetTitle()) ; | |
1592 | sdname+=":" ; | |
1593 | sdname+=filename ; | |
1594 | if(!SDigitizer(sdigitsBranch->GetTitle()) ) | |
1595 | PostSDigitizer(sdigitsBranch->GetTitle(),filename) ; | |
d75bea67 | 1596 | |
ffa6d63b | 1597 | sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; |
ffa6d63b | 1598 | sdigitizerBranch->GetEntry(0) ; |
1599 | ||
1600 | } | |
1601 | ||
1602 | ||
1603 | //____________________________________________________________________________ | |
1604 | void AliEMCALGetter::ReadPrimaries() | |
1605 | { | |
1606 | // Reads specific branches of primaries | |
1607 | ||
1608 | fNPrimaries = gAlice->GetNtrack(); | |
1609 | ||
1610 | // //Check, is it necessary to open new files | |
1611 | // TArrayI* events = fDigitizer->GetCurrentEvents() ; | |
1612 | // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ; | |
1613 | // Int_t input ; | |
1614 | // for(input = 0; input < filenames->GetEntriesFast(); input++){ | |
1615 | ||
1616 | // TObjString * filename = (TObjString *) filenames->At(input) ; | |
1617 | ||
1618 | // //Test, if this file already open | |
1619 | // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ; | |
1620 | // if(file == 0) | |
1621 | // file = new TFile( filename->GetString()) ; | |
1622 | // file->cd() ; | |
1623 | ||
1624 | // // Get Kine Tree from file | |
1625 | // // char treeName[20]; | |
1626 | // // sprintf(treeName,"TreeK%d",events->At(input)); | |
1627 | // // TTree * treeK = (TTree*)gDirectory->Get(treeName); | |
1628 | // // if (treeK) | |
1629 | // // treeK->SetBranchAddress("Particles", &fParticleBuffer); | |
1630 | // // else | |
1631 | // // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl; | |
1632 | ||
1633 | // // // Create the particle stack | |
1634 | // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000); | |
1635 | // // // Build the pointer list | |
1636 | // // if(fParticleMap) { <---- | |
1637 | // // fParticleMap->Clear(); | |
1638 | // // fParticleMap->Expand(treeK->GetEntries()); | |
1639 | // // } else | |
1640 | // // fParticleMap = new TObjArray(treeK->GetEntries()); | |
1641 | ||
1642 | // // From gAlice->Particle(i) | |
1643 | ||
1644 | ||
1645 | // // if(!(*fParticleMap)[i]) { | |
1646 | // // Int_t nentries = fParticles->GetEntries(); | |
1647 | ||
1648 | // // // algorithmic way of getting entry index | |
1649 | // // // (primary particles are filled after secondaries) | |
1650 | // // Int_t entry; | |
1651 | // // if (i<fHeader.GetNprimary()) | |
1652 | // // entry = i+fHeader.GetNsecondary(); | |
1653 | // // else | |
1654 | // // entry = i-fHeader.GetNprimary(); | |
1655 | ||
1656 | // // // only check the algorithmic way and give | |
1657 | // // // the fatal error if it is wrong | |
1658 | // // if (entry != fParticleFileMap[i]) { | |
1659 | // // Fatal("Particle", | |
1660 | // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d", | |
1661 | // // entry, fParticleFileMap[i]); | |
1662 | // // } | |
1663 | ||
1664 | // // fTreeK->GetEntry(fParticleFileMap[i]); | |
1665 | // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer); | |
1666 | // // fParticleMap->AddAt((*fParticles)[nentries],i); | |
1667 | // // } | |
1668 | // // return (TParticle *) (*fParticleMap)[i]; | |
1669 | ||
1670 | ||
1671 | ||
1672 | // } | |
1673 | ||
1674 | ||
1675 | // //scan over opened files and read corresponding TreeK## | |
1676 | ||
1677 | return ; | |
1678 | } | |
1679 | //____________________________________________________________________________ | |
1680 | void AliEMCALGetter::Event(const Int_t event, const char* opt) | |
1681 | { | |
1682 | // Reads the content of all Tree's S, D and R | |
1683 | ||
1684 | if (event >= gAlice->TreeE()->GetEntries() ) { | |
1685 | cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ; | |
1686 | return ; | |
1687 | } | |
1688 | gAlice->GetEvent(event) ; | |
1689 | ||
1690 | if(strstr(opt,"H") ) | |
d75bea67 | 1691 | ReadTreeH() ; |
ffa6d63b | 1692 | |
1693 | if(strstr(opt,"S") ) | |
d75bea67 | 1694 | ReadTreeS(event) ; |
ffa6d63b | 1695 | |
1696 | if( strstr(opt,"D") ) | |
1697 | ReadTreeD() ; | |
1698 | ||
f07cab21 | 1699 | if( strstr(opt,"R") ) |
1700 | ReadTreeR() ; | |
ffa6d63b | 1701 | |
d75bea67 | 1702 | // if( strstr(opt,"Q") ) |
1703 | // ReadTreeQA() ; | |
ffa6d63b | 1704 | |
d75bea67 | 1705 | // if( strstr(opt,"P") || (strcmp(opt,"")==0) ) |
1706 | // ReadPrimaries() ; | |
ffa6d63b | 1707 | |
1708 | } | |
1709 | ||
1710 | //____________________________________________________________________________ | |
472319e5 | 1711 | TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const |
ffa6d63b | 1712 | { |
1713 | // get the object named "what" from the folder | |
1714 | // folders are named like //Folders | |
1715 | ||
1716 | if ( file.IsNull() ) | |
1717 | file = fHeaderFile ; | |
1718 | ||
1719 | TFolder * folder = 0 ; | |
1720 | TObject * emcalO = 0 ; | |
1721 | ||
1722 | // if ( name.IsNull() ) { | |
1723 | if ( what.CompareTo("Hits") == 0 ) { | |
1724 | folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ; | |
1725 | if (folder) | |
1726 | emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ; | |
1727 | } | |
1728 | else if ( what.CompareTo("SDigits") == 0 ) { | |
4e5c8d4c | 1729 | file.ReplaceAll("/","_") ; |
ffa6d63b | 1730 | TString path = "EMCAL/" + file ; |
1731 | folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ; | |
1732 | if (folder) { | |
d75bea67 | 1733 | if (name.IsNull()) |
ffa6d63b | 1734 | name = fSDigitsTitle ; |
1735 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1736 | } | |
1737 | } | |
1738 | else if ( what.CompareTo("Digits") == 0 ){ | |
1739 | folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ; | |
1740 | if (folder) { | |
1741 | if (name.IsNull()) | |
1742 | name = fDigitsTitle ; | |
1743 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1744 | } | |
1745 | } | |
f07cab21 | 1746 | else if ( what.CompareTo("TowerRecPoints") == 0 ) { |
1747 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ; | |
d75bea67 | 1748 | if (folder) { |
1749 | if (name.IsNull()) | |
1750 | name = fRecPointsTitle ; | |
1751 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1752 | } | |
1753 | } | |
f07cab21 | 1754 | else if ( what.CompareTo("PreShoRecPoints") == 0 ) { |
1755 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ; | |
d75bea67 | 1756 | if (folder) { |
1757 | if (name.IsNull()) | |
1758 | name = fRecPointsTitle ; | |
1759 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1760 | } | |
1761 | } | |
f07cab21 | 1762 | /* |
d75bea67 | 1763 | else if ( what.CompareTo("TrackSegments") == 0 ) { |
1764 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ; | |
1765 | if (folder) { | |
1766 | if (name.IsNull()) | |
1767 | name = fTrackSegmentsTitle ; | |
1768 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1769 | } | |
1770 | } | |
1771 | else if ( what.CompareTo("RecParticles") == 0 ) { | |
1772 | folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ; | |
1773 | if (folder) { | |
1774 | if (name.IsNull()) | |
1775 | name = fRecParticlesTitle ; | |
1776 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1777 | } | |
1778 | } | |
1779 | else if ( what.CompareTo("Alarms") == 0 ){ | |
1780 | if (name.IsNull() ) | |
1781 | emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ; | |
1782 | else { | |
1783 | folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ; | |
1784 | if (!folder) | |
1785 | emcalO = 0 ; | |
1786 | else | |
1787 | emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ; | |
1788 | } | |
1789 | } | |
1790 | */ | |
ffa6d63b | 1791 | if (!emcalO) { |
d75bea67 | 1792 | if(fDebug) |
f07cab21 | 1793 | cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ; |
ffa6d63b | 1794 | return 0 ; |
1795 | } | |
1796 | return emcalO ; | |
1797 | } | |
1798 | ||
1799 | //____________________________________________________________________________ | |
1800 | const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const | |
1801 | { | |
1802 | // get the TTask named "what" from the folder | |
1803 | // folders are named like //Folders/Tasks/what/EMCAL/name | |
1804 | ||
1805 | TString search(what) ; | |
f07cab21 | 1806 | if ( what.CompareTo("Clusterizer") == 0 ) |
d75bea67 | 1807 | search = "Reconstructioner" ; |
1808 | else if ( what.CompareTo("TrackSegmentMaker") == 0 ) | |
1809 | search = "Reconstructioner" ; | |
1810 | else if ( what.CompareTo("PID") == 0 ) | |
1811 | search = "Reconstructioner" ; | |
1812 | else if ( what.CompareTo("QATasks") == 0 ) | |
1813 | search = "QA" ; | |
f07cab21 | 1814 | |
ffa6d63b | 1815 | TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ; |
1816 | ||
1817 | if (!tasks) { | |
1818 | cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ; | |
1819 | return 0 ; | |
1820 | } | |
1821 | ||
1822 | TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ; | |
1823 | if (!emcalT) { | |
1824 | cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ; | |
1825 | return 0 ; | |
1826 | } | |
1827 | ||
1828 | TList * list = emcalT->GetListOfTasks() ; | |
1829 | ||
1830 | if (what.CompareTo("SDigitizer") == 0) { | |
1831 | if ( name.IsNull() ) | |
1832 | name = fSDigitsTitle ; | |
1833 | } else if (what.CompareTo("Digitizer") == 0){ | |
1834 | if ( name.IsNull() ) | |
1835 | name = fDigitsTitle ; | |
f07cab21 | 1836 | } else if (what.CompareTo("Clusterizer") == 0){ |
d75bea67 | 1837 | if ( name.IsNull() ) |
1838 | name = fRecPointsTitle ; | |
1839 | name.Append(":clu") ; | |
1840 | } | |
f07cab21 | 1841 | // else if (what.CompareTo("TrackSegmentMaker") == 0){ |
1842 | // if ( name.IsNull() ) | |
1843 | // name = fTrackSegmentsTitle ; | |
1844 | // name.Append(":tsm") ; | |
1845 | // } | |
1846 | // else if (what.CompareTo("PID") == 0){ | |
1847 | // if ( name.IsNull() ) | |
1848 | // name = fRecParticlesTitle ; | |
1849 | // name.Append(":pid") ; | |
1850 | // } | |
1851 | // else if (what.CompareTo("QATasks") == 0){ | |
1852 | // if ( name.IsNull() ) | |
1853 | // return emcalT ; | |
1854 | // } | |
ffa6d63b | 1855 | |
1856 | TIter it(list) ; | |
1857 | TTask * task = 0 ; | |
1858 | while((task = static_cast<TTask *>(it.Next()) )){ | |
1859 | TString taskname(task->GetName()) ; | |
54b82aa4 | 1860 | if(taskname.BeginsWith(name)){ |
1861 | return task ;} | |
ffa6d63b | 1862 | } |
1863 | ||
d75bea67 | 1864 | if(fDebug) |
ffa6d63b | 1865 | cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ; |
1866 | return 0 ; | |
1867 | } |