1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 29.05.2001 Yuri Kharlov:
20 Everywhere reading the treese TTree->GetEvent(i)
21 is replaced by reading the branches TBranch->GetEntry(0)
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
31 // different set of parameters.
33 // An example of how to use (see also class AliEMCALAnalyser):
34 // AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ;
35 // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
36 // AliEMCALRecParticle * part = gime->RecParticle(1) ;
38 // please->GetEvent(event) ; // reads new event from galice.root
40 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
41 //*-- Completely redesigned by Dmitri Peressounko March 2001
43 //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
44 //*-- systematic usage of TFolders without changing the interface
45 //////////////////////////////////////////////////////////////////////////////
48 // --- ROOT system ---
53 #include "TObjString.h"
56 // --- Standard library ---
59 // --- AliRoot header files ---
62 #include "AliConfig.h"
63 #include "AliEMCALGetter.h"
64 #include "AliEMCALHit.h"
65 #include "AliEMCALv1.h"
66 #include "AliEMCALDigitizer.h"
67 #include "AliEMCALSDigitizer.h"
68 #include "AliEMCALClusterizer.h"
69 #include "AliEMCALClusterizerv1.h"
70 //#include "AliEMCALTrackSegmentMaker.h"
71 //#include "AliEMCALTrackSegmentMakerv1.h"
72 //#include "AliEMCALTrackSegment.h"
73 //#include "AliEMCALPID.h"
74 //#include "AliEMCALPIDv1.h"
75 #include "AliEMCALGeometry.h"
77 ClassImp(AliEMCALGetter)
79 AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ;
81 //____________________________________________________________________________
82 AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Option_t * rw)
84 //Initialize all lists
88 fHeaderFile = headerFile ;
89 fBranchTitle = branchTitle ;
90 fSDigitsTitle = branchTitle ;
91 fDigitsTitle = branchTitle ;
92 fRecPointsTitle = branchTitle ;
93 //fRecParticlesTitle = branchTitle ;
94 //fTrackSegmentsTitle = branchTitle ;
96 fPrimaries = new TObjArray(1) ;
98 fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules"));
99 fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits"));
100 fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits"));
101 fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data"));
102 fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData"));
103 //fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA"));
104 fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ;
108 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
111 fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
112 if(!fFile){ //if file was not opened yet, read gAlice
113 fFile = TFile::Open(fHeaderFile.Data(),rw) ;
115 if (!fFile->IsOpen()) {
116 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
121 gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ;
126 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
132 cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ;
133 if (gAlice->GetDetector("EMCAL")) {
134 AliConfig * conf = AliConfig::Instance() ;
135 conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
136 conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
139 cerr << "ERROR: AliEMCALGetter -> detector EMCAL not found" << endl ;
144 //____________________________________________________________________________
145 AliEMCALGetter::~AliEMCALGetter()
148 fPrimaries->Delete() ;
156 //____________________________________________________________________________
157 void AliEMCALGetter::CreateWhiteBoard() const
162 //____________________________________________________________________________
163 AliEMCALGetter * AliEMCALGetter::GetInstance()
165 // Returns the pointer of the unique instance already defined
167 AliEMCALGetter * rv = 0 ;
171 cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
176 //____________________________________________________________________________
177 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
178 const char* branchTitle, const Option_t * rw)
180 // Creates and returns the pointer of the unique instance
181 // Must be called only when the environment has changed
184 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
185 (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
188 fgObjGetter->~AliEMCALGetter() ; // delete it already exists another version
190 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
192 // Posts a few item to the white board (folders)
193 // fgObjGetter->CreateWhiteBoard() ;
199 //____________________________________________________________________________
200 const AliEMCALv1 * AliEMCALGetter::EMCAL()
202 // returns the EMCAL object
203 AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ;
206 cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
210 //____________________________________________________________________________
211 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
213 AliEMCALGeometry * rv = 0 ;
215 rv = EMCAL()->GetGeometry() ;
219 //____________________________________________________________________________
220 Bool_t AliEMCALGetter::PostHits(void) const
221 { //------- Hits ----------------------
223 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
225 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
226 if ( !emcalFolder ) {
228 cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
229 cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
231 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
233 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
234 hits->SetName("Hits") ;
235 emcalFolder->Add(hits) ;
240 //____________________________________________________________________________
241 TObject ** AliEMCALGetter::HitsRef(void) const
242 { //------- Hits ----------------------
245 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
246 if ( !fHitsFolder ) {
247 cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
251 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
252 if ( !emcalFolder ) {
253 cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
257 TObject * h = emcalFolder->FindObject("Hits") ;
259 cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
263 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
266 //____________________________________________________________________________
267 Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
268 { //---------- SDigits -------------------------
271 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
272 // because you can have sdigits from several hit files for mixing
274 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
275 if ( !emcalFolder ) {
277 cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
278 cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
280 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
282 TString subdir(headerFile) ;
283 subdir.ReplaceAll("/", "_") ;
284 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
285 if ( !emcalSubFolder )
286 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
288 TObject * sd = emcalSubFolder->FindObject(name);
291 cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
292 << " already exists!" << endl ;
294 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
295 sdigits->SetName(name) ;
296 emcalSubFolder->Add(sdigits) ;
301 //____________________________________________________________________________
302 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
303 { //------- SDigits ----------------------
305 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
307 if ( !fSDigitsFolder ) {
308 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
312 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
313 if ( !emcalFolder ) {
314 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
318 TFolder * emcalSubFolder = 0 ;
320 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
322 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
324 if(!emcalSubFolder) {
325 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
329 TObject * dis = emcalSubFolder->FindObject(name) ;
333 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
337 //____________________________________________________________________________
338 Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
339 { //---------- SDigitizer -------------------------
341 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
344 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
347 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
350 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
353 cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
354 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
356 emcal = new TTask("EMCAL", "") ;
359 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
362 cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
363 emcal->GetListOfTasks()->Remove(emcalsd) ;
365 emcal->Add(sdigitizer) ;
370 //____________________________________________________________________________
371 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
374 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
376 cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
380 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
382 cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
386 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
388 return emcal->GetListOfTasks()->GetObjectRef(task) ;
392 //____________________________________________________________________________
393 Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
394 { //---------- SDigitizer -------------------------
396 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
399 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
401 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
405 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
408 cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
409 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
411 emcal = new TTask("EMCAL", "") ;
415 TString sdname(name) ;
418 sdname.ReplaceAll("/","_") ;
419 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
421 emcalsd = new AliEMCALSDigitizer() ;
422 //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
423 emcalsd->SetName(sdname) ;
424 emcalsd->SetTitle(file) ;
425 emcal->Add(emcalsd) ;
431 //____________________________________________________________________________
432 Bool_t AliEMCALGetter::PostDigits(const char * name) const
433 { //---------- Digits -------------------------
435 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
437 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
439 if ( !emcalFolder ) {
441 cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
442 cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
444 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
447 TObject* dig = emcalFolder->FindObject( name ) ;
449 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
450 digits->SetName(name) ;
451 emcalFolder->Add(digits) ;
456 //____________________________________________________________________________
457 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
458 { //------- Digits ----------------------
460 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
462 if ( !fDigitsFolder ) {
463 cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
467 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
468 if ( !emcalFolder ) {
469 cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
473 TObject * d = emcalFolder->FindObject(name) ;
477 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
481 //____________________________________________________________________________
482 Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
483 { //---------- Digitizer -------------------------
485 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
488 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
491 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
494 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
495 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
497 emcal = new TTask("EMCAL", "") ;
501 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
504 emcal->GetListOfTasks()->Remove(emcald) ;
506 emcal->Add(digitizer) ;
510 //____________________________________________________________________________
511 Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
512 { //---------- Digitizer -------------------------
514 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
516 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
518 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
522 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
525 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
526 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
528 emcal = new TTask("EMCAL", "") ;
532 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
534 emcald = new AliEMCALDigitizer() ;
535 emcald->SetName(fDigitsTitle) ;
536 emcald->SetTitle(fHeaderFile) ;
542 //____________________________________________________________________________
543 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
545 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
547 cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
551 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
553 cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
557 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
559 return emcal->GetListOfTasks()->GetObjectRef(task) ;
563 //____________________________________________________________________________
564 Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
565 { // -------------- RecPoints -------------------------------------------
567 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
568 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
570 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
572 if ( !emcalFolder ) {
574 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
575 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
577 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
581 TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ;
582 if ( !emcalRPoTowerFolder ) {
584 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
585 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl;
587 emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ;
590 TObject * erp = emcalFolder->FindObject( name ) ;
592 TObjArray * towerrp = new TObjArray(100) ;
593 towerrp->SetName(name) ;
594 emcalRPoTowerFolder->Add(towerrp) ;
597 // Pre Shower RecPoints
598 TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ;
599 if ( !emcalRPoPreShoFolder ) {
601 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl;
602 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
604 emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ;
607 TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
609 TObjArray * preshorp = new TObjArray(100) ;
610 preshorp->SetName(name) ;
611 emcalRPoPreShoFolder->Add(preshorp) ;
616 //____________________________________________________________________________
617 TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const
618 { // -------------- RecPoints -------------------------------------------
620 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
622 if ( !fRecoFolder ) {
623 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
627 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
628 if ( !towerFolder ) {
629 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
634 TObject * trp = towerFolder->FindObject(name ) ;
638 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
642 //____________________________________________________________________________
643 TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const
644 { // -------------- RecPoints -------------------------------------------
646 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
648 if ( !fRecoFolder ) {
649 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
653 TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
654 if ( !preshoFolder ) {
655 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
659 TObject * prp = preshoFolder->FindObject(name ) ;
663 return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
667 //____________________________________________________________________________
668 Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const
669 { // ------------------ AliEMCALClusterizer ------------------------
671 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
673 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
676 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
680 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
683 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
684 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
686 emcal = new TTask("EMCAL", "") ;
690 AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
693 cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
695 emcal->GetListOfTasks()->Remove(emcalcl) ;
701 //____________________________________________________________________________
702 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
703 { // ------------------ AliEMCALClusterizer ------------------------
705 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
708 cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
712 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
714 cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
718 TList * l = emcal->GetListOfTasks() ;
722 TString cluname(name) ;
724 while((task = static_cast<TTask *>(it.Next()) )){
725 TString taskname(task->GetName()) ;
726 if(taskname.BeginsWith(cluname)){
733 return l->GetObjectRef(clu) ;
738 //____________________________________________________________________________
739 Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
740 { // ------------------ AliEMCALClusterizer ------------------------
742 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
744 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
747 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl;
751 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
754 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
755 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
757 emcal = new TTask("EMCAL", "") ;
761 AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
764 emcalcl->SetName(clun) ;
765 emcal->Add(emcalcl) ;
770 //____________________________________________________________________________
771 /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
772 { // ---------------TrackSegments -----------------------------------
774 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
776 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
778 if ( !emcalFolder ) {
780 cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
781 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl;
783 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
786 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
787 if ( !emcalTSFolder ) {
789 cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
790 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl;
792 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
795 TObject * tss = emcalTSFolder->FindObject( name ) ;
797 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
799 emcalTSFolder->Add(ts) ;
804 //____________________________________________________________________________
805 TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
806 { // ---------------TrackSegments -----------------------------------
808 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
810 if ( !fRecoFolder ) {
811 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
815 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
816 if ( !emcalFolder ) {
817 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
821 TObject * tss = emcalFolder->FindObject(name) ;
825 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
828 //____________________________________________________________________________
829 Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
830 { //------------Track Segment Maker ------------------------------
832 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
834 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
837 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
841 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
844 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
845 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
847 emcal = new TTask("EMCAL", "") ;
851 AliEMCALTrackSegmentMaker * emcalts =
852 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
855 emcal->GetListOfTasks()->Remove(emcalts) ;
857 emcal->Add(tsmaker) ;
861 //____________________________________________________________________________
862 Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
863 { //------------Track Segment Maker ------------------------------
865 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
868 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
871 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
875 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
878 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
879 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
881 emcal = new TTask("EMCAL", "") ;
885 AliEMCALTrackSegmentMaker * emcalts =
886 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ;
888 emcalts = new AliEMCALTrackSegmentMakerv1() ;
891 emcalts->SetName(tsn) ;
892 emcal->Add(emcalts) ;
898 //____________________________________________________________________________
899 TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
900 { //------------Track Segment Maker ------------------------------
902 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
905 cerr << "ERROR: AliEMCALGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
909 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
911 cerr <<"WARNING: AliEMCALGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
915 TList * l = emcal->GetListOfTasks() ;
919 TString tsmname(name) ;
921 while((task = static_cast<TTask *>(it.Next()) )){
922 TString taskname(task->GetName()) ;
923 if(taskname.BeginsWith(tsmname)){
930 return l->GetObjectRef(tsm) ;
936 //____________________________________________________________________________
937 Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
938 { // -------------------- RecParticles ------------------------
940 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
942 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
944 if ( !emcalFolder ) {
946 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
947 cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
949 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
952 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
953 if ( !emcalRPaFolder ) {
955 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
956 cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl;
958 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
961 TObject * rps = emcalRPaFolder->FindObject( name ) ;
963 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
965 emcalRPaFolder->Add(rp) ;
970 //____________________________________________________________________________
971 TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
972 { // ---------------TrackSegments -----------------------------------
974 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
976 if ( !fRecoFolder ) {
977 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
981 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
982 if ( !emcalFolder ) {
983 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
987 TObject * tss = emcalFolder->FindObject(name ) ;
991 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
994 //____________________________________________________________________________
995 Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
996 { // ------------AliEMCAL PID -----------------------------
998 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1001 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1005 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1008 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1009 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1011 emcal = new TTask("EMCAL", "") ;
1015 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1018 cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName()
1019 << " already exists" << endl ;
1020 emcal->GetListOfTasks()->Remove(emcalpid) ;
1027 //____________________________________________________________________________
1028 Bool_t AliEMCALGetter::PostPID(const char * name) const
1030 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1032 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1035 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1039 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1042 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1043 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1045 emcal = new TTask("EMCAL", "") ;
1049 TList * l = emcal->GetListOfTasks() ;
1051 TString pidname(name) ;
1054 while((task = static_cast<TTask *>(it.Next()) )){
1055 TString taskname(task->GetName()) ;
1056 if(taskname.BeginsWith(pidname))
1060 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1062 emcalpid->SetName(pidname) ;
1063 emcal->Add(emcalpid) ;
1068 //____________________________________________________________________________
1069 TObject ** AliEMCALGetter::PIDRef(const char * name) const
1070 { //------------PID ------------------------------
1072 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1075 cerr << "ERROR: AliEMCALGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1079 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1081 cerr <<"WARNING: AliEMCALGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
1085 TList * l = emcal->GetListOfTasks() ;
1089 TString pidname(name) ;
1091 while((task = static_cast<TTask *>(it.Next()) )){
1092 TString taskname(task->GetName()) ;
1093 if(taskname.BeginsWith(pidname)){
1100 return l->GetObjectRef(pid) ;
1106 //____________________________________________________________________________
1107 Bool_t AliEMCALGetter::PostQA(void) const
1108 { // ------------------ QA ---------------------------------
1110 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
1112 TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ;
1113 if ( !emcalFolder ) {
1115 cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1116 cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl;
1118 emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ;
1124 //____________________________________________________________________________
1125 TObject ** AliEMCALGetter::AlarmsRef(void) const
1126 { //------- Alarms ----------------------
1129 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL
1131 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl;
1135 TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1136 if ( !emcalFolder ) {
1137 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1141 return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
1144 //____________________________________________________________________________
1145 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1147 // Return primary particle numbered by <index>
1152 Int_t primaryIndex = index % 10000000 ;
1153 Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ;
1155 if ( primaryList > 0 ) {
1157 cout << " Getter does not support currently Mixing of primary " << endl ;
1158 cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
1163 return gAlice->Particle(primaryIndex) ;
1167 //____________________________________________________________________________
1168 void AliEMCALGetter::ReadTreeD()
1170 // Read the digit tree gAlice->TreeD()
1171 if(gAlice->TreeD()== 0){
1172 cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ;
1176 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
1178 TBranch * branch = 0 ;
1179 TBranch * digitsbranch = 0 ;
1180 TBranch * digitizerbranch = 0 ;
1181 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1183 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1184 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1185 digitsbranch = branch ;
1186 emcalfound = kTRUE ;
1188 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1189 digitizerbranch = branch ;
1190 digitizerfound = kTRUE ;
1194 if ( !emcalfound || !digitizerfound ) {
1196 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
1197 << fDigitsTitle << endl ;
1202 if(!Digits(fDigitsTitle) )
1203 PostDigits(fDigitsTitle);
1204 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1205 digitsbranch->GetEntry(0) ;
1208 // read the Digitizer
1209 if(!Digitizer(fDigitsTitle))
1210 PostDigitizer(fDigitsTitle) ;
1211 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1212 digitizerbranch->GetEntry(0) ;
1217 //____________________________________________________________________________
1218 void AliEMCALGetter::ReadTreeH()
1220 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1222 if(gAlice->TreeH()== 0){
1223 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1227 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1228 if ( !hitsbranch ) {
1230 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1236 if (hitsbranch->GetEntries() > 1 ) {
1237 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1238 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1239 hitsbranch->SetAddress(&tempo) ;
1242 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1243 hitsbranch->GetEntry(i) ;
1245 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1246 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1247 new((*hits)[index]) AliEMCALHit( *hit ) ;
1254 hitsbranch->SetAddress(HitsRef()) ;
1255 hitsbranch->GetEntry(0) ;
1259 //____________________________________________________________________________
1260 void AliEMCALGetter::Track(Int_t itrack)
1262 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1264 if(gAlice->TreeH()== 0){
1265 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1269 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1270 if ( !hitsbranch ) {
1272 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1277 hitsbranch->SetAddress(HitsRef()) ;
1278 hitsbranch->GetEntry(itrack) ;
1282 //____________________________________________________________________________
1283 // void AliEMCALGetter::ReadTreeQA()
1285 // Read the digit tree gAlice->TreeQA()
1286 // so far only EMCAL knows about this Tree
1288 // if(EMCAL()->TreeQA()== 0){
1289 // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ;
1293 // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ;
1296 // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ;
1303 // qabranch->SetAddress(AlarmsRef()) ;
1305 // qabranch->GetEntry(0) ;
1307 // PostQA("EMCAL") ;
1308 // TFolder * alarmsF = Alarms() ;
1309 // alarmsF->Clear() ;
1310 // qabranch->SetAddress(&alarmsF) ;
1311 // qabranch->GetEntry(0) ;
1315 //____________________________________________________________________________
1316 void AliEMCALGetter::ReadTreeR()
1318 // Read the reconstrunction tree gAlice->TreeR()
1320 if(gAlice->TreeR()== 0){
1321 cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ;
1326 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
1328 TBranch * branch = 0 ;
1329 TBranch * towerbranch = 0 ;
1330 TBranch * preshobranch = 0 ;
1331 TBranch * clusterizerbranch = 0 ;
1332 Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ;
1334 while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) )
1335 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
1336 if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
1337 towerbranch = branch ;
1338 emcaltowerrpfound = kTRUE ;
1340 else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
1341 preshobranch = branch ;
1342 emcalpreshorpfound = kTRUE ;
1344 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1345 clusterizerbranch = branch ;
1346 clusterizerfound = kTRUE ;
1350 if ( !emcaltowerrpfound ) {
1352 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title "
1353 << fRecPointsTitle << endl ;
1356 if ( !emcalpreshorpfound ) {
1358 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title "
1359 << fRecPointsTitle << endl ;
1362 if ( !clusterizerfound ) {
1364 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title "
1365 << fRecPointsTitle << endl ;
1369 // Read and Post the RecPoints
1370 if(!TowerRecPoints(fRecPointsTitle) )
1371 PostRecPoints(fRecPointsTitle) ;
1372 towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
1373 towerbranch->GetEntry(0) ;
1375 preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ;
1376 preshobranch->GetEntry(0) ;
1378 if(!Clusterizer(fRecPointsTitle) )
1379 PostClusterizer(fRecPointsTitle) ;
1380 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1381 clusterizerbranch->GetEntry(0) ;
1384 //------------------- TrackSegments ---------------------
1386 // TBranch * tsbranch = 0 ;
1387 // TBranch * tsmakerbranch = 0 ;
1388 // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1390 // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) )
1391 // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
1392 // if ( strcmp(branch->GetName(), "EMCALTS")==0){
1393 // tsbranch = branch ;
1394 // emcaltsfound = kTRUE ;
1396 // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1397 // tsmakerbranch = branch ;
1398 // tsmakerfound = kTRUE ;
1402 // if ( !emcaltsfound || !tsmakerfound ) {
1404 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
1405 // << fTrackSegmentsTitle << endl ;
1409 // // Read and Post the TrackSegments
1410 // if(!TrackSegments(fTrackSegmentsTitle))
1411 // PostTrackSegments(fTrackSegmentsTitle) ;
1412 // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1413 // tsbranch->GetEntry(0) ;
1415 // // Read and Post the TrackSegment Maker
1416 // if(!TrackSegmentMaker(fTrackSegmentsTitle))
1417 // PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1418 // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
1419 // tsmakerbranch->GetEntry(0) ;
1422 // //------------ RecParticles ----------------------------
1424 // TBranch * rpabranch = 0 ;
1425 // TBranch * pidbranch = 0 ;
1426 // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
1428 // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
1429 // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1430 // if ( strcmp(branch->GetName(), "EMCALRP")==0) {
1431 // rpabranch = branch ;
1432 // emcalrpafound = kTRUE ;
1434 // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
1435 // pidbranch = branch ;
1436 // pidfound = kTRUE ;
1440 // if ( !emcalrpafound || !pidfound ) {
1442 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
1443 // << fRecParticlesTitle << endl ;
1447 // // Read and Post the RecParticles
1448 // if(!RecParticles(fRecParticlesTitle))
1449 // PostRecParticles(fRecParticlesTitle) ;
1450 // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1451 // rpabranch->GetEntry(0) ;
1453 // // Read and Post the PID
1454 // if(!PID(fRecParticlesTitle))
1455 // PostPID(fRecParticlesTitle) ;
1456 // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
1457 // pidbranch->GetEntry(0) ;
1462 //____________________________________________________________________________
1463 void AliEMCALGetter::ReadTreeS(Int_t event)
1465 // Read the summable digits tree gAlice->TreeS()
1467 // loop over all opened files and read their SDigits to the White Board
1468 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
1470 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1471 TCollection * folderslist = emcalF->GetListOfFolders() ;
1473 //Add current file to list if it is not there yet
1475 TString subdir(fHeaderFile) ;
1476 subdir.ReplaceAll("/","_") ;
1478 if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){
1479 emcalF->AddFolder(subdir, "");
1482 TIter next(folderslist) ;
1483 TFolder * folder = 0 ;
1486 while ( (folder = static_cast<TFolder*>(next())) ) {
1487 TString fileName(folder->GetName()) ;
1488 fileName.ReplaceAll("_","/") ;
1489 if(fHeaderFile.CompareTo(fileName) == 0 )
1490 treeS=gAlice->TreeS() ;
1492 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1495 // Get SDigits Tree header from file
1496 TString treeName("TreeS") ;
1498 treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
1501 cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl;
1505 //set address of the SDigits and SDigitizer
1506 TBranch * sdigitsBranch = 0;
1507 TBranch * sdigitizerBranch = 0;
1508 TBranch * branch = 0 ;
1509 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
1511 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1513 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
1514 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1515 emcalfound = kTRUE ;
1516 sdigitsBranch = branch ;
1519 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1520 sdigitizerfound = kTRUE ;
1521 sdigitizerBranch = branch ;
1524 if ( !emcalfound || !sdigitizerfound ) {
1526 cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
1527 << " not found" << endl ;
1531 if ( !folder->FindObject(fSDigitsTitle) )
1532 PostSDigits(fSDigitsTitle,folder->GetName()) ;
1533 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
1534 sdigitsBranch->GetEntry(0) ;
1536 TString sdname(fSDigitsTitle) ;
1538 sdname+=folder->GetName() ;
1539 if(!SDigitizer(sdname) )
1540 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
1541 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1542 sdigitizerBranch->GetEntry(0) ;
1546 // After SDigits have been read from all files, return to the first one
1549 folder = static_cast<TFolder*>(next());
1551 TString fileName(folder->GetName()) ;
1552 fileName.ReplaceAll("_","/") ;
1553 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1558 //____________________________________________________________________________
1559 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
1560 { // Read the summable digits fron treeS()
1563 TString filename("mergefile") ;
1566 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
1567 if ( !emcalFolder ) {
1568 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1570 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
1571 //set address of the SDigits and SDigitizer
1572 TBranch * sdigitsBranch = 0;
1573 TBranch * sdigitizerBranch = 0;
1574 TBranch * branch = 0 ;
1575 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
1577 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1579 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
1580 if ( strcmp(branch->GetName(), "EMCAL")==0) {
1581 emcalfound = kTRUE ;
1582 sdigitsBranch = branch ;
1585 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
1586 sdigitizerfound = kTRUE ;
1587 sdigitizerBranch = branch ;
1590 if ( !emcalfound || !sdigitizerfound ) {
1592 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
1596 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
1597 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
1599 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
1600 sdigitsBranch->GetEntry(0) ;
1602 TString sdname(sdigitsBranch->GetTitle()) ;
1605 if(!SDigitizer(sdigitsBranch->GetTitle()) )
1606 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
1608 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1609 sdigitizerBranch->GetEntry(0) ;
1614 //____________________________________________________________________________
1615 void AliEMCALGetter::ReadPrimaries()
1617 // Reads specific branches of primaries
1619 fNPrimaries = gAlice->GetNtrack();
1621 // //Check, is it necessary to open new files
1622 // TArrayI* events = fDigitizer->GetCurrentEvents() ;
1623 // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
1625 // for(input = 0; input < filenames->GetEntriesFast(); input++){
1627 // TObjString * filename = (TObjString *) filenames->At(input) ;
1629 // //Test, if this file already open
1630 // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
1632 // file = new TFile( filename->GetString()) ;
1635 // // Get Kine Tree from file
1636 // // char treeName[20];
1637 // // sprintf(treeName,"TreeK%d",events->At(input));
1638 // // TTree * treeK = (TTree*)gDirectory->Get(treeName);
1640 // // treeK->SetBranchAddress("Particles", &fParticleBuffer);
1642 // // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
1644 // // // Create the particle stack
1645 // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
1646 // // // Build the pointer list
1647 // // if(fParticleMap) { <----
1648 // // fParticleMap->Clear();
1649 // // fParticleMap->Expand(treeK->GetEntries());
1651 // // fParticleMap = new TObjArray(treeK->GetEntries());
1653 // // From gAlice->Particle(i)
1656 // // if(!(*fParticleMap)[i]) {
1657 // // Int_t nentries = fParticles->GetEntries();
1659 // // // algorithmic way of getting entry index
1660 // // // (primary particles are filled after secondaries)
1662 // // if (i<fHeader.GetNprimary())
1663 // // entry = i+fHeader.GetNsecondary();
1665 // // entry = i-fHeader.GetNprimary();
1667 // // // only check the algorithmic way and give
1668 // // // the fatal error if it is wrong
1669 // // if (entry != fParticleFileMap[i]) {
1670 // // Fatal("Particle",
1671 // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
1672 // // entry, fParticleFileMap[i]);
1675 // // fTreeK->GetEntry(fParticleFileMap[i]);
1676 // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
1677 // // fParticleMap->AddAt((*fParticles)[nentries],i);
1679 // // return (TParticle *) (*fParticleMap)[i];
1686 // //scan over opened files and read corresponding TreeK##
1690 //____________________________________________________________________________
1691 void AliEMCALGetter::Event(const Int_t event, const char* opt)
1693 // Reads the content of all Tree's S, D and R
1695 if (event >= gAlice->TreeE()->GetEntries() ) {
1696 cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
1699 gAlice->GetEvent(event) ;
1701 if(strstr(opt,"H") )
1704 if(strstr(opt,"S") )
1707 if( strstr(opt,"D") )
1710 if( strstr(opt,"R") )
1713 // if( strstr(opt,"Q") )
1716 // if( strstr(opt,"P") || (strcmp(opt,"")==0) )
1717 // ReadPrimaries() ;
1721 //____________________________________________________________________________
1722 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
1724 // get the object named "what" from the folder
1725 // folders are named like //Folders
1727 if ( file.IsNull() )
1728 file = fHeaderFile ;
1730 TFolder * folder = 0 ;
1731 TObject * emcalO = 0 ;
1733 // if ( name.IsNull() ) {
1734 if ( what.CompareTo("Hits") == 0 ) {
1735 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
1737 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
1739 else if ( what.CompareTo("SDigits") == 0 ) {
1740 file.ReplaceAll("/","_") ;
1741 TString path = "EMCAL/" + file ;
1742 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
1745 name = fSDigitsTitle ;
1746 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1749 else if ( what.CompareTo("Digits") == 0 ){
1750 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
1753 name = fDigitsTitle ;
1754 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1757 else if ( what.CompareTo("TowerRecPoints") == 0 ) {
1758 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
1761 name = fRecPointsTitle ;
1762 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1765 else if ( what.CompareTo("PreShoRecPoints") == 0 ) {
1766 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
1769 name = fRecPointsTitle ;
1770 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1774 else if ( what.CompareTo("TrackSegments") == 0 ) {
1775 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
1778 name = fTrackSegmentsTitle ;
1779 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1782 else if ( what.CompareTo("RecParticles") == 0 ) {
1783 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1786 name = fRecParticlesTitle ;
1787 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1790 else if ( what.CompareTo("Alarms") == 0 ){
1792 emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ;
1794 folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1798 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1804 cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
1810 //____________________________________________________________________________
1811 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
1813 // get the TTask named "what" from the folder
1814 // folders are named like //Folders/Tasks/what/EMCAL/name
1816 TString search(what) ;
1817 if ( what.CompareTo("Clusterizer") == 0 )
1818 search = "Reconstructioner" ;
1819 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
1820 search = "Reconstructioner" ;
1821 else if ( what.CompareTo("PID") == 0 )
1822 search = "Reconstructioner" ;
1823 else if ( what.CompareTo("QATasks") == 0 )
1826 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
1829 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
1833 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1835 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
1839 TList * list = emcalT->GetListOfTasks() ;
1841 if (what.CompareTo("SDigitizer") == 0) {
1842 if ( name.IsNull() )
1843 name = fSDigitsTitle ;
1844 } else if (what.CompareTo("Digitizer") == 0){
1845 if ( name.IsNull() )
1846 name = fDigitsTitle ;
1847 } else if (what.CompareTo("Clusterizer") == 0){
1848 if ( name.IsNull() )
1849 name = fRecPointsTitle ;
1850 name.Append(":clu") ;
1852 // else if (what.CompareTo("TrackSegmentMaker") == 0){
1853 // if ( name.IsNull() )
1854 // name = fTrackSegmentsTitle ;
1855 // name.Append(":tsm") ;
1857 // else if (what.CompareTo("PID") == 0){
1858 // if ( name.IsNull() )
1859 // name = fRecParticlesTitle ;
1860 // name.Append(":pid") ;
1862 // else if (what.CompareTo("QATasks") == 0){
1863 // if ( name.IsNull() )
1869 while((task = static_cast<TTask *>(it.Next()) )){
1870 TString taskname(task->GetName()) ;
1871 if(taskname.BeginsWith(name)){
1876 cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;