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