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 ;
80 TFile * AliEMCALGetter::fFile = 0 ;
82 //____________________________________________________________________________
83 AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Option_t * rw)
85 //Initialize all lists
91 fHeaderFile = headerFile ;
92 fBranchTitle = branchTitle ;
93 fSDigitsTitle = branchTitle ;
94 fDigitsTitle = branchTitle ;
95 fRecPointsTitle = branchTitle ;
96 //fRecParticlesTitle = branchTitle ;
97 //fTrackSegmentsTitle = branchTitle ;
99 fPrimaries = new TObjArray(1) ;
101 fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules"));
102 fPrimariesFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data"));
103 fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits"));
104 fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits"));
105 fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data"));
106 fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData"));
107 //fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA"));
108 fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ;
112 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
115 fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
116 if(!fFile){ //if file was not opened yet, read gAlice
117 if ( fHeaderFile.Contains("_") ) {
118 cerr << "AliPHOSGetter::AliPHOSGetter -> Invalid file name (_ not allowed) " << fHeaderFile.Data() << endl ;
121 fFile = TFile::Open(fHeaderFile.Data(),rw) ;
123 if (!fFile->IsOpen()) {
124 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
128 gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ;
134 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
140 cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ;
141 if (gAlice->GetDetector("EMCAL")) {
142 AliConfig * conf = AliConfig::Instance() ;
143 conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
144 conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
147 cerr << "ERROR: AliEMCALGetter -> detector EMCAL not found" << endl ;
152 //____________________________________________________________________________
153 AliEMCALGetter::~AliEMCALGetter()
156 fPrimaries->Delete() ;
160 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
161 TCollection * folderslist = emcalF->GetListOfFolders() ;
162 TIter next(folderslist) ;
163 TFolder * folder = 0 ;
164 while ( (folder = static_cast<TFolder*>(next())) )
165 emcalF->Remove(folder) ;
174 //____________________________________________________________________________
175 void AliEMCALGetter::CreateWhiteBoard() const
180 //____________________________________________________________________________
181 void AliEMCALGetter::CloseFile()
189 //____________________________________________________________________________
190 const TFolder * AliEMCALGetter::Folder(const TString what) const {
192 // returns the EMCAL folder required by what
193 // what = hits, sdigits, digits
195 if ( what == "hits" )
196 return dynamic_cast<const TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
197 else if ( what == "sdigits" )
198 return dynamic_cast<const TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
199 else if ( what == "digits" )
200 return dynamic_cast<const TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
202 cerr << "ERROR: AliEMCALGetter::GetFolder -> " << what.Data() << " illegal option (hits, sdigits, digits) " << endl ;
206 //____________________________________________________________________________
207 AliEMCALGetter * AliEMCALGetter::GetInstance()
209 // Returns the pointer of the unique instance already defined
216 // cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
221 //____________________________________________________________________________
222 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
223 const char* branchTitle, const Option_t * rw)
225 // Creates and returns the pointer of the unique instance
226 // Must be called only when the environment has changed
228 if ( fgObjGetter && fFile->IsOpen()) // an instance exists and the file is still open
229 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
230 (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0)) {
234 else // another file than the existing one is required, scratch the getter
235 fgObjGetter->~AliEMCALGetter() ; // delete it already exists another version
237 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
239 if (fgObjGetter->HasFailed() )
247 //____________________________________________________________________________
248 const AliEMCALv1 * AliEMCALGetter::EMCAL()
250 // returns the EMCAL object
251 AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ;
254 cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
258 //____________________________________________________________________________
259 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
261 AliEMCALGeometry * rv = 0 ;
263 rv = EMCAL()->GetGeometry() ;
267 //____________________________________________________________________________
268 Bool_t AliEMCALGetter::PostPrimaries(void) const
269 { //------- Primaries ----------------------
271 // the hierarchy is //Folders/RunMC/Event/Data/Primaries
273 TFolder * primariesFolder = dynamic_cast<TFolder*>(fPrimariesFolder->FindObject("Primaries")) ;
274 if ( !primariesFolder ) {
276 cout << "WARNING: AliEMCALGetter::Post Primaries -> Folder //" << fPrimariesFolder->GetName() << "/Primaries/ not found!" << endl;
277 cout << "INFO: AliEMCALGetter::Post Primaries -> Adding Folder //" << fPrimariesFolder->GetName() << "/Primaries/" << endl;
279 primariesFolder = fPrimariesFolder->AddFolder("Primaries", "Primaries particles from TreeK") ;
281 TClonesArray *primaries= new TClonesArray("TParticle",1000) ;
282 primaries->SetName("Primaries") ;
283 primariesFolder->Add(primaries) ;
288 //____________________________________________________________________________
289 TObject** AliEMCALGetter::PrimariesRef(void) const
290 { //------- Primaries ----------------------
293 // the hierarchy is //Folders/RunMC/Event/Data/Primaries
294 if ( !fPrimariesFolder ) {
295 cerr << "ERROR: AliEMCALGetter::PrimariesRef -> Folder //" << fPrimariesFolder << " not found!" << endl;
299 TFolder * primariesFolder = dynamic_cast<TFolder *>(fPrimariesFolder->FindObject("Primaries")) ;
300 if ( !primariesFolder ) {
301 cerr << "ERROR: AliEMCALGetter::PrimariesRef -> Folder //" << fPrimariesFolder << "/Primaries/ not found!" << endl;
305 TObject * p = primariesFolder->FindObject("Primaries") ;
307 cerr << "ERROR: AliEMCALGetter::PrimariesRef -> " << primariesFolder->GetName() << "/Primaries not found !" << endl ;
311 return primariesFolder->GetListOfFolders()->GetObjectRef(p) ;
314 //____________________________________________________________________________
315 Bool_t AliEMCALGetter::PostHits(void) const
316 { //------- Hits ----------------------
318 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
320 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
321 if ( !emcalFolder ) {
323 cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
324 cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
326 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
328 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
329 hits->SetName("Hits") ;
330 emcalFolder->Add(hits) ;
335 //____________________________________________________________________________
336 TObject ** AliEMCALGetter::HitsRef(void) const
337 { //------- Hits ----------------------
340 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
341 if ( !fHitsFolder ) {
342 cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
346 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
347 if ( !emcalFolder ) {
348 cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
352 TObject * h = emcalFolder->FindObject("Hits") ;
354 cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
358 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
361 //____________________________________________________________________________
362 Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
363 { //---------- SDigits -------------------------
366 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
367 // because you can have sdigits from several hit files for mixing
369 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
370 if ( !emcalFolder ) {
372 cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
373 cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
375 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
377 TString subdir(headerFile) ;
378 subdir.ReplaceAll("/", "_") ;
379 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
380 if ( !emcalSubFolder )
381 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
383 TObject * sd = emcalSubFolder->FindObject(name);
386 cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
387 << " already exists!" << endl ;
389 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
390 sdigits->SetName(name) ;
391 emcalSubFolder->Add(sdigits) ;
396 //____________________________________________________________________________
397 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
398 { //------- SDigits ----------------------
400 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
402 if ( !fSDigitsFolder ) {
403 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
407 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
408 if ( !emcalFolder ) {
409 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
413 TFolder * emcalSubFolder = 0 ;
415 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
417 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
419 if(!emcalSubFolder) {
420 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
424 TObject * dis = emcalSubFolder->FindObject(name) ;
428 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
432 //____________________________________________________________________________
433 Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
434 { //---------- SDigitizer -------------------------
436 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
439 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
442 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
445 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
448 cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
449 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
451 emcal = new TTask("EMCAL", "") ;
454 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
457 cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
458 emcal->GetListOfTasks()->Remove(emcalsd) ;
460 emcal->Add(sdigitizer) ;
465 //____________________________________________________________________________
466 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
469 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
471 cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
475 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
477 cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
481 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
483 return emcal->GetListOfTasks()->GetObjectRef(task) ;
487 //____________________________________________________________________________
488 Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
489 { //---------- SDigitizer -------------------------
491 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
494 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
496 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
500 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
503 cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
504 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
506 emcal = new TTask("EMCAL", "") ;
510 TString sdname(name) ;
513 sdname.ReplaceAll("/","_") ;
514 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
516 emcalsd = new AliEMCALSDigitizer() ;
517 //Note, we can not call constructor with parameters: it will call Getter and screw up everething
518 emcalsd->SetName(sdname) ;
519 emcalsd->SetTitle(file) ;
520 emcal->Add(emcalsd) ;
526 //____________________________________________________________________________
527 Bool_t AliEMCALGetter::PostDigits(const char * name) const
528 { //---------- Digits -------------------------
530 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
532 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
534 if ( !emcalFolder ) {
536 cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
537 cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
539 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
542 TObject* dig = emcalFolder->FindObject( name ) ;
544 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
545 digits->SetName(name) ;
546 emcalFolder->Add(digits) ;
551 //____________________________________________________________________________
552 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
553 { //------- Digits ----------------------
555 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
557 if ( !fDigitsFolder ) {
558 cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
562 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
563 if ( !emcalFolder ) {
564 cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
568 TObject * d = emcalFolder->FindObject(name) ;
572 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
576 //____________________________________________________________________________
577 Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
578 { //---------- Digitizer -------------------------
580 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
583 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
586 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
589 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
590 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
592 emcal = new TTask("EMCAL", "") ;
596 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
599 emcal->GetListOfTasks()->Remove(emcald) ;
601 emcal->Add(digitizer) ;
605 //____________________________________________________________________________
606 Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
607 { //---------- Digitizer -------------------------
609 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
611 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
613 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
617 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
620 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
621 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
623 emcal = new TTask("EMCAL", "") ;
627 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
629 emcald = new AliEMCALDigitizer() ;
630 emcald->SetName(fDigitsTitle) ;
631 emcald->SetTitle(fHeaderFile) ;
637 //____________________________________________________________________________
638 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
640 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
642 cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder->GetName() << "/Digitizer not found!" << endl;
646 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
648 cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder->GetName() << "/Digitizer/EMCAL" << endl;
652 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
654 return emcal->GetListOfTasks()->GetObjectRef(task) ;
658 //____________________________________________________________________________
659 Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
660 { // -------------- RecPoints -------------------------------------------
662 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
663 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
665 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
667 if ( !emcalFolder ) {
669 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
670 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
672 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
676 TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ;
677 if ( !emcalRPoTowerFolder ) {
679 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
680 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl;
682 emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ;
685 TObject * erp = emcalFolder->FindObject( name ) ;
687 TObjArray * towerrp = new TObjArray(100) ;
688 towerrp->SetName(name) ;
689 emcalRPoTowerFolder->Add(towerrp) ;
692 // Pre Shower RecPoints
693 TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ;
694 if ( !emcalRPoPreShoFolder ) {
696 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl;
697 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
699 emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ;
702 TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
704 TObjArray * preshorp = new TObjArray(100) ;
705 preshorp->SetName(name) ;
706 emcalRPoPreShoFolder->Add(preshorp) ;
711 //____________________________________________________________________________
712 TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const
713 { // -------------- RecPoints -------------------------------------------
715 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
717 if ( !fRecoFolder ) {
718 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
722 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
723 if ( !towerFolder ) {
724 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
729 TObject * trp = towerFolder->FindObject(name ) ;
731 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Object " << name << " not found!" << endl ;
734 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
738 //____________________________________________________________________________
739 TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const
740 { // -------------- RecPoints -------------------------------------------
742 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
744 if ( !fRecoFolder ) {
745 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
749 TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
750 if ( !preshoFolder ) {
751 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
755 TObject * prp = preshoFolder->FindObject(name ) ;
757 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Object " << name << " not found! " << endl ;
760 return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
764 //____________________________________________________________________________
765 Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const
766 { // ------------------ AliEMCALClusterizer ------------------------
768 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
770 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
773 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
777 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
780 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
781 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
783 emcal = new TTask("EMCAL", "") ;
787 AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
790 cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
792 emcal->GetListOfTasks()->Remove(emcalcl) ;
798 //____________________________________________________________________________
799 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
800 { // ------------------ AliEMCALClusterizer ------------------------
802 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
805 cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
809 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
811 cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl;
815 TList * l = emcal->GetListOfTasks() ;
819 TString cluname(name) ;
821 while((task = static_cast<TTask *>(it.Next()) )){
822 TString taskname(task->GetName()) ;
823 if(taskname.BeginsWith(cluname)){
830 return l->GetObjectRef(clu) ;
832 cerr << "ERROR: AliEMCALGetter::Post RerRef -> task " << task->GetName() << " not found! " << endl ;
837 //____________________________________________________________________________
838 Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
839 { // ------------------ AliEMCALClusterizer ------------------------
841 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
843 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
846 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
850 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
853 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
854 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
856 emcal = new TTask("EMCAL", "") ;
860 TList * l = emcal->GetListOfTasks() ;
865 while((task = static_cast<TTask *>(it.Next()) )){
866 TString taskname(task->GetName()) ;
867 if(taskname.BeginsWith(clun))
871 AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
872 emcal->Add(emcalcl) ;
877 //____________________________________________________________________________
878 /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
879 { // ---------------TrackSegments -----------------------------------
881 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
883 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
885 if ( !emcalFolder ) {
887 cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
888 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl;
890 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
893 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
894 if ( !emcalTSFolder ) {
896 cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
897 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl;
899 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
902 TObject * tss = emcalTSFolder->FindObject( name ) ;
904 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
906 emcalTSFolder->Add(ts) ;
911 //____________________________________________________________________________
912 TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
913 { // ---------------TrackSegments -----------------------------------
915 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
917 if ( !fRecoFolder ) {
918 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
922 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
923 if ( !emcalFolder ) {
924 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
928 TObject * tss = emcalFolder->FindObject(name) ;
930 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> object " << name << " not found! " << endl ;
933 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
936 //____________________________________________________________________________
937 Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
938 { //------------Track Segment Maker ------------------------------
940 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
942 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
945 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
949 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
952 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
953 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
955 emcal = new TTask("EMCAL", "") ;
959 AliEMCALTrackSegmentMaker * emcalts =
960 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
963 emcal->GetListOfTasks()->Remove(emcalts) ;
965 emcal->Add(tsmaker) ;
969 //____________________________________________________________________________
970 Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
971 { //------------Track Segment Maker ------------------------------
973 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
976 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
979 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
983 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
986 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
987 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl;
989 emcal = new TTask("EMCAL", "") ;
993 AliEMCALTrackSegmentMaker * emcalts =
994 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ;
996 emcalts = new AliEMCALTrackSegmentMakerv1() ;
999 emcalts->SetName(tsn) ;
1000 emcal->Add(emcalts) ;
1006 //____________________________________________________________________________
1007 TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
1008 { //------------Track Segment Maker ------------------------------
1010 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1013 cerr << "ERROR: AliEMCALGetter::TSLakerRef TerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1017 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1019 cerr <<"WARNING: AliEMCALGetter::TSMakerRef TerRef -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl;
1023 TList * l = emcal->GetListOfTasks() ;
1027 TString tsmname(name) ;
1029 while((task = static_cast<TTask *>(it.Next()) )){
1030 TString taskname(task->GetName()) ;
1031 if(taskname.BeginsWith(tsmname)){
1038 return l->GetObjectRef(tsm) ;
1040 cerr << "ERROR: AliEMCALGetter::TSLakerRef -> task " << task->GetName() << " not found! " << endl ;
1045 //____________________________________________________________________________
1046 Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
1047 { // -------------------- RecParticles ------------------------
1049 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
1051 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
1053 if ( !emcalFolder ) {
1055 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
1056 cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
1058 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
1061 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
1062 if ( !emcalRPaFolder ) {
1064 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
1065 cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl;
1067 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
1070 TObject * rps = emcalRPaFolder->FindObject( name ) ;
1072 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
1074 emcalRPaFolder->Add(rp) ;
1079 //____________________________________________________________________________
1080 TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
1081 { // ---------------TrackSegments -----------------------------------
1083 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
1085 if ( !fRecoFolder ) {
1086 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
1090 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1091 if ( !emcalFolder ) {
1092 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
1096 TObject * tss = emcalFolder->FindObject(name) ;
1098 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> object " << name << " not found! " << endl ;
1101 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
1104 //____________________________________________________________________________
1105 Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
1106 { // ------------AliEMCAL PID -----------------------------
1108 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1111 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1115 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1118 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl;
1119 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl;
1121 emcal = new TTask("EMCAL", "") ;
1125 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1128 cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName()
1129 << " already exists" << endl ;
1130 emcal->GetListOfTasks()->Remove(emcalpid) ;
1137 //____________________________________________________________________________
1138 Bool_t AliEMCALGetter::PostPID(const char * name) const
1140 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1142 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1145 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1149 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1152 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl;
1153 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl;
1155 emcal = new TTask("EMCAL", "") ;
1159 TList * l = emcal->GetListOfTasks() ;
1161 TString pidname(name) ;
1164 while((task = static_cast<TTask *>(it.Next()) )){
1165 TString taskname(task->GetName()) ;
1166 if(taskname.BeginsWith(pidname))
1170 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1172 emcalpid->SetName(pidname) ;
1173 emcal->Add(emcalpid) ;
1178 //____________________________________________________________________________
1179 TObject ** AliEMCALGetter::PIDRef(const char * name) const
1180 { //------------PID ------------------------------
1182 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1185 cerr << "ERROR: AliEMCALGetter::PIDRef PerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1189 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1191 cerr <<"WARNING: AliEMCALGetter::PIDRef PerRef -> //" << fTasksFolder->GetName() << "/ReconstructionerEMCAL not found!" << endl;
1195 TList * l = emcal->GetListOfTasks() ;
1199 TString pidname(name) ;
1201 while((task = static_cast<TTask *>(it.Next()) )){
1202 TString taskname(task->GetName()) ;
1203 if(taskname.BeginsWith(pidname)){
1210 return l->GetObjectRef(pid) ;
1212 cerr << "ERROR: AliEMCALGetter::PIDRef -> task " << task->GetName() << " not found! " << endl ;
1217 //____________________________________________________________________________
1218 Bool_t AliEMCALGetter::PostQA(void) const
1219 { // ------------------ QA ---------------------------------
1221 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
1223 TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ;
1224 if ( !emcalFolder ) {
1226 cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1227 cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl;
1229 emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ;
1235 //____________________________________________________________________________
1236 TObject ** AliEMCALGetter::AlarmsRef(void) const
1237 { //------- Alarms ----------------------
1240 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL
1242 cerr << "ERROR: AliEMCALGetter::AlarmsRef QRef -> Folder //" << fQAFolder << " not found!" << endl;
1246 TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1247 if ( !emcalFolder ) {
1248 cerr << "ERROR: AliEMCALGetter::AlarmsRef QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1252 return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
1255 //____________________________________________________________________________
1256 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1258 // Return primary particle numbered by <index>
1264 p = fAlice->Particle(index) ;
1266 p = gAlice->Particle(index) ;
1267 // if (p->GetFirstMother() != -1 ) {
1268 // cout << "AliEMCALGetter::Primary : Not a primary " << endl ;
1275 //____________________________________________________________________________
1276 void AliEMCALGetter::ReadTreeD()
1278 // Read the digit tree gAlice->TreeD()
1280 TTree * treeD = gAlice->TreeD() ;
1282 if(!treeD) { // TreeD not found in header file
1285 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find TreeD in " << fHeaderFile << endl ;
1287 TString searchFileName("") ;
1289 if (Digitizer()) // Digitizer found in header file
1290 searchFileName = Digitizer()->GetTitle() ;
1292 else if (Clusterizer()) // Clusterizer found in header file
1293 searchFileName = Clusterizer()->GetDigitsFileName() ;
1295 if (treeD = TreeD(searchFileName)) { //found TreeD in the file which contains the hits
1297 cout << "INFO: AliEMCALGetter::ReadTreeD -> TreeD found in " << searchFileName.Data() << endl ;
1300 cerr << "ERROR: AliEMCALGetter::ReadTreeD -> TreeD not found " << endl ;
1304 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
1306 TBranch * branch = 0 ;
1307 TBranch * digitsbranch = 0 ;
1308 TBranch * digitizerbranch = 0 ;
1309 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1311 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1312 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1313 digitsbranch = branch ;
1314 emcalfound = kTRUE ;
1316 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1317 digitizerbranch = branch ;
1318 digitizerfound = kTRUE ;
1322 if ( !emcalfound || !digitizerfound ) {
1324 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
1325 << fDigitsTitle << endl ;
1330 if(!Digits(fDigitsTitle) )
1331 PostDigits(fDigitsTitle);
1332 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1333 digitsbranch->GetEntry(0) ;
1336 // read the Digitizer
1337 if(!Digitizer(fDigitsTitle))
1338 PostDigitizer(fDigitsTitle) ;
1340 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1341 digitizerbranch->GetEntry(0) ;
1346 //____________________________________________________________________________
1347 void AliEMCALGetter::ReadTreeH()
1349 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1351 TTree * treeH = gAlice->TreeH() ;
1353 if(!treeH) {// TreeH not found in header file
1356 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find TreeH in " << fHeaderFile << endl ;
1358 TString searchFileName("") ;
1360 if (SDigitizer()) // SDigitizer found in header file
1361 searchFileName = SDigitizer()->GetTitle() ;
1363 else if (Digitizer()) // Digitizer found in header file
1364 searchFileName = Digitizer()->GetHitsFileName() ;
1366 else if (Clusterizer()) // Clusterizer found in header file
1367 searchFileName = Clusterizer()->GetHitsFileName() ;
1369 if (treeH = TreeH(searchFileName)) { //found TreeH in the file which contains the hits
1371 cout << "INFO: AliEMCALGetter::ReadTreeH -> TreeH found in " << searchFileName.Data() << endl ;
1374 cerr << "ERROR: AliEMCALGetter::ReadTreeH -> TreeH not found " << endl ;
1379 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1380 if ( !hitsbranch ) {
1382 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1388 if (hitsbranch->GetEntries() > 1 ) {
1389 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1390 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1391 hitsbranch->SetAddress(&tempo) ;
1394 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1395 hitsbranch->GetEntry(i) ;
1397 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1398 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1399 new((*hits)[index]) AliEMCALHit( *hit ) ;
1406 hitsbranch->SetAddress(HitsRef()) ;
1407 hitsbranch->GetEntry(0) ;
1411 //____________________________________________________________________________
1412 void AliEMCALGetter::Track(Int_t itrack)
1414 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1416 if(gAlice->TreeH()== 0){
1417 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1421 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1422 if ( !hitsbranch ) {
1424 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1429 hitsbranch->SetAddress(HitsRef()) ;
1430 hitsbranch->GetEntry(itrack) ;
1436 //____________________________________________________________________________
1437 TTree * AliEMCALGetter::TreeK(TString filename)
1440 // returns TreeK from file filename
1441 // usefull in case of split file
1443 if ( filename.IsNull() )
1444 filename = fHeaderFile ;
1447 // file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1448 if (!file) { // file not open yet
1450 file = TFile::Open(filename.Data(), "read") ;
1452 fAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
1455 TString treeName("TreeK") ;
1456 treeName += EventNumber() ;
1457 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1458 if (!tree && fDebug)
1459 cout << "WARNING: AliEMCALGetter::TreeK -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
1464 //____________________________________________________________________________
1465 TTree * AliEMCALGetter::TreeH(TString filename)
1468 // returns TreeH from file filename
1469 // usefull in case of split file
1471 if ( filename.IsNull() )
1472 filename = fHeaderFile ;
1475 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1476 if (!file) { // file not open yet
1477 file = TFile::Open(filename.Data(), "read") ;
1479 TString treeName("TreeH") ;
1480 treeName += EventNumber() ;
1481 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1482 if (!tree && fDebug)
1483 cout << "WARNING: AliEMCALGetter::TreeH -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
1488 //____________________________________________________________________________
1489 TTree * AliEMCALGetter::TreeS(TString filename)
1492 // returns TreeS from file filename
1493 // usefull in case of split file
1495 if ( filename.IsNull() )
1496 filename = fHeaderFile ;
1499 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1500 if (!file) { // file not open yet
1501 file = TFile::Open(filename.Data(), "read") ;
1503 TString treeName("TreeS") ;
1504 treeName += EventNumber() ;
1505 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1506 if (!tree && fDebug)
1507 cout << "WARNING: AliEMCALGetter::TreeS -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
1512 //____________________________________________________________________________
1513 TTree * AliEMCALGetter::TreeD(TString filename)
1516 // returns TreeD from file filename
1517 // usefull in case of split file
1519 if ( filename.IsNull() )
1520 filename = fHeaderFile ;
1523 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1524 if (!file) { // file not open yet
1525 file = TFile::Open(filename.Data(), "read") ;
1527 TString treeName("TreeD") ;
1528 treeName += EventNumber() ;
1529 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1530 if (!tree && fDebug)
1531 cout << "WARNING: AliEMCALGetter::TreeD -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
1536 //____________________________________________________________________________
1537 // void AliEMCALGetter::ReadTreeQA()
1539 // Read the digit tree gAlice->TreeQA()
1540 // so far only EMCAL knows about this Tree
1542 // if(EMCAL()->TreeQA()== 0){
1543 // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ;
1547 // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ;
1550 // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ;
1557 // qabranch->SetAddress(AlarmsRef()) ;
1559 // qabranch->GetEntry(0) ;
1561 // PostQA("EMCAL") ;
1562 // TFolder * alarmsF = Alarms() ;
1563 // alarmsF->Clear() ;
1564 // qabranch->SetAddress(&alarmsF) ;
1565 // qabranch->GetEntry(0) ;
1569 //____________________________________________________________________________
1570 void AliEMCALGetter::ReadTreeR()
1572 // Read the reconstrunction tree gAlice->TreeR()
1574 if(gAlice->TreeR()== 0){
1576 cout << "WARNING: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ;
1581 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
1583 TBranch * branch = 0 ;
1584 TBranch * towerbranch = 0 ;
1585 TBranch * preshobranch = 0 ;
1586 TBranch * clusterizerbranch = 0 ;
1587 Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ;
1589 while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) )
1590 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
1591 if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
1592 towerbranch = branch ;
1593 emcaltowerrpfound = kTRUE ;
1595 else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
1596 preshobranch = branch ;
1597 emcalpreshorpfound = kTRUE ;
1599 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1600 clusterizerbranch = branch ;
1601 clusterizerfound = kTRUE ;
1605 if ( !emcaltowerrpfound ) {
1607 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title "
1608 << fRecPointsTitle << endl ;
1611 if ( !emcalpreshorpfound ) {
1613 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title "
1614 << fRecPointsTitle << endl ;
1617 if ( !clusterizerfound ) {
1619 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title "
1620 << fRecPointsTitle << endl ;
1624 // Read and Post the RecPoints
1625 if(!TowerRecPoints(fRecPointsTitle) )
1626 PostRecPoints(fRecPointsTitle) ;
1627 towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
1628 towerbranch->GetEntry(0) ;
1630 preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ;
1631 preshobranch->GetEntry(0) ;
1633 if(!Clusterizer(fRecPointsTitle) )
1634 PostClusterizer(fRecPointsTitle) ;
1636 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1637 clusterizerbranch->GetEntry(0) ;
1640 //------------------- TrackSegments ---------------------
1642 // TBranch * tsbranch = 0 ;
1643 // TBranch * tsmakerbranch = 0 ;
1644 // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1646 // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) )
1647 // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
1648 // if ( strcmp(branch->GetName(), "EMCALTS")==0){
1649 // tsbranch = branch ;
1650 // emcaltsfound = kTRUE ;
1652 // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1653 // tsmakerbranch = branch ;
1654 // tsmakerfound = kTRUE ;
1658 // if ( !emcaltsfound || !tsmakerfound ) {
1660 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
1661 // << fTrackSegmentsTitle << endl ;
1665 // // Read and Post the TrackSegments
1666 // if(!TrackSegments(fTrackSegmentsTitle))
1667 // PostTrackSegments(fTrackSegmentsTitle) ;
1668 // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1669 // tsbranch->GetEntry(0) ;
1671 // // Read and Post the TrackSegment Maker
1672 // if(!TrackSegmentMaker(fTrackSegmentsTitle))
1673 // PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1674 // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
1675 // tsmakerbranch->GetEntry(0) ;
1678 // //------------ RecParticles ----------------------------
1680 // TBranch * rpabranch = 0 ;
1681 // TBranch * pidbranch = 0 ;
1682 // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
1684 // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
1685 // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1686 // if ( strcmp(branch->GetName(), "EMCALRP")==0) {
1687 // rpabranch = branch ;
1688 // emcalrpafound = kTRUE ;
1690 // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
1691 // pidbranch = branch ;
1692 // pidfound = kTRUE ;
1696 // if ( !emcalrpafound || !pidfound ) {
1698 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
1699 // << fRecParticlesTitle << endl ;
1703 // // Read and Post the RecParticles
1704 // if(!RecParticles(fRecParticlesTitle))
1705 // PostRecParticles(fRecParticlesTitle) ;
1706 // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1707 // rpabranch->GetEntry(0) ;
1709 // // Read and Post the PID
1710 // if(!PID(fRecParticlesTitle))
1711 // PostPID(fRecParticlesTitle) ;
1712 // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
1713 // pidbranch->GetEntry(0) ;
1718 //____________________________________________________________________________
1719 void AliEMCALGetter::ReadTreeS(Int_t event)
1721 // Read the summable digits tree gAlice->TreeS()
1723 // loop over all opened files and read their SDigits to the White Board
1724 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
1726 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1727 TCollection * folderslist = emcalF->GetListOfFolders() ;
1729 //Add current file to list if it is not there yet
1731 TString subdir(fHeaderFile) ;
1732 subdir.ReplaceAll("/","_") ;
1734 if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){
1735 emcalF->AddFolder(subdir, "");
1738 TIter next(folderslist) ;
1739 TFolder * folder = 0 ;
1742 while ( (folder = static_cast<TFolder*>(next())) ) {
1743 TString fileName(folder->GetName()) ;
1744 fileName.ReplaceAll("_","/") ;
1745 if(fHeaderFile.CompareTo(fileName) == 0 )
1746 treeS=gAlice->TreeS() ;
1748 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1751 // Get SDigits Tree header from file
1752 TString treeName("TreeS") ;
1754 treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
1756 if(!treeS){ // TreeS not found in header file
1759 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Cannot find TreeS in " << fHeaderFile << endl;
1761 TString searchFileName("") ;
1763 if (SDigitizer()) // SDigitizer found in header file
1764 searchFileName = SDigitizer()->GetTitle() ;
1766 else if (Digitizer()) // Digitizer found in header file
1767 searchFileName = Digitizer()->GetSDigitsFileName() ;
1769 else if (Clusterizer()) // Clusterizer found in header file
1770 searchFileName = Clusterizer()->GetSDigitsFileName() ;
1772 if (treeS = TreeS(searchFileName)) { //found TreeS in the file which contains the hits
1774 cout << "INFO: AliEMCALGetter::ReadTreeS -> TreeS found in " << searchFileName.Data() << endl ;
1777 cerr << "ERROR: AliEMCALGetter::ReadTreeS -> TreeS not found " << endl ;
1782 //set address of the SDigits and SDigitizer
1783 TBranch * sdigitsBranch = 0;
1784 TBranch * sdigitizerBranch = 0;
1785 TBranch * branch = 0 ;
1786 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
1788 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1790 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
1791 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1792 emcalfound = kTRUE ;
1793 sdigitsBranch = branch ;
1796 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1797 sdigitizerfound = kTRUE ;
1798 sdigitizerBranch = branch ;
1801 if ( !emcalfound || !sdigitizerfound ) {
1803 cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
1804 << " not found" << endl ;
1808 if ( !folder->FindObject(fSDigitsTitle) )
1809 PostSDigits(fSDigitsTitle,folder->GetName()) ;
1810 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
1811 sdigitsBranch->GetEntry(0) ;
1813 TString sdname(fSDigitsTitle) ;
1815 sdname+=folder->GetName() ;
1816 if(!SDigitizer(sdname) )
1817 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
1819 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1820 sdigitizerBranch->GetEntry(0) ;
1824 // After SDigits have been read from all files, return to the first one
1827 folder = static_cast<TFolder*>(next());
1829 TString fileName(folder->GetName()) ;
1830 fileName.ReplaceAll("_","/") ;
1831 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1837 //____________________________________________________________________________
1838 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
1839 { // Read the summable digits fron treeS()
1842 TString filename("mergefile") ;
1845 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
1846 if ( !emcalFolder ) {
1847 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1849 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
1850 //set address of the SDigits and SDigitizer
1851 TBranch * sdigitsBranch = 0;
1852 TBranch * sdigitizerBranch = 0;
1853 TBranch * branch = 0 ;
1854 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
1856 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1858 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
1859 if ( strcmp(branch->GetName(), "EMCAL")==0) {
1860 emcalfound = kTRUE ;
1861 sdigitsBranch = branch ;
1864 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
1865 sdigitizerfound = kTRUE ;
1866 sdigitizerBranch = branch ;
1869 if ( !emcalfound || !sdigitizerfound ) {
1871 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
1875 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
1876 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
1878 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
1879 sdigitsBranch->GetEntry(0) ;
1881 TString sdname(sdigitsBranch->GetTitle()) ;
1884 if(!SDigitizer(sdigitsBranch->GetTitle()) )
1885 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
1887 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1888 sdigitizerBranch->GetEntry(0) ;
1893 //____________________________________________________________________________
1894 void AliEMCALGetter::ReadPrimaries()
1896 // Reads specific branches of primaries
1898 TClonesArray * ar = 0 ;
1899 if(! (ar = Primaries()) ) {
1905 if (TreeK(fHeaderFile)) { // treeK found in header file
1907 cout << "INFO: AliEMCALGetter::ReadPrimaries -> TreeK found in " << fHeaderFile.Data() << endl ;
1908 fNPrimaries = gAlice->GetNtrack() ;
1911 } else { // treeK not found in header file
1913 TString searchFileName("") ;
1915 if (SDigitizer()) // SDigitizer found in header file
1916 searchFileName = SDigitizer()->GetTitle() ;
1918 else if (Digitizer()) // Digitizer found in header file
1919 searchFileName = Digitizer()->GetHitsFileName() ;
1921 else if (Clusterizer()) // Clusterizer found in header file
1922 searchFileName = Clusterizer()->GetHitsFileName() ;
1924 if (TreeK(searchFileName)) { //found TreeK in the file which contains the hits
1926 cout << "INFO: AliEMCALGetter::ReadPrimaries -> TreeK found in " << searchFileName.Data() << endl ;
1927 fAlice->GetEvent(EventNumber()) ;
1928 fNPrimaries = fAlice->GetNtrack() ;
1931 cerr << "ERROR: AliEMCALGetter::ReadPrimaries -> TreeK not found " << endl ;
1937 for (index = 0 ; index < fNPrimaries; index++) {
1938 new ((*ar)[index]) TParticle(*(Primary(index)));
1942 //____________________________________________________________________________
1943 void AliEMCALGetter::Event(const Int_t event, const char* opt)
1945 // Reads the content of all Tree's S, D and R
1947 if (event >= gAlice->TreeE()->GetEntries() ) {
1948 cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
1951 gAlice->GetEvent(event) ;
1953 // Carefull the order of reading is important
1955 if( strstr(opt,"R") )
1958 if( strstr(opt,"D") )
1961 if(strstr(opt,"S") )
1964 if(strstr(opt,"H") )
1967 // if( strstr(opt,"Q") )
1970 if( strstr(opt,"P") || (strcmp(opt,"")==0) )
1975 //____________________________________________________________________________
1976 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
1978 // get the object named "what" from the folder
1979 // folders are named like //Folders
1981 if ( file.IsNull() )
1982 file = fHeaderFile ;
1984 TFolder * folder = 0 ;
1985 TObject * emcalO = 0 ;
1987 // if ( name.IsNull() ) {
1988 if ( what.CompareTo("Hits") == 0 ) {
1989 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
1991 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
1993 else if ( what.CompareTo("SDigits") == 0 ) {
1994 file.ReplaceAll("/","_") ;
1995 TString path = "EMCAL/" + file ;
1996 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
1999 name = fSDigitsTitle ;
2000 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2003 else if ( what.CompareTo("Digits") == 0 ){
2004 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
2007 name = fDigitsTitle ;
2008 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2011 else if ( what.CompareTo("TowerRecPoints") == 0 ) {
2012 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
2015 name = fRecPointsTitle ;
2016 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2019 else if ( what.CompareTo("PreShoRecPoints") == 0 ) {
2020 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
2023 name = fRecPointsTitle ;
2024 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2028 else if ( what.CompareTo("TrackSegments") == 0 ) {
2029 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
2032 name = fTrackSegmentsTitle ;
2033 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2036 else if ( what.CompareTo("RecParticles") == 0 ) {
2037 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
2040 name = fRecParticlesTitle ;
2041 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2044 else if ( what.CompareTo("Alarms") == 0 ){
2046 emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ;
2048 folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
2052 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2058 cout << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
2064 //____________________________________________________________________________
2065 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
2067 // get the TTask named "what" from the folder
2068 // folders are named like //Folders/Tasks/what/EMCAL/name
2070 TString search(what) ;
2071 if ( what.CompareTo("Clusterizer") == 0 )
2072 search = "Reconstructioner" ;
2073 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
2074 search = "Reconstructioner" ;
2075 else if ( what.CompareTo("PID") == 0 )
2076 search = "Reconstructioner" ;
2077 else if ( what.CompareTo("QATasks") == 0 )
2080 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
2083 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
2087 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
2089 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
2093 TList * list = emcalT->GetListOfTasks() ;
2095 if (what.CompareTo("SDigitizer") == 0) {
2096 if ( name.IsNull() )
2097 name = fSDigitsTitle ;
2098 } else if (what.CompareTo("Digitizer") == 0){
2099 if ( name.IsNull() )
2100 name = fDigitsTitle ;
2101 } else if (what.CompareTo("Clusterizer") == 0){
2102 if ( name.IsNull() )
2103 name = fRecPointsTitle ;
2104 name.Append(":clu") ;
2106 // else if (what.CompareTo("TrackSegmentMaker") == 0){
2107 // if ( name.IsNull() )
2108 // name = fTrackSegmentsTitle ;
2109 // name.Append(":tsm") ;
2111 // else if (what.CompareTo("PID") == 0){
2112 // if ( name.IsNull() )
2113 // name = fRecParticlesTitle ;
2114 // name.Append(":pid") ;
2116 // else if (what.CompareTo("QATasks") == 0){
2117 // if ( name.IsNull() )
2123 while((task = static_cast<TTask *>(it.Next()) )){
2124 TString taskname(task->GetName()) ;
2125 if(taskname.BeginsWith(name)){
2130 cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;
2135 //____________________________________________________________________________
2136 void AliEMCALGetter::RemoveTask(TString opt, TString name) const
2138 // remove a task from the folder
2139 // path is fTasksFolder/SDigitizer/EMCAL/name
2143 TList * lofTasks = 0 ;
2145 if (opt == "S") { // SDigitizer
2146 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
2151 else if (opt == "D") { // Digitizer
2152 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
2156 else if (opt == "C") { // Clusterizer
2157 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
2162 cerr << "WARNING: AliEMCALGetter::RemoveTask -> Unknown option " << opt.Data() << endl ;
2166 emcal = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
2169 lofTasks = emcal->GetListOfTasks() ;
2172 TObject * obj = lofTasks->FindObject(name) ;
2174 lofTasks->Remove(obj) ;
2177 //____________________________________________________________________________
2178 void AliEMCALGetter::RemoveObjects(TString opt, TString name) const
2180 // remove SDigits from the folder
2181 // path is fSDigitsFolder/fHeaderFileName/name
2183 TFolder * emcal = 0 ;
2184 TFolder * emcalmain = 0 ;
2186 if (opt == "H") { // Hits
2187 emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
2193 else if ( opt == "S") { // SDigits
2194 emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2197 emcal = dynamic_cast<TFolder*>(emcalmain->FindObject(fHeaderFile)) ;
2202 else if (opt == "D") { // Digits
2203 emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
2208 else if (opt == "RT") { // Tower RecPoints
2209 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
2214 else if (opt == "RP") { // Preshower RecPoints
2215 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
2221 cerr << "WARNING: AliEMCALGetter::RemoveObjects -> Unknown option " << opt.Data() << endl ;
2225 TObjArray * ar = dynamic_cast<TObjArray*>(emcal->FindObject(name)) ;
2233 emcalmain->Remove(emcal) ;
2237 //____________________________________________________________________________
2238 void AliEMCALGetter::RemoveSDigits() const
2240 TFolder * emcal= dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;