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 08.2002 Dmitri Peressounko:
28 //_________________________________________________________________________
29 // A singleton. This class should be used in the analysis stage to get
30 // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
31 // instead of directly reading them from galice.root file. This container
32 // ensures, that one reads Digits, made of these particular digits, RecPoints,
33 // made of these particular RecPoints, TrackSegments and RecParticles.
34 // This becomes non trivial if there are several identical branches, produced with
35 // different set of parameters.
37 // An example of how to use (see also class AliEMCALAnalyser):
38 // AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ;
39 // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
40 // AliEMCALRecParticle * part = gime->RecParticle(1) ;
42 // please->GetEvent(event) ; // reads new event from galice.root
44 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
45 //*-- Completely redesigned by Dmitri Peressounko March 2001
47 //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
48 //*-- systematic usage of TFolders without changing the interface
49 //*-- YS August 2002 : clone PHOS as closely as possible and intoduction
50 // of new IO (à la PHOS)
51 //////////////////////////////////////////////////////////////////////////////
53 // --- ROOT system ---
57 #include "TObjString.h"
59 #include "TParticle.h"
61 // --- Standard library ---
64 // --- AliRoot header files ---
66 #include "AliConfig.h"
67 #include "AliEMCALGetter.h"
69 #include "AliEMCALDigitizer.h"
70 #include "AliEMCALSDigitizer.h"
71 #include "AliEMCALClusterizerv1.h"
72 //#include "AliEMCALTrackSegmentMakerv1.h"
73 //#include "AliEMCALTrackSegment.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 Bool_t toSplit)
85 // This is the ctor called by GetInstance and the only one that can be used
87 if ( fHeaderFile.Contains("_") ) {
88 cerr << "AliEMCALGetter::AliEMCALGetter -> Invalid file name (_ not allowed) " << fHeaderFile.Data() << endl ;
99 fHeaderFile = headerFile ;
101 fPrimaries = new TObjArray(1) ;
103 fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules"));
104 fPrimariesFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data"));
105 fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits"));
106 fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits"));
107 fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data"));
108 fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData"));
109 //fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA"));
110 fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ;
112 //Set titles to branches and create PHOS specific folders
113 SetTitle(branchTitle) ;
115 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
117 fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
119 if(!fFile){ //if file was not opened yet, read gAlice
120 fFile = TFile::Open(fHeaderFile.Data(), "update") ;
121 if (!fFile->IsOpen()) {
122 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
126 gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ;
131 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
137 cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ;
138 if (gAlice->GetDetector("EMCAL")) {
139 AliConfig * conf = AliConfig::Instance() ;
140 conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
141 conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
144 cerr << "ERROR: AliEMCALGetter -> detector EMCAL not found" << endl ;
150 //____________________________________________________________________________
151 AliEMCALGetter::~AliEMCALGetter()
154 fPrimaries->Delete() ;
158 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
159 TCollection * folderslist = emcalF->GetListOfFolders() ;
160 TIter next(folderslist) ;
161 TFolder * folder = 0 ;
162 while ( (folder = static_cast<TFolder*>(next())) )
163 emcalF->Remove(folder) ;
174 //____________________________________________________________________________
175 void AliEMCALGetter::CloseFile()
183 //____________________________________________________________________________
184 const TFolder * AliEMCALGetter::Folder(const TString what) const {
186 // returns the EMCAL folder required by what
187 // what = hits, sdigits, digits
189 if ( what == "hits" )
190 return dynamic_cast<const TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
191 else if ( what == "sdigits" )
192 return dynamic_cast<const TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
193 else if ( what == "digits" )
194 return dynamic_cast<const TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
196 cerr << "ERROR: AliEMCALGetter::GetFolder -> " << what.Data() << " illegal option (hits, sdigits, digits) " << endl ;
201 //____________________________________________________________________________
202 AliEMCALGetter * AliEMCALGetter::GetInstance()
204 // Returns the pointer of the unique instance already defined
210 // cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
215 //____________________________________________________________________________
216 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
217 const char* branchTitle,
218 const Bool_t toSplit)
220 // Creates and returns the pointer of the unique instance
221 // Must be called only when the environment has changed
224 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ;
225 if(fgObjGetter->fFailed)
231 //First checks, if header file already opened
232 if(!fgObjGetter->fFile){
233 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ;
234 if(fgObjGetter->fFailed)
240 if(fgObjGetter->fHeaderFile.CompareTo(headerFile)==0){ //Opened the same header file
241 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0)&& //Open the same branch title
242 (toSplit==fgObjGetter->fToSplit)){ //Nothing should be cleaned
245 else{ //Clean all data and AliEMCAL...zers
246 if(fgObjGetter->fToSplit)
247 fgObjGetter->CloseSplitFiles() ;
248 fgObjGetter->CleanWhiteBoard() ;
249 fgObjGetter->fToSplit = toSplit ;
250 fgObjGetter->SetTitle(branchTitle) ;
254 else{ //Close already opened files, clean memory and open new header file
258 if(fgObjGetter->fFile){
259 fgObjGetter->fFile->Close() ;
260 fgObjGetter->fFile=0;
262 if(fgObjGetter->fToSplit)
263 fgObjGetter->CloseSplitFiles() ;
264 fgObjGetter->CleanWhiteBoard() ;
265 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ;
272 //____________________________________________________________________________
273 const Bool_t AliEMCALGetter::BranchExists(const TString recName) const
275 //Looks in the tree Tree"name" if branch with current name olready exists
277 TString filename("") ;
278 TString name, dataname, zername;
279 if(recName == "SDigits"){
280 filename=fSDigitsFileName ;
283 zername = "AliPHOSSDigitizer" ;
286 if(recName == "Digits"){
287 filename=fDigitsFileName ;
290 zername = "AliPHOSDigitizer" ;
293 if(recName =="RecPoints"){
294 filename=fRecPointsFileName ;
296 dataname = "PHOSEmcRP" ;
297 zername = "AliPHOSClusterizer" ;
300 if(recName == "TrackSegments"){
301 filename=fTrackSegmentsFileName ;
303 dataname = "PHOSTS" ;
304 zername = "AliPHOSTrackSegmentMaker" ;
307 if(recName == "RecParticles"){
308 filename= fRecParticlesFileName ;
310 dataname = "PHOSRP" ;
311 zername = "AliPHOSPID" ;
319 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
321 file = TFile::Open(fSDigitsFileName.Data(),"update");
326 tree = (TTree *)file->Get(name.Data()) ;
331 TObjArray * lob = static_cast<TObjArray*>(tree->GetListOfBranches()) ;
333 TBranch * branch = 0 ;
334 TString titleName(fBranchTitle);
336 while ((branch = (static_cast<TBranch*>(next())))) {
337 TString branchName(branch->GetName() ) ;
338 TString branchTitle(branch->GetTitle() ) ;
339 if ( branchName.BeginsWith(dataname) && branchTitle.BeginsWith(fBranchTitle) ){
340 cerr << "WARNING: AliEMCALGetter::BranchExists -> branch " << dataname.Data() << " with title " << fBranchTitle << " already exits in "
341 << name.Data() << endl;
344 if ( branchName.BeginsWith(zername) && branchTitle.BeginsWith(titleName) ){
345 cerr << "WARNING: AliEMCALGetter::BranchExists -> branch AliEMCAL... with title " << branch->GetTitle() << " already exits in "
346 << name.Data() << endl;
350 //We can't delete three if gAlice points to it... To be redisigned somehow???!!!
352 if(name.Contains("TreeS"))
353 if(tree!=gAlice->TreeS())
355 if(name.Contains("TreeD"))
356 if(tree!=gAlice->TreeD())
358 if(name.Contains("TreeR"))
359 if(tree!=gAlice->TreeR())
366 //____________________________________________________________________________
367 void AliEMCALGetter::ListBranches(Int_t event) const
370 TBranch * branch = 0 ;
371 if (gAlice->GetEvent(event) == -1)
374 TTree * t = gAlice->TreeH() ;
376 cout << "INFO: AliEMCALGetter::ListBranches -> ****** Hits : " << endl ;
377 TObjArray * lob = t->GetListOfBranches() ;
379 while ( (branch = static_cast<TBranch*>(next())) )
380 cout << " " << branch->GetName() << endl ;
382 cerr << "WARNING::AliEMCALGetter::ListBranches -> TreeH not found for event " << event << endl ;
385 t = gAlice->TreeS() ;
387 cout << "INFO: AliEMCALGetter::ListBranches -> ****** SDigits : " << endl ;
388 TObjArray * lob = t->GetListOfBranches() ;
390 while ( (branch = static_cast<TBranch*>(next())) )
391 cout << " " << branch->GetName() << " " << branch->GetTitle() << endl ;
393 cerr << "WARNING::AliEMCALGetter::ListBranches -> TreeS not found for event " << event << endl ;
395 t = gAlice->TreeD() ;
397 cout << "INFO: AliEMCALGetter::ListBranches -> ****** Digits : " << endl ;
398 TObjArray * lob = t->GetListOfBranches() ;
400 while ( (branch = static_cast<TBranch*>(next())) )
401 cout << " " << branch->GetName() << " " << branch->GetTitle() << endl ;
403 cerr << "WARNING::AliEMCALGetter::ListBranches -> TreeD not found for event " << event << endl ;
406 t = gAlice->TreeR() ;
408 cout << "INFO: AliEMCALGetter::ListBranches -> ****** Recon : " << endl ;
409 TObjArray * lob = t->GetListOfBranches() ;
411 while ( (branch = static_cast<TBranch*>(next())) )
412 cout << " " << branch->GetName() << " " << branch->GetTitle() << endl ;
414 cerr << "WARNING::AliEMCALGetter::ListBranches -> TreeR not found for event " << event << endl ;
418 //____________________________________________________________________________
419 void AliEMCALGetter::NewBranch(TString name, Int_t event)
421 fBranchTitle = fSDigitsTitle = fDigitsTitle = fRecPointsTitle = fTrackSegmentsTitle = fRecParticlesTitle = name ;
425 //____________________________________________________________________________
426 Bool_t AliEMCALGetter::NewFile(TString name)
432 fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
433 if(!fFile) { //if file was not opened yet, read gAlice
434 fFile = TFile::Open(fHeaderFile.Data(),"update") ;
435 if (!fFile->IsOpen()) {
436 cerr << "ERROR : AliEMCALGetter::NewFile -> Cannot open " << fHeaderFile.Data() << endl ;
440 gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ;
444 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
451 //____________________________________________________________________________
452 const AliEMCAL * AliEMCALGetter::EMCAL()
454 // returns the EMCAL object
455 AliEMCAL * emcal = dynamic_cast<AliEMCAL*>(fModuleFolder->FindObject("EMCAL")) ;
458 cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
462 //____________________________________________________________________________
463 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
465 AliEMCALGeometry * rv = 0 ;
467 rv = EMCAL()->GetGeometry() ;
471 //____________________________________________________________________________
472 const Bool_t AliEMCALGetter::PostPrimaries(void) const
473 { //------- Primaries ----------------------
475 // the hierarchy is //Folders/RunMC/Event/Data/Primaries
477 TFolder * primariesFolder = dynamic_cast<TFolder*>(fPrimariesFolder->FindObject("Primaries")) ;
478 if ( !primariesFolder ) {
480 cout << "WARNING: AliEMCALGetter::Post Primaries -> Folder //" << fPrimariesFolder->GetName() << "/Primaries/ not found!" << endl;
481 cout << "INFO: AliEMCALGetter::Post Primaries -> Adding Folder //" << fPrimariesFolder->GetName() << "/Primaries/" << endl;
483 primariesFolder = fPrimariesFolder->AddFolder("Primaries", "Primaries particles from TreeK") ;
485 TClonesArray *primaries= new TClonesArray("TParticle",1000) ;
486 primaries->SetName("Primaries") ;
487 primariesFolder->Add(primaries) ;
492 //____________________________________________________________________________
493 TObject** AliEMCALGetter::PrimariesRef(void) const
494 { //------- Primaries ----------------------
497 // the hierarchy is //Folders/RunMC/Event/Data/Primaries
498 if ( !fPrimariesFolder ) {
499 cerr << "ERROR: AliEMCALGetter::PrimariesRef -> Folder //" << fPrimariesFolder << " not found!" << endl;
503 TFolder * primariesFolder = dynamic_cast<TFolder *>(fPrimariesFolder->FindObject("Primaries")) ;
504 if ( !primariesFolder ) {
505 cerr << "ERROR: AliEMCALGetter::PrimariesRef -> Folder //" << fPrimariesFolder << "/Primaries/ not found!" << endl;
509 TObject * p = primariesFolder->FindObject("Primaries") ;
511 cerr << "ERROR: AliEMCALGetter::PrimariesRef -> " << primariesFolder->GetName() << "/Primaries not found !" << endl ;
515 return primariesFolder->GetListOfFolders()->GetObjectRef(p) ;
518 //____________________________________________________________________________
519 const Bool_t AliEMCALGetter::PostHits(void) const
520 { //------- Hits ----------------------
522 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
524 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
525 if ( !emcalFolder ) {
527 cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
528 cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
530 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
532 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
533 hits->SetName("Hits") ;
534 emcalFolder->Add(hits) ;
539 //____________________________________________________________________________
540 TObject ** AliEMCALGetter::HitsRef(void) const
541 { //------- Hits ----------------------
544 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
545 if ( !fHitsFolder ) {
546 cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
550 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
551 if ( !emcalFolder ) {
552 cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
556 TObject * h = emcalFolder->FindObject("Hits") ;
558 cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
562 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
565 //____________________________________________________________________________
566 const Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
567 { //---------- SDigits -------------------------
570 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
571 // because you can have sdigits from several hit files for mixing
573 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
574 if ( !emcalFolder ) {
576 cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
577 cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
579 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
582 TString subdir(headerFile) ;
583 subdir.ReplaceAll("/", "_") ;
584 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
585 if ( !emcalSubFolder )
586 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
589 TObject * sd = emcalSubFolder->FindObject(name);
591 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
592 sdigits->SetName(name) ;
593 emcalSubFolder->Add(sdigits) ;
598 //____________________________________________________________________________
599 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
600 { //------- SDigits ----------------------
602 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
604 if ( !fSDigitsFolder ) {
605 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
609 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
610 if ( !emcalFolder ) {
611 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
615 TFolder * emcalSubFolder = 0 ;
617 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
619 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
621 if(!emcalSubFolder) {
622 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
626 TObject * dis = emcalSubFolder->FindObject(name) ;
628 cerr << "ERROR: AliEMCALGetter::DigitesSRef -> object " << name << " not found! " << endl ;
632 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
636 //____________________________________________________________________________
637 const Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
638 { //---------- SDigitizer -------------------------
640 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
643 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
646 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
649 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
652 cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
653 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
655 emcal = new TTask("EMCAL", "") ;
658 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
661 cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
662 emcal->GetListOfTasks()->Remove(emcalsd) ;
664 emcal->Add(sdigitizer) ;
669 //____________________________________________________________________________
670 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
673 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
675 cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
679 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
681 cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
685 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
687 return emcal->GetListOfTasks()->GetObjectRef(task) ;
691 //____________________________________________________________________________
692 const Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
693 { //---------- SDigitizer -------------------------
695 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
697 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
699 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
703 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
706 cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
707 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
709 emcal = new TTask("EMCAL", "") ;
713 TString sdname(name) ;
716 sdname.ReplaceAll("/","_") ;
717 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
719 emcalsd = new AliEMCALSDigitizer() ;
720 //Note, we can not call constructor with parameters: it will call Getter and screw up everething
721 emcalsd->SetName(sdname) ;
722 emcalsd->SetTitle(file) ;
723 emcal->Add(emcalsd) ;
729 //____________________________________________________________________________
730 const Bool_t AliEMCALGetter::PostDigits(const char * name) const
731 { //---------- Digits -------------------------
733 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
735 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
737 if ( !emcalFolder ) {
739 cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
740 cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
742 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
745 TObject* dig = emcalFolder->FindObject( name ) ;
747 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
748 digits->SetName(name) ;
749 emcalFolder->Add(digits) ;
754 //____________________________________________________________________________
755 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
756 { //------- Digits ----------------------
758 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
760 if ( !fDigitsFolder ) {
761 cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
765 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
766 if ( !emcalFolder ) {
767 cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
771 TObject * d = emcalFolder->FindObject(name) ;
773 cerr << "ERROR: AliEMCALGetter::DigitsRef -> object " << name << " not found! " << endl ;
777 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
781 //____________________________________________________________________________
782 const Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
783 { //---------- Digitizer -------------------------
785 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
788 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
791 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
794 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
795 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
797 emcal = new TTask("EMCAL", "") ;
801 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
804 emcal->GetListOfTasks()->Remove(emcald) ;
806 emcal->Add(digitizer) ;
810 //____________________________________________________________________________
811 const Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
812 { //---------- Digitizer -------------------------
814 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
816 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
818 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
822 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
825 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
826 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
828 emcal = new TTask("EMCAL", "") ;
832 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
834 emcald = new AliEMCALDigitizer() ;
835 emcald->SetName(fDigitsTitle) ;
836 emcald->SetTitle(fHeaderFile) ;
842 //____________________________________________________________________________
843 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
845 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
847 cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder->GetName() << "/Digitizer not found!" << endl;
851 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
853 cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder->GetName() << "/Digitizer/EMCAL" << endl;
857 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
859 return emcal->GetListOfTasks()->GetObjectRef(task) ;
863 //____________________________________________________________________________
864 const Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
865 { // -------------- RecPoints -------------------------------------------
867 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
868 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShowerRecPoints/name
870 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
872 if ( !emcalFolder ) {
874 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
875 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
877 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
881 TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ;
882 if ( !emcalRPoTowerFolder ) {
884 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
885 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl;
887 emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ;
890 TObject * erp = emcalFolder->FindObject( name ) ;
892 TObjArray * towerrp = new TObjArray(100) ;
893 towerrp->SetName(name) ;
894 emcalRPoTowerFolder->Add(towerrp) ;
897 // Pre Shower RecPoints
898 TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShowerRecPoints")) ;
899 if ( !emcalRPoPreShoFolder ) {
901 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShowerRecPoints/ not found!" << endl;
902 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShowerRecPoints/" << endl;
904 emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShowerRecPoints", "PreSho RecPoints from EMCAL") ;
907 TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
909 TObjArray * preshorp = new TObjArray(100) ;
910 preshorp->SetName(name) ;
911 emcalRPoPreShoFolder->Add(preshorp) ;
916 //____________________________________________________________________________
917 TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const
918 { // -------------- RecPoints -------------------------------------------
920 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
922 if ( !fRecoFolder ) {
923 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
927 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
928 if ( !towerFolder ) {
929 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
934 TObject * trp = towerFolder->FindObject(name ) ;
936 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Object " << name << " not found!" << endl ;
939 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
943 //____________________________________________________________________________
944 TObject ** AliEMCALGetter::PreShowerRecPointsRef(const char * name) const
945 { // -------------- RecPoints -------------------------------------------
947 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShowerRecPoints/name
949 if ( !fRecoFolder ) {
950 cerr << "ERROR: AliEMCALGetter::PreShowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
954 TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
955 if ( !preshoFolder ) {
956 cerr << "ERROR: AliEMCALGetter::PreShowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShowerRecPoints/" << endl;
960 TObject * prp = preshoFolder->FindObject(name ) ;
962 cerr << "ERROR: AliEMCALGetter::PreShowerRecPointsRef -> Object " << name << " not found! " << endl ;
965 return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
969 //____________________________________________________________________________
970 const Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizer * clu) const
971 { // ------------------ AliEMCALClusterizer ------------------------
973 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
975 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
978 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
982 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
985 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
986 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
988 emcal = new TTask("EMCAL", "") ;
992 AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
995 cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
997 emcal->GetListOfTasks()->Remove(emcalcl) ;
1003 //____________________________________________________________________________
1004 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
1005 { // ------------------ AliEMCALClusterizer ------------------------
1007 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1010 cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1014 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1016 cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl;
1020 TList * l = emcal->GetListOfTasks() ;
1024 TString cluname(name) ;
1026 while((task = static_cast<TTask *>(it.Next()) )){
1027 TString taskname(task->GetName()) ;
1028 if(taskname.BeginsWith(cluname)){
1035 return l->GetObjectRef(clu) ;
1037 cerr << "ERROR: AliEMCALGetter::Post RerRef -> task " << task->GetName() << " not found! " << endl ;
1042 //____________________________________________________________________________
1043 const Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
1044 { // ------------------ AliEMCALClusterizer ------------------------
1046 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1048 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1051 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1055 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1058 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1059 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1061 emcal = new TTask("EMCAL", "") ;
1065 TList * l = emcal->GetListOfTasks() ;
1067 TString clun(name) ;
1070 while((task = static_cast<TTask *>(it.Next()) )){
1071 TString taskname(task->GetName()) ;
1072 if(taskname.BeginsWith(clun))
1076 AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
1078 emcalcl->SetName(clun) ;
1079 emcalcl->SetTitle(fHeaderFile) ;
1080 emcal->Add(emcalcl) ;
1085 //____________________________________________________________________________
1086 /*const Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
1087 { // ---------------TrackSegments -----------------------------------
1089 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
1091 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
1093 if ( !emcalFolder ) {
1095 cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
1096 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl;
1098 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
1101 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
1102 if ( !emcalTSFolder ) {
1104 cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
1105 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl;
1107 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
1110 TObject * tss = emcalTSFolder->FindObject( name ) ;
1112 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
1114 emcalTSFolder->Add(ts) ;
1119 //____________________________________________________________________________
1120 TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
1121 { // ---------------TrackSegments -----------------------------------
1123 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
1125 if ( !fRecoFolder ) {
1126 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
1130 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
1131 if ( !emcalFolder ) {
1132 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
1136 TObject * tss = emcalFolder->FindObject(name) ;
1138 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> object " << name << " not found! " << endl ;
1141 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
1144 //____________________________________________________________________________
1145 const Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
1146 { //------------Track Segment Maker ------------------------------
1148 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1150 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1153 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1157 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1160 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1161 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1163 emcal = new TTask("EMCAL", "") ;
1167 AliEMCALTrackSegmentMaker * emcalts =
1168 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
1171 emcal->GetListOfTasks()->Remove(emcalts) ;
1173 emcal->Add(tsmaker) ;
1177 //____________________________________________________________________________
1178 const Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
1179 { //------------Track Segment Maker ------------------------------
1181 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1183 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1186 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1190 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1193 cout <<"WARNING: AliEMCALGetter::Post Ter -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl;
1194 cout <<"INFO: AliEMCALGetter::Post Ter -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl;
1196 emcal = new TTask("EMCAL", "") ;
1200 TList * l = emcal->GetListOfTasks() ;
1205 while((task = static_cast<TTask *>(it.Next()) )){
1206 TString taskname(task->GetName()) ;
1207 if(taskname.BeginsWith(tsn))
1211 AliEMCALTrackSegmentMakerv1 * emcalts = new AliEMCALTrackSegmentMakerv1() ;
1213 emcalts->SetName(tsn) ;
1214 emcalts->SetTitle(fHeaderFile) ;
1215 emcal->Add(emcalts) ;
1223 //____________________________________________________________________________
1224 TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
1225 { //------------Track Segment Maker ------------------------------
1227 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1230 cerr << "ERROR: AliEMCALGetter::TSLakerRef TerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1234 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1236 cerr <<"WARNING: AliEMCALGetter::TSMakerRef TerRef -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl;
1240 TList * l = emcal->GetListOfTasks() ;
1244 TString tsmname(name) ;
1246 while((task = static_cast<TTask *>(it.Next()) )){
1247 TString taskname(task->GetName()) ;
1248 if(taskname.BeginsWith(tsmname)){
1255 return l->GetObjectRef(tsm) ;
1257 cerr << "ERROR: AliEMCALGetter::TSLakerRef -> task " << task->GetName() << " not found! " << endl ;
1262 //____________________________________________________________________________
1263 const Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
1264 { // -------------------- RecParticles ------------------------
1266 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
1268 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
1270 if ( !emcalFolder ) {
1272 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
1273 cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
1275 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
1278 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
1279 if ( !emcalRPaFolder ) {
1281 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
1282 cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl;
1284 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
1287 TObject * rps = emcalRPaFolder->FindObject( name ) ;
1289 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
1291 emcalRPaFolder->Add(rp) ;
1296 //____________________________________________________________________________
1297 TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
1298 { // ---------------RecParticles -----------------------------------
1300 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
1302 if ( !fRecoFolder ) {
1303 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
1307 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1308 if ( !emcalFolder ) {
1309 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
1313 TObject * tss = emcalFolder->FindObject(name) ;
1315 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> object " << name << " not found! " << endl ;
1318 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
1321 //____________________________________________________________________________
1322 const Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
1323 { // ------------AliEMCAL PID -----------------------------
1325 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1328 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1332 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1335 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl;
1336 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl;
1338 emcal = new TTask("EMCAL", "") ;
1342 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1345 cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName()
1346 << " already exists" << endl ;
1347 emcal->GetListOfTasks()->Remove(emcalpid) ;
1354 //____________________________________________________________________________
1355 const Bool_t AliEMCALGetter::PostPID(const char * name) const
1357 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1359 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1362 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1366 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1369 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl;
1370 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl;
1372 emcal = new TTask("EMCAL", "") ;
1376 TList * l = emcal->GetListOfTasks() ;
1378 TString pidname(name) ;
1381 while((task = static_cast<TTask *>(it.Next()) )){
1382 TString taskname(task->GetName()) ;
1383 if(taskname.BeginsWith(pidname))
1387 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1389 emcalpid->SetName(pidname) ;
1390 emcalpid->SetTitle(fHeaderFile) ;
1391 emcal->Add(emcalpid) ;
1396 //____________________________________________________________________________
1397 TObject ** AliEMCALGetter::PIDRef(const char * name) const
1398 { //------------PID ------------------------------
1400 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1403 cerr << "ERROR: AliEMCALGetter::PIDRef PerRef -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
1407 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1409 cerr <<"WARNING: AliEMCALGetter::PIDRef PerRef -> //" << fTasksFolder->GetName() << "/ReconstructionerEMCAL not found!" << endl;
1413 TList * l = emcal->GetListOfTasks() ;
1417 TString pidname(name) ;
1419 while((task = static_cast<TTask *>(it.Next()) )){
1420 TString taskname(task->GetName()) ;
1421 if(taskname.BeginsWith(pidname)){
1428 return l->GetObjectRef(pid) ;
1430 cerr << "ERROR: AliEMCALGetter::PIDRef -> task " << task->GetName() << " not found! " << endl ;
1436 //____________________________________________________________________________
1437 const Bool_t AliEMCALGetter::PostQA(void) const
1438 { // ------------------ QA ---------------------------------
1440 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
1442 TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ;
1443 if ( !emcalFolder ) {
1445 cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1446 cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl;
1448 emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ;
1454 //____________________________________________________________________________
1455 TObject ** AliEMCALGetter::AlarmsRef(void) const
1456 { //------- Alarms ----------------------
1459 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL
1461 cerr << "ERROR: AliEMCALGetter::AlarmsRef QRef -> Folder //" << fQAFolder << " not found!" << endl;
1465 TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1466 if ( !emcalFolder ) {
1467 cerr << "ERROR: AliEMCALGetter::AlarmsRef QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1471 return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
1475 //____________________________________________________________________________
1476 TTree * AliEMCALGetter::TreeK(TString filename)
1479 // returns TreeK from file filename
1480 // usefull in case of split file
1482 if ( filename.IsNull() )
1483 filename = fHeaderFile ;
1486 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1487 if (file && (filename != fHeaderFile) ) { // file already open
1491 file = TFile::Open(filename.Data(), "read") ;
1492 fAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
1493 TString treeName("TreeK") ;
1494 treeName += EventNumber() ;
1495 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1496 if (!tree && fDebug)
1497 cout << "WARNING: AliEMCALGetter::TreeK -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
1502 //____________________________________________________________________________
1503 TTree * AliEMCALGetter::TreeH(TString filename)
1506 // returns TreeH from file filename
1507 // usefull in case of split file
1509 if ( filename.IsNull() )
1510 filename = fHeaderFile ;
1513 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1514 if (!file) { // file not open yet
1515 file = TFile::Open(filename.Data(), "read") ;
1517 TString treeName("TreeH") ;
1518 treeName += EventNumber() ;
1519 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1520 if (!tree && fDebug)
1521 cout << "WARNING: AliEMCALGetter::TreeH -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
1526 //____________________________________________________________________________
1527 TTree * AliEMCALGetter::TreeS(TString filename)
1530 // returns TreeS from file filename
1531 // usefull in case of split file
1533 if ( filename.IsNull() )
1534 filename = fHeaderFile ;
1537 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1538 if (!file) { // file not open yet
1539 file = TFile::Open(filename.Data(), "read") ;
1541 TString treeName("TreeS") ;
1542 treeName += EventNumber() ;
1543 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1544 if (!tree && fDebug)
1545 cout << "WARNING: AliEMCALGetter::TreeS -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
1550 //____________________________________________________________________________
1551 TTree * AliEMCALGetter::TreeD(TString filename)
1554 // returns TreeD from file filename
1555 // usefull in case of split file
1557 if ( filename.IsNull() )
1558 filename = fHeaderFile ;
1561 file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
1562 if (!file) { // file not open yet
1563 file = TFile::Open(filename.Data(), "read") ;
1565 TString treeName("TreeD") ;
1566 treeName += EventNumber() ;
1567 TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
1568 if (!tree && fDebug)
1569 cout << "WARNING: AliEMCALGetter::TreeD -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
1574 //____________________________________________________________________________
1575 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1577 // Return primary particle numbered by <index>
1583 p = fAlice->Particle(index) ;
1585 p = gAlice->Particle(index) ;
1591 //____________________________________________________________________________
1592 const TParticle * AliEMCALGetter::Secondary(TParticle* p, Int_t index) const
1594 // Return first (index=1) or second (index=2) secondary particle of primary particle p
1602 Int_t daughterIndex = p->GetDaughter(index-1) ;
1603 return gAlice->Particle(daughterIndex) ;
1609 //____________________________________________________________________________
1610 Int_t AliEMCALGetter::ReadTreeD(const Int_t event)
1612 // Read the digit tree gAlice->TreeD()
1616 TFile * file = static_cast<TFile*>(gROOT->GetFile(fDigitsFileName));
1618 file = TFile::Open(fDigitsFileName) ;
1619 // Get Digits Tree header from file
1620 TString treeName("TreeD") ;
1622 treeD = dynamic_cast<TTree*>(file->Get(treeName.Data()));
1623 if(!treeD){ // TreeD not found in header file
1625 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find TreeD in " << fDigitsFileName.Data() << endl;
1630 treeD = gAlice->TreeD() ;
1632 TObjArray * lob = static_cast<TObjArray*>(treeD->GetListOfBranches()) ;
1634 TBranch * branch = 0 ;
1635 TBranch * digitsbranch = 0 ;
1636 TBranch * digitizerbranch = 0 ;
1637 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1639 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1640 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1641 digitsbranch = branch ;
1642 emcalfound = kTRUE ;
1644 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1645 digitizerbranch = branch ;
1646 digitizerfound = kTRUE ;
1650 if ( !emcalfound || !digitizerfound ) {
1652 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
1653 << fDigitsTitle << endl ;
1658 if(!Digits(fDigitsTitle) )
1659 PostDigits(fDigitsTitle);
1660 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1661 digitsbranch->GetEntry(0) ;
1664 // read the Digitizer
1665 RemoveTask("D", fDigitsTitle) ; // I do not understand why I need that
1666 if(!Digitizer(fDigitsTitle))
1667 PostDigitizer(fDigitsTitle) ;
1668 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1669 digitizerbranch->GetEntry(0) ;
1672 if(gAlice->TreeD()!=treeD)
1677 //____________________________________________________________________________
1678 Int_t AliEMCALGetter::ReadTreeH()
1680 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1682 TTree * treeH = gAlice->TreeH() ;
1684 if(!treeH) {// TreeH not found in header file
1687 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find TreeH in " << fHeaderFile << endl ;
1689 TString searchFileName("EMCAL.HITS") ;
1690 if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){
1691 searchFileName+="." ;
1692 searchFileName += fBranchTitle ;
1694 searchFileName+=".root" ;
1696 if ( (treeH = TreeH(searchFileName)) ) { //found TreeH in the file which contains the hits
1698 cout << "INFO: AliEMCALGetter::ReadTreeH -> TreeH found in " << searchFileName.Data() << endl ;
1701 cerr << "ERROR: AliEMCALGetter::ReadTreeH -> TreeH not found " << endl ;
1706 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1707 if ( !hitsbranch ) {
1709 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1715 if (hitsbranch->GetEntries() > 1 ) {
1716 (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
1717 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1718 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1719 hitsbranch->SetAddress(&tempo) ;
1722 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1723 hitsbranch->GetEntry(i) ;
1725 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1726 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1727 new((*hits)[index]) AliEMCALHit( *hit ) ;
1734 (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
1735 hitsbranch->SetAddress(HitsRef()) ;
1736 hitsbranch->GetEntry(0) ;
1741 //____________________________________________________________________________
1742 void AliEMCALGetter::Track(Int_t itrack)
1744 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1746 if(gAlice->TreeH()== 0){
1747 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1751 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1752 if ( !hitsbranch ) {
1754 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1760 (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
1761 hitsbranch->SetAddress(HitsRef()) ;
1762 hitsbranch->GetEntry(itrack) ;
1766 //____________________________________________________________________________
1767 void AliEMCALGetter::ReadTreeQA()
1770 cout << "WARNING : " << ClassName() << "::ReadTreeQA -> not implemented" << endl ;
1771 // Read the digit tree gAlice->TreeQA()
1772 // so far only EMCAL knows about this Tree
1774 // if(EMCAL()->TreeQA()== 0){
1775 // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ;
1779 // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ;
1782 // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ;
1789 // qabranch->SetAddress(AlarmsRef()) ;
1791 // qabranch->GetEntry(0) ;
1793 // PostQA("EMCAL") ;
1794 // TFolder * alarmsF = Alarms() ;
1795 // alarmsF->Clear() ;
1796 // qabranch->SetAddress(&alarmsF) ;
1797 // qabranch->GetEntry(0) ;
1801 //____________________________________________________________________________
1802 Int_t AliEMCALGetter::ReadTreeR(const Int_t event)
1804 // Read the reconstrunction tree gAlice->TreeR()
1805 // A particularity has been introduced here :
1806 // if gime->Event(ievent,"R") is called branches with the current title are read, the current title
1807 // being for example give in AliPHOSPID(fileName, title)
1808 // if gime(Event(ievent, "RA") is called the title of the branches is not checked anymore, "A" stands for any
1809 // This is a feature needed by PID to be able to reconstruct several times particles (each time a ther title is given)
1810 // from a given set of TrackSegments (with a given name)
1811 // This is why any is NOT used to read the branch of RecParticles
1812 // any migh have become obsolete : to be checked
1813 // See AliEMCALPIDv1
1817 TFile * file = static_cast<TFile*>(gROOT->GetFile(fRecPointsFileName));
1819 file = TFile::Open(fRecPointsFileName) ;
1820 // Get Digits Tree header from file
1821 TString treeName("TreeR") ;
1823 treeR = dynamic_cast<TTree*>(file->Get(treeName.Data()));
1824 if(!treeR){ // TreeR not found in header file
1826 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find TreeR in " << fRecPointsFileName.Data() << endl;
1831 treeR = gAlice->TreeR() ;
1834 TObjArray * lob = static_cast<TObjArray*>(treeR->GetListOfBranches()) ;
1836 TBranch * branch = 0 ;
1837 TBranch * towerbranch = 0 ;
1838 TBranch * preshowerbranch = 0 ;
1839 TBranch * clusterizerbranch = 0 ;
1840 Bool_t emcalTowerRPfound = kFALSE, emcalPreShoRPfound = kFALSE, clusterizerfound = kFALSE ;
1843 while ( (branch = static_cast<TBranch*>(next())) && (!emcalTowerRPfound || !emcalPreShoRPfound || !clusterizerfound) ) {
1844 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0 ) {
1845 if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
1846 towerbranch = branch ;
1847 emcalTowerRPfound = kTRUE ;
1849 else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
1850 preshowerbranch = branch ;
1851 emcalPreShoRPfound = kTRUE ;
1853 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1854 clusterizerbranch = branch ;
1855 clusterizerfound = kTRUE ;
1860 if ( !emcalTowerRPfound || !emcalPreShoRPfound || !clusterizerfound) {
1862 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecPoints and/or Clusterizer with name "
1863 << fRecPointsTitle << endl ;
1866 if(!TowerRecPoints(fRecPointsTitle) )
1867 PostRecPoints(fRecPointsTitle) ;
1869 towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
1870 towerbranch->GetEntry(0) ;
1872 preshowerbranch->SetAddress(PreShowerRecPointsRef(fRecPointsTitle)) ;
1873 preshowerbranch->GetEntry(0) ;
1875 if(!Clusterizer(fRecPointsTitle) )
1876 PostClusterizer(fRecPointsTitle) ;
1878 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1879 clusterizerbranch->GetEntry(0) ;
1882 // //------------------- TrackSegments ---------------------
1884 // TBranch * tsbranch = 0 ;
1885 // TBranch * tsmakerbranch = 0 ;
1886 // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1887 // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) ) {
1888 // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0 ) {
1889 // if ( strcmp(branch->GetName(), "EMCALTS")==0){
1890 // tsbranch = branch ;
1891 // emcaltsfound = kTRUE ;
1893 // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1894 // tsmakerbranch = branch ;
1895 // tsmakerfound = kTRUE ;
1900 // if ( !emcaltsfound || !tsmakerfound ) {
1902 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
1903 // << fTrackSegmentsTitle << endl ;
1905 // // Read and Post the TrackSegments
1906 // if(!TrackSegments(fTrackSegmentsTitle))
1907 // PostTrackSegments(fTrackSegmentsTitle) ;
1908 // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1909 // tsbranch->GetEntry(0) ;
1911 // // Read and Post the TrackSegment Maker
1912 // if(!TrackSegmentMaker(fTrackSegmentsTitle))
1913 // PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1914 // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
1915 // tsmakerbranch->GetEntry(0) ;
1919 // //------------ RecParticles ----------------------------
1921 // TBranch * rpabranch = 0 ;
1922 // TBranch * pidbranch = 0 ;
1923 // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
1925 // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
1926 // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1927 // if ( strcmp(branch->GetName(), "EMCALRP")==0) {
1928 // rpabranch = branch ;
1929 // emcalrpafound = kTRUE ;
1931 // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
1932 // pidbranch = branch ;
1933 // pidfound = kTRUE ;
1937 // if ( !emcalrpafound || !pidfound ) {
1939 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
1940 // << fRecParticlesTitle << endl ;
1942 // // Read and Post the RecParticles
1943 // if(!RecParticles(fRecParticlesTitle))
1944 // PostRecParticles(fRecParticlesTitle) ;
1945 // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1946 // rpabranch->GetEntry(0) ;
1947 // // Read and Post the PID
1948 // if(!PID(fRecParticlesTitle))
1949 // PostPID(fRecParticlesTitle) ;
1950 // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
1951 // pidbranch->GetEntry(0) ;
1954 if(gAlice->TreeR()!=treeR)
1959 //____________________________________________________________________________
1960 Int_t AliEMCALGetter::ReadTreeS(Int_t event)
1962 // Reads the SDigits treeS from all files
1963 // Files, which should be opened are listed in emcalF
1964 // So, first get list of files
1965 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
1967 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1968 TCollection * folderslist = emcalF->GetListOfFolders() ;
1970 // Now iterate over the list of files and read TreeS into Whiteboard
1971 TIter next(folderslist) ;
1972 TFolder * folder = 0 ;
1975 while ( (folder = static_cast<TFolder*>(next())) ) {
1976 TString fileName("") ;
1978 fileName = folder->GetTitle() ;
1980 fileName = folder->GetName() ;
1981 fileName.ReplaceAll("_","/") ;
1982 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1984 file = TFile::Open(fileName) ;
1985 // Get SDigits Tree header from file
1986 TString treeName("TreeS") ;
1988 treeS = dynamic_cast<TTree*>(file->Get(treeName.Data()));
1990 if(!treeS){ // TreeS not found in header file
1992 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Cannot find TreeS in " << fileName.Data() << endl;
1996 //set address of the SDigits and SDigitizer
1997 TBranch * sdigitsBranch = 0;
1998 TBranch * sdigitizerBranch = 0;
1999 TBranch * branch = 0 ;
2000 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
2002 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
2004 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
2005 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
2006 emcalfound = kTRUE ;
2007 sdigitsBranch = branch ;
2010 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) &&
2011 (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
2012 sdigitizerfound = kTRUE ;
2013 sdigitizerBranch = branch ;
2016 if ( !emcalfound || !sdigitizerfound ) {
2018 cout << "WARNING: AliEMCALDigitizer::ReadSDigits -> Digits and/or Digitizer branch with name " << GetName()
2019 << " not found" << endl ;
2023 if ( !folder->FindObject(fSDigitsTitle) )
2024 PostSDigits(fSDigitsTitle,folder->GetName()) ;
2026 ((TClonesArray*) (*SDigitsRef(fSDigitsTitle,folder->GetName())))->Clear() ;
2027 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
2028 sdigitsBranch->GetEntry(0) ;
2030 TString sdname(fSDigitsTitle) ;
2032 sdname+=folder->GetName() ;
2033 if(!SDigitizer(sdname) )
2034 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
2035 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
2036 sdigitizerBranch->GetEntry(0) ;
2037 if(gAlice->TreeS()!=treeS)
2043 //____________________________________________________________________________
2044 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
2045 { // Read the summable digits fron treeS()
2048 TString filename("mergefile") ;
2051 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2052 if ( !emcalFolder ) {
2053 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
2055 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
2056 //set address of the SDigits and SDigitizer
2057 TBranch * sdigitsBranch = 0;
2058 TBranch * sdigitizerBranch = 0;
2059 TBranch * branch = 0 ;
2060 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
2062 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
2064 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
2065 if ( strcmp(branch->GetName(), "EMCAL")==0) {
2066 emcalfound = kTRUE ;
2067 sdigitsBranch = branch ;
2070 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
2071 sdigitizerfound = kTRUE ;
2072 sdigitizerBranch = branch ;
2075 if ( !emcalfound || !sdigitizerfound ) {
2077 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
2081 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
2082 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
2084 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
2085 sdigitsBranch->GetEntry(0) ;
2087 TString sdname(sdigitsBranch->GetTitle()) ;
2091 if(!SDigitizer(sdigitsBranch->GetTitle()) )
2092 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
2093 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
2094 sdigitizerBranch->GetEntry(0) ;
2095 if(gAlice->TreeS()!=treeS)
2100 //____________________________________________________________________________
2101 void AliEMCALGetter::ReadPrimaries()
2103 // Reads specific branches of primaries
2105 TClonesArray * ar = 0 ;
2106 if(! (ar = Primaries()) ) {
2112 if (TreeK(fHeaderFile)) { // treeK found in header file
2114 cout << "INFO: AliEMCALGetter::ReadPrimaries -> TreeK found in " << fHeaderFile.Data() << endl ;
2115 fNPrimaries = gAlice->GetNtrack() ;
2118 } else { // treeK not found in header file
2120 cerr << "ERROR: AliEMCALGetter::ReadPrimaries -> TreeK not found " << endl ;
2125 for (index = 0 ; index < fNPrimaries; index++) {
2126 new ((*ar)[index]) TParticle(*(Primary(index)));
2130 //____________________________________________________________________________
2131 void AliEMCALGetter::Event(const Int_t event, const char* opt)
2133 // Reads the content of all Tree's S, D and R
2135 if (event >= gAlice->TreeE()->GetEntries() ) {
2136 cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
2140 Bool_t any = kFALSE ;
2141 if (strstr(opt,"A") ) // do not check the title of the branches
2144 gAlice->GetEvent(event) ;
2146 if( strstr(opt,"R") )
2149 if( strstr(opt,"D") )
2152 if(strstr(opt,"S") )
2155 if(strstr(opt,"H") )
2158 if( strstr(opt,"Q") )
2161 if( strstr(opt,"P") || (strcmp(opt,"")==0) )
2166 //____________________________________________________________________________
2167 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
2169 // get the object named "what" from the folder
2170 // folders are named like //Folders
2172 if ( file.IsNull() )
2173 file = fHeaderFile ;
2175 TFolder * folder = 0 ;
2176 TObject * emcalO = 0 ;
2178 if ( what.CompareTo("Primaries") == 0 ) {
2179 folder = dynamic_cast<TFolder *>(fPrimariesFolder->FindObject("Primaries")) ;
2181 emcalO = dynamic_cast<TObject *>(folder->FindObject("Primaries")) ;
2185 else if ( what.CompareTo("Hits") == 0 ) {
2186 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
2188 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
2190 else if ( what.CompareTo("SDigits") == 0 ) {
2191 file.ReplaceAll("/","_") ;
2192 TString path = "EMCAL/" + file ;
2193 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
2196 name = fSDigitsTitle ;
2197 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2200 else if ( what.CompareTo("Digits") == 0 ){
2201 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
2204 name = fDigitsTitle ;
2205 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2208 else if ( what.CompareTo("TowerRecPoints") == 0 ) {
2209 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
2212 name = fRecPointsTitle ;
2213 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2216 else if ( what.CompareTo("PreShowerRecPoints") == 0 ) {
2217 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
2220 name = fRecPointsTitle ;
2221 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2225 else if ( what.CompareTo("TrackSegments") == 0 ) {
2226 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
2229 name = fTrackSegmentsTitle ;
2230 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2233 else if ( what.CompareTo("RecParticles") == 0 ) {
2234 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
2237 name = fRecParticlesTitle ;
2238 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2241 else if ( what.CompareTo("Alarms") == 0 ){
2243 emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ;
2245 folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
2249 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
2255 cout << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
2262 //____________________________________________________________________________
2263 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
2265 // get the TTask named "what" from the folder
2266 // folders are named like //Folders/Tasks/what/EMCAL/name
2268 TString search(what) ;
2269 if ( what.CompareTo("Clusterizer") == 0 )
2270 search = "Reconstructioner" ;
2271 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
2272 search = "Reconstructioner" ;
2273 else if ( what.CompareTo("PID") == 0 )
2274 search = "Reconstructioner" ;
2275 else if ( what.CompareTo("QATasks") == 0 )
2278 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
2281 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
2285 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
2287 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
2291 TList * list = emcalT->GetListOfTasks() ;
2293 if (what.CompareTo("SDigitizer") == 0) {
2294 if ( name.IsNull() )
2295 name = fSDigitsTitle ;
2296 } else if (what.CompareTo("Digitizer") == 0){
2297 if ( name.IsNull() )
2298 name = fDigitsTitle ;
2299 } else if (what.CompareTo("Clusterizer") == 0){
2300 if ( name.IsNull() )
2301 name = fRecPointsTitle ;
2302 name.Append(":clu") ;
2304 // else if (what.CompareTo("TrackSegmentMaker") == 0){
2305 // if ( name.IsNull() )
2306 // name = fTrackSegmentsTitle ;
2307 // name.Append(":tsm") ;
2309 // else if (what.CompareTo("PID") == 0){
2310 // if ( name.IsNull() )
2311 // name = fRecParticlesTitle ;
2312 // name.Append(":pid") ;
2314 // else if (what.CompareTo("QATasks") == 0){
2315 // if ( name.IsNull() )
2321 while((task = static_cast<TTask *>(it.Next()) )){
2322 TString taskname(task->GetName()) ;
2323 if(taskname.BeginsWith(name)){
2328 cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;
2332 //____________________________________________________________________________
2333 void AliEMCALGetter::RemoveTask(TString opt, TString name) const
2335 // remove a task from the folder
2336 // path is fTasksFolder/SDigitizer/EMCAL/name
2340 TList * lofTasks = 0 ;
2342 if (opt == "S") { // SDigitizer
2343 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
2347 else if (opt == "D") { // Digitizer
2348 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
2352 else if (opt == "C") { // Clusterizer
2353 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
2358 cerr << "WARNING: AliEMCALGetter::RemoveTask -> Unknown option " << opt.Data() << endl ;
2361 emcal = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
2364 lofTasks = emcal->GetListOfTasks() ;
2367 TObject * obj = lofTasks->FindObject(name) ;
2369 lofTasks->Remove(obj) ;
2373 //____________________________________________________________________________
2374 void AliEMCALGetter::RemoveObjects(TString opt, TString name) const
2376 // remove SDigits from the folder
2377 // path is fSDigitsFolder/fHeaderFileName/name
2379 TFolder * emcal = 0 ;
2380 TFolder * emcalmain = 0 ;
2382 if (opt == "H") { // Hits
2383 emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
2389 else if ( opt == "S") { // SDigits
2390 emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2393 emcal = dynamic_cast<TFolder*>(emcalmain->FindObject(fHeaderFile)) ;
2398 else if (opt == "D") { // Digits
2399 emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
2404 else if (opt == "RT") { // Tower RecPoints
2405 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
2410 else if (opt == "RP") { // Preshower RecPoints
2411 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
2416 else if (opt == "T") { // TrackSegments
2417 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
2422 else if (opt == "P") { // RecParticles
2423 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
2429 cerr << "WARNING: AliEMCALGetter::RemoveObjects -> Unknown option " << opt.Data() << endl ;
2433 TObjArray * ar = dynamic_cast<TObjArray*>(emcal->FindObject(name)) ;
2441 emcalmain->Remove(emcal) ;
2445 //____________________________________________________________________________
2446 void AliEMCALGetter::RemoveSDigits() const
2448 TFolder * emcal= dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2456 //____________________________________________________________________________
2457 void AliEMCALGetter::CleanWhiteBoard(void){
2459 TFolder * emcalmain = 0 ;
2462 TList * lofTasks = 0 ;
2464 TTask * emcalt = 0 ;
2467 emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
2469 TObjArray * ar = dynamic_cast<TObjArray*>(emcal->FindObject("Hits")) ;
2478 emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2480 emcal = dynamic_cast<TFolder*>(emcalmain->FindObject(fHeaderFile)) ;
2482 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fSDigitsTitle)) ;
2489 emcalmain->Remove(emcal) ;
2494 emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
2496 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fDigitsTitle)) ;
2506 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
2508 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecPointsTitle)) ;
2517 // PreShowerRecPoints
2518 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
2520 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecPointsTitle)) ;
2530 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
2532 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fTrackSegmentsTitle)) ;
2543 emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
2545 ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecParticlesTitle)) ;
2554 //---- Now Tasks -----------
2557 TString sdname(fSDigitsTitle);
2560 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
2562 emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
2564 lofTasks = emcalt->GetListOfTasks() ;
2566 obj = lofTasks->FindObject(sdname.Data()) ;
2568 lofTasks->Remove(obj) ;
2574 sdname.Append(":") ;
2575 // Clusterizer, TrackSegmentMaker, PID
2576 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
2578 emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
2580 lofTasks = emcalt->GetListOfTasks() ;
2581 TIter next(lofTasks);
2582 while((obj=next())){
2583 TString oname(obj->GetName()) ;
2584 if (oname.BeginsWith(sdname)){
2585 lofTasks->Remove(obj) ;
2593 sdname.Append(fHeaderFile) ;
2594 task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
2596 emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
2598 lofTasks = emcalt->GetListOfTasks() ;
2600 obj = lofTasks->FindObject(sdname.Data()) ;
2602 lofTasks->Remove(obj) ;
2608 //____________________________________________________________________________
2609 void AliEMCALGetter::SetTitle(const char * branchTitle )
2611 fBranchTitle = branchTitle ;
2612 fSDigitsTitle = branchTitle ;
2613 fDigitsTitle = branchTitle ;
2614 fRecPointsTitle = branchTitle ;
2615 fRecParticlesTitle = branchTitle ;
2616 fTrackSegmentsTitle = branchTitle ;
2618 //First - extract full path if necessary
2619 TString sFileName(fHeaderFile) ;
2620 Ssiz_t islash = sFileName.Last('/') ;
2621 if(islash<sFileName.Length())
2622 sFileName.Remove(islash+1,sFileName.Length()) ;
2625 //Now construct file names
2626 fSDigitsFileName = sFileName ;
2627 fDigitsFileName = sFileName ;
2628 fRecPointsFileName = sFileName ;
2629 fRecParticlesFileName = sFileName ;
2630 fTrackSegmentsFileName = sFileName ;
2631 fSDigitsFileName += "EMCAL.SDigits." ;
2632 fDigitsFileName += "EMCAL.Digits." ;
2633 fRecPointsFileName += "EMCAL.RecData." ;
2634 fTrackSegmentsFileName+= "EMCAL.RecData." ;
2635 fRecParticlesFileName += "EMCAL.RecData." ;
2636 if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){
2637 fSDigitsFileName += fBranchTitle ;
2638 fSDigitsFileName += "." ;
2639 fDigitsFileName += fBranchTitle ;
2640 fDigitsFileName += "." ;
2641 fRecPointsFileName += fBranchTitle ;
2642 fRecPointsFileName += "." ;
2643 fRecParticlesFileName += fBranchTitle ;
2644 fRecParticlesFileName += "." ;
2645 fTrackSegmentsFileName+= fBranchTitle ;
2646 fTrackSegmentsFileName+= "." ;
2648 fSDigitsFileName += "root" ;
2649 fDigitsFileName += "root" ;
2650 fRecPointsFileName += "root" ;
2651 fRecParticlesFileName += "root" ;
2652 fTrackSegmentsFileName+= "root" ;
2654 fSDigitsFileName = "" ;
2655 fDigitsFileName = "" ;
2656 fRecPointsFileName = "" ;
2657 fRecParticlesFileName = "" ;
2658 fTrackSegmentsFileName = "" ;
2660 TFolder * emcalFolder ;
2661 emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
2663 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
2665 emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
2667 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
2669 //Make folder for SDigits
2670 TString subdir(fHeaderFile) ;
2671 subdir.ReplaceAll("/","_") ;
2672 emcalFolder->AddFolder(subdir, fSDigitsFileName.Data());
2675 emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
2677 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
2679 emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
2681 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
2685 //____________________________________________________________________________
2686 void AliEMCALGetter::CloseSplitFiles(void){
2688 file = static_cast<TFile*>(gROOT->GetFile(fSDigitsFileName.Data() ) ) ;
2691 file = static_cast<TFile*>(gROOT->GetFile(fDigitsFileName.Data() ) ) ;
2694 file = static_cast<TFile*>(gROOT->GetFile(fRecPointsFileName.Data() ) ) ;
2697 file = static_cast<TFile*>(gROOT->GetFile(fTrackSegmentsFileName.Data() ) ) ;
2700 file = static_cast<TFile*>(gROOT->GetFile(fRecParticlesFileName.Data() ) ) ;