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 **************************************************************************/
18 29.05.2001 Yuri Kharlov:
19 Everywhere reading the treese TTree->GetEvent(i)
20 is replaced by reading the branches TBranch->GetEntry(0)
24 08.2002 Dmitri Peressounko:
27 //_________________________________________________________________________
28 // A singleton. This class should be used in the analysis stage to get
29 // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
30 // instead of directly reading them from galice.root file. This container
31 // ensures, that one reads Digits, made of these particular digits, RecPoints,
32 // made of these particular RecPoints, TrackSegments and RecParticles.
33 // This becomes non trivial if there are several identical branches, produced with
34 // different set of parameters.
36 // An example of how to use (see also class AliEMCALAnalyser):
37 // AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ;
38 // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
39 // AliEMCALRecParticle * part = gime->RecParticle(1) ;
41 // please->GetEvent(event) ; // reads new event from galice.root
43 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
44 //*-- Completely redesigned by Dmitri Peressounko March 2001
46 //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
47 //*-- systematic usage of TFolders without changing the interface
48 //*-- YS August 2002 : clone PHOS as closely as possible and intoduction
49 // of new IO (à la PHOS)
51 //////////////////////////////////////////////////////////////////////////////
55 // --- ROOT system ---
60 #include "TObjString.h"
62 #include "TParticle.h"
64 // --- Standard library ---
66 #include <Riostream.h>
68 // --- AliRoot header files ---
71 #include "AliConfig.h"
72 #include "AliEMCALGetter.h"
74 #include "AliEMCALDigitizer.h"
75 #include "AliEMCALSDigitizer.h"
76 #include "AliEMCALClusterizerv1.h"
77 #include "AliEMCALTrackSegmentMakerv1.h"
78 #include "AliEMCALTrackSegment.h"
79 #include "AliEMCALPIDv1.h"
80 #include "AliEMCALGeometry.h"
82 ClassImp(AliEMCALGetter)
84 AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ;
85 TFile * AliEMCALGetter::fFile = 0 ;
87 //____________________________________________________________________________
89 AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Bool_t toSplit)
91 // This is the ctor called by GetInstance and the only one that can be used
93 if ( fHeaderFile.Contains("_") ) {
94 Fatal("AliEMCALGetter","Invalid file name (_ not allowed) %s",fHeaderFile.Data()) ;
104 fHeaderFile = headerFile ;
106 fPrimaries = new TObjArray(1) ;
108 fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules"));
109 fPrimariesFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data"));
110 fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits"));
111 fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits"));
112 fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data"));
113 fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData"));
114 //fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA"));
115 fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ;
117 //Set titles to branches and create EMCAL specific folders
119 SetTitle(branchTitle) ;
121 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
125 fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
127 if(!fFile){ //if file was not opened yet, read gAlice
128 fFile = TFile::Open(fHeaderFile.Data(), "update") ;
129 if (!fFile->IsOpen()) {
130 Error("AliEMCALGetter","Cannot open %s",fHeaderFile.Data()) ;
135 gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ;
139 Error("AliEMCALGetter","Cannot find gAlice in %s",fHeaderFile.Data()) ;
145 Info("AliEMCALGetter","Posting EMCAL to Folders") ;
147 if (gAlice->GetDetector("EMCAL")) {
148 AliConfig * conf = AliConfig::Instance() ;
149 conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
150 conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
153 Error("AliEMCALGetter"," Detector EMCAL not found");
159 //____________________________________________________________________________
161 AliEMCALGetter::~AliEMCALGetter()
164 fPrimaries->Delete() ;
168 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
169 TCollection * folderslist = emcalF->GetListOfFolders() ;
170 TIter next(folderslist) ;
171 TFolder * folder = 0 ;
173 while ( (folder = static_cast<TFolder*>(next())) )
174 emcalF->Remove(folder) ;
185 //____________________________________________________________________________
187 void AliEMCALGetter::CloseFile()
195 //____________________________________________________________________________
197 const TFolder * AliEMCALGetter::Folder(const TString what) const {
199 // returns the EMCAL folder required by what
200 // what = hits, sdigits, digits
202 if ( what == "hits" )
203 return dynamic_cast<const TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
204 else if ( what == "sdigits" )
205 return dynamic_cast<const TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
206 else if ( what == "digits" )
207 return dynamic_cast<const TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
209 Error("GetFolder","%s illegal option (hits, sdigits, digits) ", what.Data()) ;
214 //____________________________________________________________________________
216 AliEMCALGetter * AliEMCALGetter::GetInstance()
218 // Returns the pointer of the unique instance already defined
228 //____________________________________________________________________________
230 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
231 const char* branchTitle,
232 const Bool_t toSplit)
234 // Creates and returns the pointer of the unique instance
235 // Must be called only when the environment has changed
238 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ;
239 if(fgObjGetter->fFailed)
245 //First checks, if header file already opened
247 if(!fgObjGetter->fFile){
248 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ;
249 if(fgObjGetter->fFailed)
255 if(fgObjGetter->fHeaderFile.CompareTo(headerFile)==0){ //Opened the same header file
256 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0)&& //Open the same branch title
257 (toSplit==fgObjGetter->fToSplit)){ //Nothing should be cleaned
259 else{ //Clean all data and AliEMCAL...zers
260 if(fgObjGetter->fToSplit)
261 fgObjGetter->CloseSplitFiles() ;
262 //fgObjGetter->CleanWhiteBoard() ;
263 fgObjGetter->fToSplit = toSplit ;
264 fgObjGetter->SetTitle(branchTitle) ;
267 else{ //Close already opened files, clean memory and open new header file
268 if(gAlice){ //should first delete gAlice, then close file
269 //Should be in dtor of EMCAL, but if one changes path ...
270 fgObjGetter->fModuleFolder->Remove(fgObjGetter->fModuleFolder->FindObject("EMCAL")) ;
273 if(fgObjGetter->fFile){
274 fgObjGetter->fFile->Close() ;
275 fgObjGetter->fFile=0;
277 if(fgObjGetter->fToSplit)
278 fgObjGetter->CloseSplitFiles() ;
279 fgObjGetter->CleanWhiteBoard() ;
280 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ;
287 //____________________________________________________________________________
289 const Bool_t AliEMCALGetter::BranchExists(const TString recName) const
291 //Looks in the tree Tree"name" if branch with current name olready exists
293 TString filename("") ;
294 TString name, dataname, zername;
295 if(recName == "SDigits"){
296 filename=fSDigitsFileName ;
299 zername = "AliEMCALSDigitizer" ;
301 else if(recName == "Digits"){
302 filename=fDigitsFileName ;
305 zername = "AliEMCALDigitizer" ;
307 else if(recName =="RecPoints"){
308 filename=fRecPointsFileName ;
310 dataname = "EMCALEmcRP" ;
311 zername = "AliEMCALClusterizer" ;
313 else if(recName == "TrackSegments"){
314 filename=fTrackSegmentsFileName ;
316 dataname = "EMCALTS" ;
317 zername = "AliEMCALTrackSegmentMaker" ;
319 else if(recName == "RecParticles"){
320 filename= fRecParticlesFileName ;
322 dataname = "EMCALRP" ;
323 zername = "AliEMCALPID" ;
331 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
333 file = TFile::Open(fSDigitsFileName.Data(),"update");
338 tree = (TTree *)file->Get(name.Data()) ;
343 TObjArray * lob = static_cast<TObjArray*>(tree->GetListOfBranches()) ;
345 TBranch * branch = 0 ;
346 TString titleName(fBranchTitle);
349 while ((branch = (static_cast<TBranch*>(next())))) {
350 TString branchName(branch->GetName() ) ;
351 TString branchTitle(branch->GetTitle() ) ;
352 if ( branchName.BeginsWith(dataname) && branchTitle.BeginsWith(fBranchTitle) ){
353 Warning("BranchExists", "branch %s with title %s already exits in %s", dataname.Data(), fBranchTitle.Data(), name.Data());
357 if ( branchName.BeginsWith(zername) && branchTitle.BeginsWith(titleName) ){
358 Warning("BranchExists","Branch AliEMCAL... with title %s already exits in %s",branch->GetTitle(), name.Data());
363 //We can't delete three if gAlice points to it... To be redisigned somehow???!!!
366 if(name.Contains("TreeS"))
367 if(tree!=gAlice->TreeS())
369 if(name.Contains("TreeD"))
370 if(tree!=gAlice->TreeD())
372 if(name.Contains("TreeR"))
373 if(tree!=gAlice->TreeR())
380 //____________________________________________________________________________
382 void AliEMCALGetter::ListBranches(Int_t event) const
384 TBranch * branch = 0 ;
385 if (gAlice->GetEvent(event) == -1)
388 TTree * t = gAlice->TreeH() ;
391 Info("ListBranches"," -> ****** Hits : ");
392 TObjArray * lob = t->GetListOfBranches() ;
395 while ( (branch = static_cast<TBranch*>(next())) )
396 Info("ListBranches"," %s", branch->GetName());
399 Warning("ListBranches"," -> TreeH not found for event %d",event);
401 t = gAlice->TreeS() ;
404 Info("ListBranches"," -> ****** SDigits : ");
405 TObjArray * lob = t->GetListOfBranches() ;
408 while ( (branch = static_cast<TBranch*>(next())) )
409 Info("ListBranches"," %s %s",branch->GetName(),branch->GetTitle());
411 Warning("ListBranches"," -> TreeS not found for event %d",event);
413 t = gAlice->TreeD() ;
416 Info("ListBranches"," -> ****** Digits : ");
417 TObjArray * lob = t->GetListOfBranches() ;
420 while ( (branch = static_cast<TBranch*>(next())) )
421 Info(" %s %s", branch->GetName(), branch->GetTitle());
423 Warning("ListBranches"," -> TreeD not found for event %d", event);
425 t = gAlice->TreeR() ;
428 Info("ListBranches"," -> ****** Recon : ");
429 TObjArray * lob = t->GetListOfBranches() ;
431 while ( (branch = static_cast<TBranch*>(next())) )
432 Info(" %s %s", branch->GetName(), branch->GetTitle());
434 Warning("ListBranches"," -> TreeR not found for event %d",event);
437 //____________________________________________________________________________
439 void AliEMCALGetter::NewBranch(TString name, Int_t event)
441 fBranchTitle = fSDigitsTitle = fDigitsTitle = fRecPointsTitle = fTrackSegmentsTitle = fRecParticlesTitle = name ;
445 //____________________________________________________________________________
447 Bool_t AliEMCALGetter::NewFile(TString name)
453 fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
455 if(!fFile) { //if file was not opened yet, read gAlice
456 fFile = TFile::Open(fHeaderFile.Data(),"update") ;
457 if (!fFile->IsOpen()) {
458 Error("NewFile", " -> Cannot open %s", fHeaderFile.Data());
462 gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ;
466 Error("NewFile"," -> Cannot find gAlice in %s", fHeaderFile.Data());
473 //____________________________________________________________________________
475 const AliEMCAL * AliEMCALGetter::EMCAL()
477 // returns the EMCAL object
479 AliEMCAL * emcal = dynamic_cast<AliEMCAL*>(fModuleFolder->FindObject("EMCAL")) ;
483 Warning("EMCAL"," -> EMCAL module not found in Folders" );
487 //____________________________________________________________________________
489 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
491 AliEMCALGeometry * rv = 0 ;
493 rv = EMCAL()->GetGeometry() ;
497 //____________________________________________________________________________
499 const Bool_t AliEMCALGetter::PostPrimaries(void) const
501 //------- Primaries ----------------------
502 // the hierarchy is //Folders/RunMC/Event/Data/Primaries
504 TFolder * primariesFolder = dynamic_cast<TFolder*>(fPrimariesFolder->FindObject("Primaries")) ;
505 if ( !primariesFolder ) {
507 Warning("PostPrimaries", "-> Folder //%s/Primaries/ not found!", fPrimariesFolder->GetName());
508 Info("PostPrimaries", "-> Adding Folder //%s/Primaries/",fPrimariesFolder->GetName());
510 primariesFolder = fPrimariesFolder->AddFolder("Primaries", "Primaries particles from TreeK") ;
513 TClonesArray *primaries= new TClonesArray("TParticle",1000) ;
514 primaries->SetName("Primaries") ;
515 primariesFolder->Add(primaries) ;
520 //____________________________________________________________________________
522 TObject** AliEMCALGetter::PrimariesRef(void) const
524 //------- Primaries ----------------------
525 // the hierarchy is //Folders/RunMC/Event/Data/Primaries
527 if ( !fPrimariesFolder ) {
528 Fatal("PrimariesRef", "-> Folder //%s not found!",fPrimariesFolder);
531 TFolder * primariesFolder = dynamic_cast<TFolder *>(fPrimariesFolder->FindObject("Primaries")) ;
533 if ( !primariesFolder ) {
534 Fatal("PrimariesRef", "-> Folder //%s/Primaries/ not found!",fPrimariesFolder);
537 TObject * p = primariesFolder->FindObject("Primaries") ;
540 Fatal("PrimariesRef", "-> %s/Primaries not found !",primariesFolder->GetName());
543 return primariesFolder->GetListOfFolders()->GetObjectRef(p) ;
546 //____________________________________________________________________________
548 const Bool_t AliEMCALGetter::PostHits(void) const
550 //------- Hits ----------------------
551 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
553 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
555 if ( !emcalFolder ) {
557 Warning("PostHits", "-> Folder //%s/EMCAL/ not found!", fHitsFolder);
558 Info("PostHits", "-> Adding Folder //%s/EMCAL/",fHitsFolder);
560 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
563 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
564 hits->SetName("Hits") ;
565 emcalFolder->Add(hits) ;
570 //____________________________________________________________________________
572 TObject ** AliEMCALGetter::HitsRef(void) const
574 //------- Hits ----------------------
575 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
577 if ( !fHitsFolder ) {
578 Error("HitsRef", "-> Folder //%s not found!",fHitsFolder);
582 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
583 if ( !emcalFolder ) {
584 Error("HitsRef", "-> Folder //%s/EMCAL/ not found!",fHitsFolder);
588 TObject * h = emcalFolder->FindObject("Hits") ;
591 Error("HitsRef", "-> %s/Hits not found !",emcalFolder->GetName());
595 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
598 //____________________________________________________________________________
600 const Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
602 //---------- SDigits -------------------------
603 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
604 // because you can have sdigits from several hit files for mixing
606 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
608 if ( !emcalFolder ) {
610 Warning("PostSDigits", "-> Folder //%s/EMCAL/ not found!", fSDigitsFolder);
611 Info("PostSDigits", "-> Adding Folder //%s/EMCAL/",fHitsFolder);
613 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
616 TString subdir(headerFile) ;
617 subdir.ReplaceAll("/", "_") ;
618 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
619 if ( !emcalSubFolder )
620 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
622 TObject * sd = emcalSubFolder->FindObject(name);
625 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
626 sdigits->SetName(name) ;
627 emcalSubFolder->Add(sdigits) ;
633 //____________________________________________________________________________
635 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
637 //------- SDigits ----------------------
638 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
640 if ( !fSDigitsFolder ) {
641 Fatal("SDigitsRef", "-> Folder //%s not found!", fSDigitsFolder);
644 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
646 if ( !emcalFolder ) {
647 Fatal("SDigitsRef", "-> Folder //%s/EMCAL/ not found!", fSDigitsFolder);
650 TFolder * emcalSubFolder = 0 ;
653 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
655 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
657 if(!emcalSubFolder) {
658 Fatal("SDigitsRef", "-> Folder //Folders/RunMC/Event/Data/EMCAL/%s not found!", file);
661 TObject * dis = emcalSubFolder->FindObject(name) ;
664 Fatal("SDigitsRef", "-> object %s not found!", name);
667 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
670 //____________________________________________________________________________
672 const Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
674 //---------- SDigitizer -------------------------
675 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
677 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
680 Error("PostSDigitizer", "-> Task //%s/SDigitizer not found!",fTasksFolder);
684 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
688 Warning("PostSDigitizer", "->//%s/SDigitizer/EMCAL/ not found!",fTasksFolder);
689 Info("PostSDigitizer", "-> Adding //%s/SDigitizer/EMCAL/", fTasksFolder);
691 emcal = new TTask("EMCAL", "") ;
695 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
699 Info("PostSDigitizer", "-> Task %s already exists",sdigitizer->GetName());
700 emcal->GetListOfTasks()->Remove(emcalsd) ;
703 emcal->Add(sdigitizer) ;
708 //____________________________________________________________________________
710 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
712 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
715 Fatal("SDigitizerRef", "-> Task //%s/SDigitizer not found!", fTasksFolder);
718 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
721 Fatal("SDigitizerRef", "-> //%s/SDigitizer/EMCAL not found!", fTasksFolder);
724 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
726 return emcal->GetListOfTasks()->GetObjectRef(task) ;
729 //____________________________________________________________________________
731 const Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
733 //---------- SDigitizer -------------------------
734 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
736 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
739 Error("PostSDigitizer", "-> Task //%s/SDigitizer not found!", fTasksFolder);
743 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
747 Warning("PostSDigitizer", "-> //%s/SDigitizer/EMCAL/ not found!", fTasksFolder);
749 Info("PostSDigitizer", "-> Adding //%s/SDigitizer/EMCAL", fTasksFolder);
752 emcal = new TTask("EMCAL", "") ;
756 TString sdname(name) ;
759 sdname.ReplaceAll("/","_") ;
760 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
763 emcalsd = new AliEMCALSDigitizer() ;
765 //Note, we can not call constructor with parameters: it will call Getter and screw up everething
767 emcalsd->SetName(sdname) ;
768 emcalsd->SetTitle(file) ;
769 emcal->Add(emcalsd) ;
775 //____________________________________________________________________________
777 const Bool_t AliEMCALGetter::PostDigits(const char * name) const
779 //---------- Digits -------------------------
780 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
782 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
784 if ( !emcalFolder ) {
786 Warning("PostDigits", "-> Folder //%s/EMCAL/ not found!", fDigitsFolder);
787 Info("PostDigits", "-> Adding Folder //%s/EMCAL/", fDigitsFolder);
789 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
792 TObject* dig = emcalFolder->FindObject( name ) ;
795 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
796 digits->SetName(name) ;
797 emcalFolder->Add(digits) ;
803 //____________________________________________________________________________
805 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
807 //------- Digits ----------------------
808 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
810 if ( !fDigitsFolder ) {
811 Fatal("DigitsRef", "-> Folder //%s not found!", fDigitsFolder);
814 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
816 if ( !emcalFolder ) {
817 Fatal("DigitsRef", "-> Folder //%s/EMCAL/ not found!", fDigitsFolder);
820 TObject * d = emcalFolder->FindObject(name) ;
823 Fatal("DigitsRef", "-> object %s not found!", name);
826 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
829 //____________________________________________________________________________
831 const Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
833 //---------- Digitizer -------------------------
835 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
838 Error("PostDigitizer", "-> Task //%s/Digitizer not found!", fTasksFolder);
842 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
846 Warning("PostDigitizer", "-> //%s/Digitizer/EMCAL not found!", fTasksFolder);
847 Info("PostDigitizer", "-> Adding //%s/Digitizer/EMCAL", fTasksFolder);
849 emcal = new TTask("EMCAL", "") ;
853 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
857 emcal->GetListOfTasks()->Remove(emcald) ;
860 emcal->Add(digitizer) ;
865 //____________________________________________________________________________
867 const Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
869 //---------- Digitizer -------------------------
870 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
872 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
876 Error("PostDigitizer", "-> Task //%s/Digitizer not found!", fTasksFolder);
880 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
884 Warning("PostDigitizer", "-> //%s/Digitizer/EMCAL not found!", fTasksFolder);
886 Info("PostDigitizer", "-> Adding //%s/Digitizer/EMCAL", fTasksFolder);
888 emcal = new TTask("EMCAL", "") ;
892 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
895 emcald = new AliEMCALDigitizer() ;
896 emcald->SetName(fDigitsTitle) ;
897 emcald->SetTitle(fHeaderFile) ;
904 //____________________________________________________________________________
906 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
909 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
912 Fatal("DigitizerRef", "-> Task //%s/Digitizer not found!", fTasksFolder->GetName());
915 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
918 Fatal("DigitizerRef", "-> //%s/Digitizer/EMCAL", fTasksFolder->GetName());
921 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
923 return emcal->GetListOfTasks()->GetObjectRef(task) ;
926 //____________________________________________________________________________
928 const Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
930 // -------------- RecPoints -------------------------------------------
931 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
932 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShowerRecPoints/name
934 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
936 if ( !emcalFolder ) {
938 Warning("PostRecPoints", "-> Folder //%s/EMCAL/ not found!", fRecoFolder);
939 Info("PostRecPoints", "-> Adding Folder //%s/EMCAL/", fRecoFolder);
941 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
944 // Pre Shower RecPoints
946 TFolder * emcalRPoPREFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PRERecPoints")) ;
948 if ( !emcalRPoPREFolder ) {
950 Warning("PostRecPoints", "-> Folder //%s/EMCAL/PRERecPoints/ not found!", fRecoFolder);
951 Info("PostRecPoints", "-> Adding Folder //%s/EMCAL/PRERecPoints/", fRecoFolder);
953 emcalRPoPREFolder = emcalFolder->AddFolder("PRERecPoints", "PRE RecPoints from EMCAL") ;
956 TObject * rpPRE = emcalRPoPREFolder->FindObject( name ) ;
959 TObjArray * aPRErp = new TObjArray(100) ;
960 aPRErp->SetName(name) ;
961 emcalRPoPREFolder->Add(aPRErp) ;
966 TFolder * emcalRPoECFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("ECRecPoints")) ;
968 if ( !emcalRPoECFolder ) {
971 Warning("PostRecPoints", "-> Folder //%s/EMCAL/ECRecPoints/ not found!", fRecoFolder);
972 Info("PostRecPoints", "-> Adding Folder //%s/EMCAL/ECRecPoints not found!", fRecoFolder);
974 emcalRPoECFolder = emcalFolder->AddFolder("ECRecPoints", "EC RecPoints from EMCAL") ;
977 TObject * rpEC = emcalFolder->FindObject( name ) ;
980 TObjArray * aECrp = new TObjArray(100) ;
981 aECrp->SetName(name) ;
982 emcalRPoECFolder->Add(aECrp) ;
987 TFolder * emcalRPoHCFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("HCRecPoints")) ;
989 if ( !emcalRPoHCFolder ) {
992 Warning("PostRecPoints", "-> Folder //%s/EMCAL/HCRecPoints/ not found!", fRecoFolder);
993 Info("PostRecPoints", "-> Adding Folder //%s/EMCAL/HCRecPoints not found!", fRecoFolder);
995 emcalRPoHCFolder = emcalFolder->AddFolder("HCRecPoints", "HC RecPoints from EMCAL") ;
998 TObject * rpHC = emcalFolder->FindObject( name ) ;
1001 TObjArray * aHCrp = new TObjArray(100) ;
1002 aHCrp->SetName(name) ;
1003 emcalRPoHCFolder->Add(aHCrp) ;
1009 //____________________________________________________________________________
1011 TObject ** AliEMCALGetter::ECRecPointsRef(const char * name) const
1013 // -------------- RecPoints -------------------------------------------
1014 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/ECRecPoints/name
1016 if ( !fRecoFolder ) {
1017 Fatal("ECRecPointsRef", "-> Folder //%s not found!", fRecoFolder);
1020 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/ECRecPoints")) ;
1022 if ( !towerFolder ) {
1023 Fatal("ECRecPointsRef", "-> Folder //%s/EMCAL/ECRecPoints/ not found!", fRecoFolder);
1026 TObject * trp = towerFolder->FindObject(name ) ;
1029 Fatal("ECRecPointsRef", "-> Object %s not found!", name);
1032 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
1035 //____________________________________________________________________________
1037 TObject ** AliEMCALGetter::HCRecPointsRef(const char * name) const
1039 // -------------- RecPoints -------------------------------------------
1040 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/HCRecPoints/name
1042 if ( !fRecoFolder ) {
1043 Fatal("HCRecPointsRef", "-> Folder //%s not found!", fRecoFolder);
1046 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/HCRecPoints")) ;
1048 if ( !towerFolder ) {
1049 Fatal("HCRecPointsRef", "-> Folder //%s/EMCAL/HCRecPoints/ not found!", fRecoFolder);
1052 TObject * trp = towerFolder->FindObject(name ) ;
1055 Fatal("HCRecPointsRef", "-> Object %s not found!", name);
1058 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
1061 //____________________________________________________________________________
1063 TObject ** AliEMCALGetter::PRERecPointsRef(const char * name) const
1065 // -------------- RecPoints -------------------------------------------
1066 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PRERecPoints/name
1068 if ( !fRecoFolder ) {
1069 Fatal("PRERecPointsRef", "-> Folder //%s not found!", fRecoFolder);
1072 TFolder * folderPRE = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PRERecPoints")) ;
1075 Fatal("PRERecPointsRef", "-> Folder //%s/EMCAL/PRERecPoints/", fRecoFolder);
1080 TObject * prp = folderPRE->FindObject(name ) ;
1083 Fatal("PRERecPointsRef", "-> Object %s not found!", name);
1086 return folderPRE->GetListOfFolders()->GetObjectRef(prp) ;
1089 //____________________________________________________________________________
1091 const Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizer * clu) const
1093 // ------------------ AliEMCALClusterizer ------------------------
1094 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1096 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1099 Error("PostClusterizer", "-> Task //%s/Reconstructioner not found!", fTasksFolder);
1103 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1107 Warning("PostClusterizer", "-> //%s/ReconstructionerEMCAL not found!", fTasksFolder);
1108 Info("PostClusterizer", "-> Adding //%s/Reconstructioner/EMCAL", fTasksFolder);
1110 emcal = new TTask("EMCAL", "") ;
1114 AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
1118 Info("PostClusterizer", "-> Task %s already exists", clu->GetName());
1120 emcal->GetListOfTasks()->Remove(emcalcl) ;
1127 //____________________________________________________________________________
1129 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
1131 // ------------------ AliEMCALClusterizer ------------------------
1133 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1136 Fatal("ClusterizerRef", "-> Task //%s/Reconstructioner not found!", fTasksFolder->GetName());
1139 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1142 Fatal("ClusterizerRef", "-> //%s/Reconstructioner/EMCAL", fTasksFolder->GetName());
1145 TList * l = emcal->GetListOfTasks() ;
1149 TString cluname(name) ;
1152 while((task = static_cast<TTask *>(it.Next()) )){
1153 TString taskname(task->GetName()) ;
1154 if(taskname.BeginsWith(cluname)){
1161 Fatal("ClusterizerRef", "-> task %s not found!", task->GetName());
1164 return l->GetObjectRef(clu) ;
1167 //____________________________________________________________________________
1169 const Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
1171 // ------------------ AliEMCALClusterizer ------------------------
1172 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1175 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1178 Error("PostClusterizer", "-> Task //%s/Reconstructioner not found!", fTasksFolder->GetName());
1182 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1186 Warning("PostClusterizer", "-> //%s/Reconstructioner/EMCAL not found!", fTasksFolder);
1187 Info("PostClusterizer", "-> Adding //%s/Reconstructioner/EMCAL", fTasksFolder);
1189 emcal = new TTask("EMCAL", "") ;
1193 TList * l = emcal->GetListOfTasks() ;
1195 TString clun(name) ;
1199 while((task = static_cast<TTask *>(it.Next()) )){
1200 TString taskname(task->GetName()) ;
1202 if(taskname.BeginsWith(clun))
1206 AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
1209 emcalcl->SetName(clun) ;
1210 emcalcl->SetTitle(fHeaderFile) ;
1211 emcal->Add(emcalcl) ;
1216 //____________________________________________________________________________
1217 const Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
1218 { // ---------------TrackSegments -----------------------------------
1220 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
1222 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
1224 if ( !emcalFolder ) {
1226 Warning("PostTrackSegments", "-> Folder //%s/EMCAL/ not found", fRecoFolder->GetName()) ;
1227 Info("PostTrackSegments", "-> Adding Folder //%s/EMCAL", fRecoFolder->GetName()) ;
1229 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
1232 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
1233 if ( !emcalTSFolder ) {
1235 Warning("PostTrackSegments", "-> Folder //%s/EMCAL/TrackSegments/ not found!", fRecoFolder->GetName() ) ;
1236 Info("PostTrackSegments", "-> Adding Folder //%s/EMCAL/TrackSegments/", fRecoFolder->GetName()) ;
1238 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
1241 TObject * tss = emcalTSFolder->FindObject( name ) ;
1243 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
1245 emcalTSFolder->Add(ts) ;
1250 //____________________________________________________________________________
1251 TObject** AliEMCALGetter::TrackSegmentsRef(const char * name) const
1252 { // ---------------TrackSegments -----------------------------------
1254 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
1256 if ( !fRecoFolder ) {
1257 Fatal("TrackSegmentsRef", "Folder //%s not found !", fRecoFolder->GetName() ) ;
1260 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
1261 if ( !emcalFolder ) {
1262 Fatal("TrackSegmentsRef", "Folder //%s/EMCAL/TrackSegments/ not found !", fRecoFolder->GetName() ) ;
1265 TObject * tss = emcalFolder->FindObject(name) ;
1267 Fatal("TrackSegmentsRef", "object %s not found !", name) ;
1269 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
1272 //____________________________________________________________________________
1273 const Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
1274 { //------------Track Segment Maker ------------------------------
1276 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1278 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1281 Error("PostTrackSegmentMaker", "Task //%s/Reconstructioner not found !", fTasksFolder) ;
1285 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1288 Warning("PostTrackSegmentMaker", "//%s/Reconstructioner/EMCAL not found!", fTasksFolder) ;
1289 Info("PostTrackSegmentMaker", "Adding //%s/Reconstructioner/EMCAL", fTasksFolder) ;
1291 emcal = new TTask("EMCAL", "") ;
1295 AliEMCALTrackSegmentMaker * emcalts =
1296 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
1299 emcal->GetListOfTasks()->Remove(emcalts) ;
1301 emcal->Add(tsmaker) ;
1305 //____________________________________________________________________________
1306 const Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
1307 { //------------Track Segment Maker ------------------------------
1309 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1311 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1314 Error("PostTrackSegmentMaker", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ;
1318 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1321 Warning("PostTrackSegmentMaker", "//%s/Reconstructioner/EMCAL not found!", fTasksFolder->GetName() ) ;
1322 Info("PostTrackSegmentMaker", "Adding //%s/Reconstructioner/EMCAL", fTasksFolder->GetName()) ;
1324 emcal = new TTask("EMCAL", "") ;
1328 TList * l = emcal->GetListOfTasks() ;
1333 while((task = static_cast<TTask *>(it.Next()) )){
1334 TString taskname(task->GetName()) ;
1335 if(taskname.BeginsWith(tsn))
1339 AliEMCALTrackSegmentMakerv1 * emcalts = new AliEMCALTrackSegmentMakerv1() ;
1341 emcalts->SetName(tsn) ;
1342 emcalts->SetTitle(fHeaderFile) ;
1343 emcal->Add(emcalts) ;
1348 //____________________________________________________________________________
1349 TObject** AliEMCALGetter::TSMakerRef(const char * name) const
1350 { //------------Track Segment Maker ------------------------------
1352 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1355 Fatal("TSMakerRef", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ;
1358 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1360 Fatal("TSMakerRef", "//%s/Reconstructioner/EMCAL not found !", fTasksFolder->GetName() ) ;
1363 TList * l = emcal->GetListOfTasks() ;
1367 TString tsmname(name) ;
1369 while((task = static_cast<TTask *>(it.Next()) )){
1370 TString taskname(task->GetName()) ;
1371 if(taskname.BeginsWith(tsmname)){
1378 Fatal("TSMakerRef", "Task //%s/Reconstructioner/EMCAL/TrackSegmentMarker/%s not found !", fTasksFolder->GetName(), name) ;
1381 return l->GetObjectRef(tsm) ;
1385 //____________________________________________________________________________
1386 const Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
1387 { // -------------------- RecParticles ------------------------
1389 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/RecParticles/name
1391 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
1393 if ( !emcalFolder ) {
1395 Warning("PostRecParticles", "-> Folder //%s/EMCAL/ not found!", fRecoFolder->GetName()) ;
1396 Info("PostRecParticles", "-> Adding Folder //%s/EMCAL/", fRecoFolder->GetName()) ;
1398 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
1401 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
1402 if ( !emcalRPaFolder ) {
1404 Warning("PostRecParticles", "-> Folder //%s/EMCAL/RecParticles/ not found!", fRecoFolder->GetName()) ;
1405 Info("PostRecParticles", "-> Adding Folder //%s/EMCAL/RecParticles/", fRecoFolder->GetName()) ;
1407 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
1410 TObject * rps = emcalRPaFolder->FindObject( name ) ;
1412 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
1414 emcalRPaFolder->Add(rp) ;
1419 //____________________________________________________________________________
1420 TObject** AliEMCALGetter::RecParticlesRef(const char * name) const
1421 { // ---------------RecParticles -----------------------------------
1423 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
1425 if ( !fRecoFolder ) {
1426 Fatal("RecParticlesRef", "Folder//%s not found !", fRecoFolder->GetName() ) ;
1429 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1430 if ( !emcalFolder ) {
1431 Fatal("RecParticlesRef", "Folder //%s/EMCAL/RecParticles/ not found !", fRecoFolder->GetName() ) ;
1434 TObject * tss = emcalFolder->FindObject(name ) ;
1436 Fatal("RecParticlesRef", "object %s not found !", name) ;
1438 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
1441 //____________________________________________________________________________
1442 const Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
1443 { // ------------AliEMCAL PID -----------------------------
1445 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1448 Error("PostPID", "Task //%s/Reconstructioner not found !", fTasksFolder) ;
1452 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1455 Warning("PostPID", "//%s/Reconstructioner/EMCAL not found!", fTasksFolder) ;
1456 Info("PostPID", "Adding //%s/Reconstructioner/EMCAL", fTasksFolder) ;
1458 emcal = new TTask("EMCAL", "") ;
1462 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1465 Info("PostPID", "-> Task %s qlready exists", pid->GetName()) ;
1466 emcal->GetListOfTasks()->Remove(emcalpid) ;
1473 //____________________________________________________________________________
1474 const Bool_t AliEMCALGetter::PostPID(const char * name) const
1476 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1478 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1481 Error("PostPID", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ;
1485 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1488 Warning("PostPID", "//%s/Reconstructioner/EMCAL not found!", fTasksFolder->GetName()) ;
1489 Info("PostPID", "Adding //%s/Reconstructioner/EMCAL", fTasksFolder->GetName()) ;
1491 emcal = new TTask("EMCAL", "") ;
1495 TList * l = emcal->GetListOfTasks() ;
1497 TString pidname(name) ;
1500 while((task = static_cast<TTask *>(it.Next()) )){
1501 TString taskname(task->GetName()) ;
1502 if(taskname.BeginsWith(pidname))
1506 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1508 emcalpid->SetName(pidname) ;
1509 emcalpid->SetTitle(fHeaderFile) ;
1510 emcal->Add(emcalpid) ;
1515 //____________________________________________________________________________
1516 TObject** AliEMCALGetter::PIDRef(const char * name) const
1517 { //------------PID ------------------------------
1519 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1522 Fatal("PIDRef", "Task //%s/Reconstructioner not found !", fTasksFolder->GetName() ) ;
1525 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1527 Fatal("PIDRef", "//%s/Reconstructioner/EMCAL not found !", fTasksFolder->GetName() ) ;
1530 TList * l = emcal->GetListOfTasks() ;
1534 TString pidname(name) ;
1536 while((task = static_cast<TTask *>(it.Next()) )){
1537 TString taskname(task->GetName()) ;
1538 if(taskname.BeginsWith(pidname)){
1545 Fatal("PIDRef", "Task //%s/Reconstructioner/EMCAL/PID/%s not found !", fTasksFolder->GetName(), name) ;
1548 return l->GetObjectRef(pid) ;
1551 //____________________________________________________________________________
1552 TTree * AliEMCALGetter::TreeK(TString filename)
1554 // returns TreeK from file filename
1555 // usefull in case of split file
1557 if ( filename.IsNull() )
1558 filename = fHeaderFile ;
1562 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1564 if (!file || !file->IsOpen()) // file not yet open
1565 file = TFile::Open(filename.Data(), "read") ;
1567 if(filename != fHeaderFile ){
1568 fAlice = dynamic_cast<AliRun *>(file->Get("gAlice")) ;
1571 TString treeName("TreeK") ;
1572 treeName += EventNumber() ;
1573 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1575 if (!tree && fDebug)
1576 Warning("TreeK", "-> %s not found in %s", treeName.Data(),filename.Data());
1581 //____________________________________________________________________________
1583 TTree * AliEMCALGetter::TreeH(TString filename)
1585 // returns TreeH from file filename
1586 // usefull in case of split file
1588 if ( filename.IsNull() )
1589 filename = fHeaderFile ;
1592 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1594 if (!file) { // file not open yet
1595 file = TFile::Open(filename.Data(), "read") ;
1598 TString treeName("TreeH") ;
1599 treeName += EventNumber() ;
1600 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1602 if (!tree && fDebug)
1603 Warning("TreeH", "-> %s not found in %s", treeName.Data(), filename.Data());
1607 //____________________________________________________________________________
1609 TTree * AliEMCALGetter::TreeS(TString filename)
1611 // returns TreeS from file filename
1612 // usefull in case of split file
1614 if ( filename.IsNull() )
1615 filename = fHeaderFile ;
1618 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1620 if (!file) { // file not open yet
1621 file = TFile::Open(filename.Data(), "read") ;
1624 TString treeName("TreeS") ;
1625 treeName += EventNumber() ;
1626 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1628 if (!tree && fDebug)
1629 Warning("TreeS", "-> %s not found in %s", treeName.Data(), filename.Data());
1633 //____________________________________________________________________________
1635 TTree * AliEMCALGetter::TreeD(TString filename)
1637 // returns TreeD from file filename
1638 // usefull in case of split file
1640 if ( filename.IsNull() )
1641 filename = fHeaderFile ;
1644 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1646 if (!file) { // file not open yet
1647 file = TFile::Open(filename.Data(), "read") ;
1650 TString treeName("TreeD") ;
1651 treeName += EventNumber() ;
1652 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1654 if (!tree && fDebug)
1655 Warning("TreeD", "-> %s not found in %s", treeName.Data(), filename.Data());
1659 //____________________________________________________________________________
1661 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1663 // Return primary particle numbered by <index>
1670 p = fAlice->Particle(index) ;
1672 p = gAlice->Particle(index) ;
1677 //____________________________________________________________________________
1679 const TParticle * AliEMCALGetter::Secondary(TParticle* p, Int_t index) const
1681 // Return first (index=1) or second (index=2) secondary particle of primary particle p
1689 Int_t daughterIndex = p->GetDaughter(index-1) ;
1690 return gAlice->Particle(daughterIndex) ;
1696 //____________________________________________________________________________
1698 Int_t AliEMCALGetter::ReadTreeD(const Int_t event)
1700 // Read the digit tree gAlice->TreeD()
1704 TFile * file = static_cast<TFile*>(gROOT->GetFile(fDigitsFileName));
1706 file = TFile::Open(fDigitsFileName) ;
1708 // Get Digits Tree header from file
1710 TString treeName("TreeD") ;
1712 treeD = dynamic_cast<TTree*>(file->Get(treeName.Data()));
1714 if(!treeD){ // TreeD not found in header file
1716 Warning("ReadTreeD", "-> Cannot find TreeD in %s", fDigitsFileName.Data());
1721 treeD = gAlice->TreeD() ;
1723 TObjArray * lob = static_cast<TObjArray*>(treeD->GetListOfBranches()) ;
1725 TBranch * branch = 0 ;
1726 TBranch * digitsbranch = 0 ;
1727 TBranch * digitizerbranch = 0 ;
1729 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1731 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1732 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1733 digitsbranch = branch ;
1734 emcalfound = kTRUE ;
1736 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1737 digitizerbranch = branch ;
1738 digitizerfound = kTRUE ;
1742 if ( !emcalfound || !digitizerfound ) {
1744 Warning("ReadTreeD", "-> Cannot find Digits and/or Digitizer with name %s", fDigitsTitle.Data());
1750 if(!Digits(fDigitsTitle) )
1751 PostDigits(fDigitsTitle);
1752 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1753 digitsbranch->GetEntry(0) ;
1755 // read the Digitizer
1757 RemoveTask("D", fDigitsTitle) ; // I do not understand why I need that
1758 if(!Digitizer(fDigitsTitle))
1759 PostDigitizer(fDigitsTitle) ;
1760 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1761 digitizerbranch->GetEntry(0) ;
1765 if(gAlice->TreeD()!=treeD)
1771 //____________________________________________________________________________
1773 Int_t AliEMCALGetter::ReadTreeH()
1775 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1777 TTree * treeH = gAlice->TreeH() ;
1779 if(!treeH) {// TreeH not found in header file
1781 Warning("ReadTreeH", "-> Cannot find TreeH in %s", fHeaderFile.Data());
1783 TString searchFileName("EMCAL.HITS") ;
1784 if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){
1785 searchFileName+="." ;
1786 searchFileName += fBranchTitle ;
1789 searchFileName+=".root" ;
1791 if ( (treeH = TreeH(searchFileName)) ) { //found TreeH in the file which contains the hits
1793 Info("ReadTreeH", "-> TreeH found in %s", searchFileName.Data());
1795 Error("ReadTreeH", "-> TreeH not found ");
1800 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1802 if ( !hitsbranch ) {
1804 Warning("ReadTreeH", "-> Cannot find branch EMCAL");
1811 if (hitsbranch->GetEntries() > 1 ) {
1812 (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
1813 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1814 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1815 hitsbranch->SetAddress(&tempo) ;
1820 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1821 hitsbranch->GetEntry(i) ;
1823 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1824 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1825 new((*hits)[index]) AliEMCALHit( *hit ) ;
1832 (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
1833 hitsbranch->SetAddress(HitsRef()) ;
1834 hitsbranch->GetEntry(0) ;
1839 //____________________________________________________________________________
1841 void AliEMCALGetter::Track(const Int_t itrack)
1843 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1844 if(gAlice->TreeH()== 0){
1845 Error("ReadTreeH", "-> Cannot read TreeH ");
1849 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1851 if ( !hitsbranch ) {
1853 Warning("ReadTreeH", "-> Cannot find branch EMCAL");
1860 (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
1861 hitsbranch->SetAddress(HitsRef()) ;
1862 hitsbranch->GetEntry(itrack) ;
1865 //____________________________________________________________________________
1867 void AliEMCALGetter::ReadTreeQA()
1870 Warning("ReadTreeQA", "-> %s not implemented", ClassName());
1875 //____________________________________________________________________________
1877 Int_t AliEMCALGetter::ReadTreeR(const Int_t event)
1880 // Read the reconstrunction tree gAlice->TreeR()
1881 // A particularity has been introduced here :
1882 // if gime->Event(ievent,"R") is called branches with the current title are read, the current title
1883 // being for example give in AliEMCALPID(fileName, title)
1884 // if gime(Event(ievent, "RA") is called the title of the branches is not checked anymore, "A" stands for any
1885 // This is a feature needed by PID to be able to reconstruct several times particles (each time a ther title is given)
1886 // from a given set of TrackSegments (with a given name)
1887 // This is why any is NOT used to read the branch of RecParticles
1888 // any migh have become obsolete : to be checked
1889 // See AliEMCALPIDv1
1891 //first - clean if necessary
1892 if(ECALRecPoints(fRecPointsTitle)){
1893 ECALRecPoints(fRecPointsTitle)->Delete() ;
1894 PRERecPoints(fRecPointsTitle)->Delete() ;
1895 HCALRecPoints(fRecPointsTitle)->Delete() ;
1897 //clear TrackSegments
1898 if(TrackSegments(fTrackSegmentsTitle))
1899 TrackSegments(fTrackSegmentsTitle)->Clear() ;
1904 TFile * file = static_cast<TFile*>(gROOT->GetFile(fRecPointsFileName));
1906 file = TFile::Open(fRecPointsFileName) ;
1907 // Get Digits Tree header from file
1909 TString treeName("TreeR") ;
1911 treeR = dynamic_cast<TTree*>(file->Get(treeName.Data()));
1913 if(!treeR){ // TreeR not found in header file
1915 Warning("ReadTreeR", "-> Cannot find TreeR in %s", fRecPointsFileName.Data());
1920 treeR = gAlice->TreeR() ;
1924 TObjArray * lob = static_cast<TObjArray*>(treeR->GetListOfBranches()) ;
1926 TBranch * branch = 0 ;
1927 TBranch * branchPRE = 0 ;
1928 TBranch * branchEC = 0 ;
1929 TBranch * branchHC = 0 ;
1930 TBranch * clusterizerbranch = 0 ;
1932 Bool_t emcalPRERPfound = kFALSE, emcalECRPfound = kFALSE, emcalHCRPfound = kFALSE, clusterizerfound = kFALSE ;
1934 while ( (branch = static_cast<TBranch*>(next())) && (!emcalPRERPfound || !emcalECRPfound || !emcalHCRPfound || !clusterizerfound) ) {
1935 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0 ) {
1936 if ( strcmp(branch->GetName(), "EMCALPRERP")==0) {
1937 branchPRE = branch ;
1938 emcalPRERPfound = kTRUE ;
1940 else if ( strcmp(branch->GetName(), "EMCALECRP")==0) {
1942 emcalECRPfound = kTRUE ;
1944 else if ( strcmp(branch->GetName(), "EMCALHCRP")==0) {
1946 emcalHCRPfound = kTRUE ;
1948 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1949 clusterizerbranch = branch ;
1950 clusterizerfound = kTRUE ;
1955 if ( !emcalPRERPfound || !emcalECRPfound || !emcalHCRPfound || !clusterizerfound) {
1957 Warning("ReadTreeR", "-> Cannot find RecPoints and/or Clusterizer with name %s", fRecPointsTitle.Data());
1960 if(!ECALRecPoints(fRecPointsTitle) )
1961 PostRecPoints(fRecPointsTitle) ;
1962 branchEC->SetAddress(ECRecPointsRef(fRecPointsTitle)) ;
1963 branchEC->GetEntry(0) ;
1965 branchPRE->SetAddress(PRERecPointsRef(fRecPointsTitle)) ;
1966 branchPRE->GetEntry(0) ;
1968 branchHC->SetAddress(HCRecPointsRef(fRecPointsTitle)) ;
1969 branchHC->GetEntry(0) ;
1971 if(!Clusterizer(fRecPointsTitle) )
1972 PostClusterizer(fRecPointsTitle) ;
1974 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1975 clusterizerbranch->GetEntry(0) ;
1978 //------------------- TrackSegments ---------------------
1980 TBranch * tsbranch = 0 ;
1981 TBranch * tsmakerbranch = 0 ;
1982 Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1983 while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) ) {
1984 if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0 ) {
1985 if ( strcmp(branch->GetName(), "EMCALTS")==0){
1987 emcaltsfound = kTRUE ;
1989 else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1990 tsmakerbranch = branch ;
1991 tsmakerfound = kTRUE ;
1996 if ( !emcaltsfound || !tsmakerfound ) {
1998 Warning("ReadTreeR", "-> Cannot find TrackSegments and/or TrackSegmentMaker with name %s", fTrackSegmentsTitle.Data() ) ;
2000 // Read and Post the TrackSegments
2001 if(!TrackSegments(fTrackSegmentsTitle))
2002 PostTrackSegments(fTrackSegmentsTitle) ;
2003 tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
2004 tsbranch->GetEntry(0) ;
2006 // Read and Post the TrackSegment Maker
2007 if(!TrackSegmentMaker(fTrackSegmentsTitle))
2008 PostTrackSegmentMaker(fTrackSegmentsTitle) ;
2009 tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
2010 tsmakerbranch->GetEntry(0) ;
2012 //------------ RecParticles ----------------------------
2014 TBranch * rpabranch = 0 ;
2015 TBranch * pidbranch = 0 ;
2016 Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
2018 while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
2019 if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
2020 if ( strcmp(branch->GetName(), "EMCALRP")==0) {
2021 rpabranch = branch ;
2022 emcalrpafound = kTRUE ;
2024 else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
2025 pidbranch = branch ;
2030 if ( !emcalrpafound || !pidfound ) {
2032 Warning("ReadTreeR", "-> Cannot find RecParticles and/or PID with name %s", fRecParticlesTitle.Data() ) ;
2034 // Read and Post the RecParticles
2035 if(!RecParticles(fRecParticlesTitle))
2036 PostRecParticles(fRecParticlesTitle) ;
2037 rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
2038 rpabranch->GetEntry(0) ;
2039 // Read and Post the PID
2040 if(!PID(fRecParticlesTitle))
2041 PostPID(fRecParticlesTitle) ;
2042 pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
2043 pidbranch->GetEntry(0) ;
2046 if(gAlice->TreeR()!=treeR)
2051 //____________________________________________________________________________
2053 Int_t AliEMCALGetter::ReadTreeS(const Int_t event)
2055 // Reads the SDigits treeS from all files
2056 // Files, which should be opened are listed in emcalF
2057 // So, first get list of files
2059 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
2062 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
2064 TCollection * folderslist = emcalF->GetListOfFolders() ;
2066 // Now iterate over the list of files and read TreeS into Whiteboard
2068 TIter next(folderslist) ;
2069 TFolder * folder = 0 ;
2073 while ( (folder = static_cast<TFolder*>(next())) ) {
2074 TString fileName("") ;
2076 fileName = folder->GetTitle() ;
2078 fileName = folder->GetName() ;
2080 fileName.ReplaceAll("_","/") ;
2081 file = static_cast<TFile*>(gROOT->GetFile(fileName));
2084 file = TFile::Open(fileName) ;
2086 // Get SDigits Tree header from file
2088 TString treeName("TreeS") ;
2090 treeS = dynamic_cast<TTree*>(file->Get(treeName.Data()));
2092 if(!treeS){ // TreeS not found in header file
2094 Warning("ReadTreeS", "-> Cannot find TreeS in %s", fileName.Data());
2098 //set address of the SDigits and SDigitizer
2100 TBranch * sdigitsBranch = 0;
2101 TBranch * sdigitizerBranch = 0;
2102 TBranch * branch = 0 ;
2103 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
2106 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
2108 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
2109 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
2110 emcalfound = kTRUE ;
2111 sdigitsBranch = branch ;
2113 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) &&
2114 (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
2115 sdigitizerfound = kTRUE ;
2116 sdigitizerBranch = branch ;
2119 if ( !emcalfound || !sdigitizerfound ) {
2121 Warning("ReadSDigits", "-> Digits and/or Digitizer branch with name %s not found", GetName());
2125 if ( !folder->FindObject(fSDigitsTitle) )
2126 PostSDigits(fSDigitsTitle,folder->GetName()) ;
2128 ((TClonesArray*) (*SDigitsRef(fSDigitsTitle,folder->GetName())))->Clear() ;
2130 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
2131 sdigitsBranch->GetEntry(0) ;
2133 TString sdname(fSDigitsTitle) ;
2135 sdname+=folder->GetName() ;
2137 if(!SDigitizer(sdname) )
2138 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
2140 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
2141 sdigitizerBranch->GetEntry(0) ;
2143 if(gAlice->TreeS()!=treeS)
2149 //____________________________________________________________________________
2151 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
2153 // Read the summable digits fron treeS()
2155 TString filename("mergefile") ;
2158 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2159 if ( !emcalFolder ) {
2160 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
2163 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
2165 //set address of the SDigits and SDigitizer
2167 TBranch * sdigitsBranch = 0;
2168 TBranch * sdigitizerBranch = 0;
2169 TBranch * branch = 0 ;
2170 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
2173 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
2175 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
2176 if ( strcmp(branch->GetName(), "EMCAL")==0) {
2177 emcalfound = kTRUE ;
2178 sdigitsBranch = branch ;
2180 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
2181 sdigitizerfound = kTRUE ;
2182 sdigitizerBranch = branch ;
2186 if ( !emcalfound || !sdigitizerfound ) {
2188 Warning("ReadTreeS", "-> Digits and/or Digitizer branch not found");
2192 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
2193 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
2195 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
2196 sdigitsBranch->GetEntry(0) ;
2198 TString sdname(sdigitsBranch->GetTitle()) ;
2202 if(!SDigitizer(sdigitsBranch->GetTitle()) )
2203 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
2205 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
2206 sdigitizerBranch->GetEntry(0) ;
2208 if(gAlice->TreeS()!=treeS)
2212 //____________________________________________________________________________
2214 void AliEMCALGetter::ReadPrimaries()
2217 // Reads specific branches of primaries
2219 TClonesArray * ar = 0 ;
2221 if(! (ar = Primaries()) ) {
2228 if (TreeK(fHeaderFile)) { // treeK found in header file
2230 Info("ReadPrimaries", "-> TreeK found in %s", fHeaderFile.Data());
2231 fNPrimaries = gAlice->GetNtrack() ;
2234 else { // treeK not found in header file
2235 Error("ReadPrimaries", "-> TreeK not found ");
2241 for (index = 0 ; index < fNPrimaries; index++) {
2242 new ((*ar)[index]) TParticle(*(Primary(index)));
2246 //____________________________________________________________________________
2248 void AliEMCALGetter::Event(const Int_t event, const char* opt)
2250 // Reads the content of all Tree's S, D and R
2252 if (event >= gAlice->TreeE()->GetEntries() ) {
2253 Error("Event", "-> %d not found in TreeE!", event);
2257 Bool_t any = kFALSE ;
2259 if (strstr(opt,"A") ) // do not check the title of the branches
2262 gAlice->GetEvent(event) ;
2264 if( strstr(opt,"R") )
2267 if( strstr(opt,"D") )
2270 if(strstr(opt,"S") )
2273 if(strstr(opt,"H") )
2276 if( strstr(opt,"Q") )
2279 if( strstr(opt,"P") )
2283 //____________________________________________________________________________
2285 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
2287 // get the object named "what" from the folder
2288 // folders are named like //Folders
2290 if ( file.IsNull() )
2291 file = fHeaderFile ;
2293 TFolder * folder = 0 ;
2294 TObject * emcalO = 0 ;
2296 if ( what.CompareTo("Primaries") == 0 ) {
2297 folder = dynamic_cast<TFolder *>(fPrimariesFolder->FindObject("Primaries")) ;
2299 emcalO = dynamic_cast<TObject *>(folder->FindObject("Primaries")) ;
2303 else if ( what.CompareTo("Hits") == 0 ) {
2304 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
2306 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
2308 else if ( what.CompareTo("SDigits") == 0 ) {
2309 file.ReplaceAll("/","_") ;
2310 TString path = "EMCAL/" + file ;
2311 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
2314 name = fSDigitsTitle ;
2315 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2318 else if ( what.CompareTo("Digits") == 0 ){
2319 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
2322 name = fDigitsTitle ;
2323 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2326 else if ( what.CompareTo("PRERecPoints") == 0 ) {
2327 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PRERecPoints")) ;
2330 name = fRecPointsTitle ;
2331 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2334 else if ( what.CompareTo("ECALRecPoints") == 0 ) {
2335 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/ECRecPoints")) ;
2338 name = fRecPointsTitle ;
2339 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2342 else if ( what.CompareTo("HCALRecPoints") == 0 ) {
2343 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/HCRecPoints")) ;
2346 name = fRecPointsTitle ;
2347 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2350 else if ( what.CompareTo("TrackSegments") == 0 ) {
2351 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
2354 name = fTrackSegmentsTitle ;
2355 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2358 else if ( what.CompareTo("RecParticles") == 0 ) {
2359 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
2362 name = fRecParticlesTitle ;
2363 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2368 Warning("ReturnO", "-> Object %s not found in %s", what.Data(), folder->GetName());
2375 //____________________________________________________________________________
2377 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
2379 // get the TTask named "what" from the folder
2380 // folders are named like //Folders/Tasks/what/EMCAL/name
2382 TString search(what) ;
2383 if ( what.CompareTo("Clusterizer") == 0 )
2384 search = "Reconstructioner" ;
2385 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
2386 search = "Reconstructioner" ;
2387 else if ( what.CompareTo("PID") == 0 )
2388 search = "Reconstructioner" ;
2389 else if ( what.CompareTo("QATasks") == 0 )
2392 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
2395 Error("AliReturnT", "-> Task %s not found!", what.Data());
2399 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
2402 Error("ReturnT", "-> Task %s/EMCAL not found!", what.Data());
2406 TList * list = emcalT->GetListOfTasks() ;
2408 if (what.CompareTo("SDigitizer") == 0) {
2409 if ( name.IsNull() )
2410 name = fSDigitsTitle ;
2412 else if (what.CompareTo("Digitizer") == 0){
2413 if ( name.IsNull() )
2414 name = fDigitsTitle ;
2416 else if (what.CompareTo("Clusterizer") == 0){
2417 if ( name.IsNull() )
2418 name = fRecPointsTitle ;
2419 name.Append(":clu") ;
2421 else if (what.CompareTo("TrackSegmentMaker") == 0){
2422 if ( name.IsNull() )
2423 name = fTrackSegmentsTitle ;
2424 name.Append(":tsm") ;
2426 else if (what.CompareTo("PID") == 0){
2427 if ( name.IsNull() )
2428 name = fRecParticlesTitle ;
2429 name.Append(":pid") ;
2434 while((task = static_cast<TTask *>(it.Next()) )){
2435 TString taskname(task->GetName()) ;
2436 if(taskname.BeginsWith(name)){
2441 Warning("ReturnT", "-> Task %s/%s not found!", search.Data(), name.Data());
2445 //____________________________________________________________________________
2447 void AliEMCALGetter::RemoveTask(TString opt, TString name) const
2450 // remove a task from the folder
2451 // path is fTasksFolder/SDigitizer/EMCAL/name
2455 TList * lofTasks = 0 ;
2457 if (opt == "S") { // SDigitizer
2458 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
2462 else if (opt == "D") { // Digitizer
2463 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
2467 else if (opt == "C" || opt == "T" ) { // Clusterizer, TrackSegmentMaker
2468 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
2473 Warning("RemoveTask", "-> Unknown option %s");
2477 emcal = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
2482 lofTasks = emcal->GetListOfTasks() ;
2487 TObject * obj = lofTasks->FindObject(name) ;
2490 lofTasks->Remove(obj) ;
2493 //____________________________________________________________________________
2495 void AliEMCALGetter::RemoveObjects(TString opt, TString name) const
2497 // remove SDigits from the folder
2498 // path is fSDigitsFolder/fHeaderFileName/name
2500 TFolder * emcal = 0 ;
2501 TFolder * emcalmain = 0 ;
2503 if (opt == "H") { // Hits
2504 emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
2509 else if ( opt == "S") { // SDigits
2510 emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2513 emcal = dynamic_cast<TFolder*>(emcalmain->FindObject(fHeaderFile)) ;
2517 else if (opt == "D") { // Digits
2518 emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
2522 else if (opt == "RT") { // Tower RecPoints
2523 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
2527 else if (opt == "RP") { // Preshower RecPoints
2528 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
2532 else if (opt == "T") { // TrackSegments
2533 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
2537 else if (opt == "P") { // RecParticles
2538 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
2543 Warning("RemoveObjects", "-> Unknown option %s", opt.Data());
2547 TObjArray * ar = dynamic_cast<TObjArray*>(emcal->FindObject(name)) ;
2556 emcalmain->Remove(emcal) ;
2559 //____________________________________________________________________________
2561 void AliEMCALGetter::RemoveSDigits() const
2563 TFolder * emcal= dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2572 //____________________________________________________________________________
2574 void AliEMCALGetter::CleanWhiteBoard(void){
2576 TFolder * emcalmain = 0 ;
2579 TList * lofTasks = 0 ;
2581 TTask * emcalt = 0 ;
2585 emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
2588 TObjArray * ar = dynamic_cast<TObjArray*>(emcal->FindObject("Hits")) ;
2598 emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2601 emcal = dynamic_cast<TFolder*>(emcalmain->FindObject(fHeaderFile)) ;
2603 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fSDigitsTitle)) ;
2610 emcalmain->Remove(emcal) ;
2615 emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
2618 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fDigitsTitle)) ;
2628 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
2631 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecPointsTitle)) ;
2639 // PreShowerRecPoints
2641 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
2644 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecPointsTitle)) ;
2654 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
2657 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fTrackSegmentsTitle)) ;
2667 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
2670 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecParticlesTitle)) ;
2678 //---- Now Tasks -----------
2681 TString sdname(fSDigitsTitle);
2685 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
2688 emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
2690 lofTasks = emcalt->GetListOfTasks() ;
2692 obj = lofTasks->FindObject(sdname.Data()) ;
2694 lofTasks->Remove(obj) ;
2699 sdname.Append(":") ;
2701 // Clusterizer, TrackSegmentMaker, PID
2703 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
2706 emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
2708 lofTasks = emcalt->GetListOfTasks() ;
2709 TIter next(lofTasks);
2710 while((obj=next())){
2711 TString oname(obj->GetName()) ;
2712 if (oname.BeginsWith(sdname)){
2713 lofTasks->Remove(obj) ;
2721 sdname.Append(fHeaderFile) ;
2722 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
2725 emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
2727 lofTasks = emcalt->GetListOfTasks() ;
2729 obj = lofTasks->FindObject(sdname.Data()) ;
2731 lofTasks->Remove(obj) ;
2737 //____________________________________________________________________________
2739 void AliEMCALGetter::SetTitle(const char * branchTitle )
2742 fBranchTitle = branchTitle ;
2743 fSDigitsTitle = branchTitle ;
2744 fDigitsTitle = branchTitle ;
2745 fRecPointsTitle = branchTitle ;
2746 fRecParticlesTitle = branchTitle ;
2747 fTrackSegmentsTitle = branchTitle ;
2751 //First - extract full path if necessary
2753 TString sFileName(fHeaderFile) ;
2754 Ssiz_t islash = sFileName.Last('/') ;
2756 if(islash<sFileName.Length())
2757 sFileName.Remove(islash+1,sFileName.Length()) ;
2761 //Now construct file names
2763 fSDigitsFileName = sFileName ;
2764 fDigitsFileName = sFileName ;
2765 fRecPointsFileName = sFileName ;
2766 fRecParticlesFileName = sFileName ;
2767 fTrackSegmentsFileName = sFileName ;
2768 fSDigitsFileName += "EMCAL.SDigits." ;
2769 fDigitsFileName += "EMCAL.Digits." ;
2770 fRecPointsFileName += "EMCAL.RecData." ;
2771 fTrackSegmentsFileName+= "EMCAL.RecData." ;
2772 fRecParticlesFileName += "EMCAL.RecData." ;
2774 if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){
2775 fSDigitsFileName += fBranchTitle ;
2776 fSDigitsFileName += "." ;
2777 fDigitsFileName += fBranchTitle ;
2778 fDigitsFileName += "." ;
2779 fRecPointsFileName += fBranchTitle ;
2780 fRecPointsFileName += "." ;
2781 fRecParticlesFileName += fBranchTitle ;
2782 fRecParticlesFileName += "." ;
2783 fTrackSegmentsFileName+= fBranchTitle ;
2784 fTrackSegmentsFileName+= "." ;
2787 fSDigitsFileName += "root" ;
2788 fDigitsFileName += "root" ;
2789 fRecPointsFileName += "root" ;
2790 fRecParticlesFileName += "root" ;
2791 fTrackSegmentsFileName+= "root" ;
2794 fSDigitsFileName = "" ;
2795 fDigitsFileName = "" ;
2796 fRecPointsFileName = "" ;
2797 fRecParticlesFileName = "" ;
2798 fTrackSegmentsFileName = "" ;
2801 TFolder * emcalFolder ;
2802 emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
2805 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
2807 emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2810 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
2812 //Make folder for SDigits
2814 TString subdir(fHeaderFile) ;
2815 subdir.ReplaceAll("/","_") ;
2817 emcalFolder->AddFolder(subdir, fSDigitsFileName.Data());
2818 emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
2821 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
2823 emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
2826 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
2829 //____________________________________________________________________________
2831 void AliEMCALGetter::CloseSplitFiles(void){
2834 file = static_cast<TFile*>(gROOT->GetFile(fSDigitsFileName.Data() ) ) ;
2839 file = static_cast<TFile*>(gROOT->GetFile(fDigitsFileName.Data() ) ) ;
2844 file = static_cast<TFile*>(gROOT->GetFile(fRecPointsFileName.Data() ) ) ;
2849 file = static_cast<TFile*>(gROOT->GetFile(fTrackSegmentsFileName.Data() ) ) ;
2854 file = static_cast<TFile*>(gROOT->GetFile(fRecParticlesFileName.Data() ) ) ;