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