1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 29.05.2001 Yuri Kharlov:
20 Everywhere reading the treese TTree->GetEvent(i)
21 is replaced by reading the branches TBranch->GetEntry(0)
24 //_________________________________________________________________________
25 // A singleton. This class should be used in the analysis stage to get
26 // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
27 // instead of directly reading them from galice.root file. This container
28 // ensures, that one reads Digits, made of these particular digits, RecPoints,
29 // made of these particular RecPoints, TrackSegments and RecParticles.
30 // This becomes non trivial if there are several identical branches, produced with
31 // different set of parameters.
33 // An example of how to use (see also class AliEMCALAnalyser):
34 // AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ;
35 // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
36 // AliEMCALRecParticle * part = gime->RecParticle(1) ;
38 // please->GetEvent(event) ; // reads new event from galice.root
40 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
41 //*-- Completely redesigned by Dmitri Peressounko March 2001
43 //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
44 //*-- systematic usage of TFolders without changing the interface
45 //////////////////////////////////////////////////////////////////////////////
48 // --- ROOT system ---
53 #include "TObjString.h"
56 // --- Standard library ---
59 // --- AliRoot header files ---
62 #include "AliConfig.h"
63 #include "AliEMCALGetter.h"
64 #include "AliEMCALHit.h"
65 #include "AliEMCALv1.h"
66 #include "AliEMCALDigitizer.h"
67 #include "AliEMCALSDigitizer.h"
68 #include "AliEMCALClusterizer.h"
69 #include "AliEMCALClusterizerv1.h"
70 //#include "AliEMCALTrackSegmentMaker.h"
71 //#include "AliEMCALTrackSegmentMakerv1.h"
72 //#include "AliEMCALTrackSegment.h"
73 //#include "AliEMCALPID.h"
74 //#include "AliEMCALPIDv1.h"
75 #include "AliEMCALGeometry.h"
77 ClassImp(AliEMCALGetter)
79 AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ;
81 //____________________________________________________________________________
82 AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Option_t * rw)
84 //Initialize all lists
88 fHeaderFile = headerFile ;
89 fBranchTitle = branchTitle ;
90 fSDigitsTitle = branchTitle ;
91 fDigitsTitle = branchTitle ;
92 fRecPointsTitle = branchTitle ;
93 //fRecParticlesTitle = branchTitle ;
94 //fTrackSegmentsTitle = branchTitle ;
96 fPrimaries = new TObjArray(1) ;
98 fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules"));
99 fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits"));
100 fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits"));
101 fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data"));
102 fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData"));
103 //fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA"));
104 fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ;
108 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
111 fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
112 if(!fFile){ //if file was not opened yet, read gAlice
113 fFile = TFile::Open(fHeaderFile.Data(),rw) ;
115 if (!fFile->IsOpen()) {
116 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
121 gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ;
126 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
132 cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ;
133 if (gAlice->GetDetector("EMCAL")) {
134 AliConfig * conf = AliConfig::Instance() ;
135 conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
136 conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
139 cerr << "ERROR: AliEMCALGetter -> detector EMCAL not found" << endl ;
144 //____________________________________________________________________________
145 AliEMCALGetter::~AliEMCALGetter()
148 fPrimaries->Delete() ;
152 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
153 TCollection * folderslist = emcalF->GetListOfFolders() ;
154 TIter next(folderslist) ;
155 TFolder * folder = 0 ;
156 while ( (folder = static_cast<TFolder*>(next())) )
157 emcalF->Remove(folder) ;
164 //____________________________________________________________________________
165 void AliEMCALGetter::CreateWhiteBoard() const
170 //____________________________________________________________________________
171 AliEMCALGetter * AliEMCALGetter::GetInstance()
173 // Returns the pointer of the unique instance already defined
175 AliEMCALGetter * rv = 0 ;
179 cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
184 //____________________________________________________________________________
185 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
186 const char* branchTitle, const Option_t * rw)
188 // Creates and returns the pointer of the unique instance
189 // Must be called only when the environment has changed
192 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
193 (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
196 fgObjGetter->~AliEMCALGetter() ; // delete it already exists another version
198 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
200 if (fgObjGetter->HasFailed() )
203 // Posts a few item to the white board (folders)
204 // fgObjGetter->CreateWhiteBoard() ;
210 //____________________________________________________________________________
211 const AliEMCALv1 * AliEMCALGetter::EMCAL()
213 // returns the EMCAL object
214 AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ;
217 cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
221 //____________________________________________________________________________
222 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
224 AliEMCALGeometry * rv = 0 ;
226 rv = EMCAL()->GetGeometry() ;
230 //____________________________________________________________________________
231 Bool_t AliEMCALGetter::PostHits(void) const
232 { //------- Hits ----------------------
234 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
236 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
237 if ( !emcalFolder ) {
239 cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
240 cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
242 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
244 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
245 hits->SetName("Hits") ;
246 emcalFolder->Add(hits) ;
251 //____________________________________________________________________________
252 TObject ** AliEMCALGetter::HitsRef(void) const
253 { //------- Hits ----------------------
256 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
257 if ( !fHitsFolder ) {
258 cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
262 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
263 if ( !emcalFolder ) {
264 cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
268 TObject * h = emcalFolder->FindObject("Hits") ;
270 cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
274 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
277 //____________________________________________________________________________
278 Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
279 { //---------- SDigits -------------------------
282 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
283 // because you can have sdigits from several hit files for mixing
285 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
286 if ( !emcalFolder ) {
288 cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
289 cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
291 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
293 TString subdir(headerFile) ;
294 subdir.ReplaceAll("/", "_") ;
295 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
296 if ( !emcalSubFolder )
297 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
299 TObject * sd = emcalSubFolder->FindObject(name);
302 cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
303 << " already exists!" << endl ;
305 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
306 sdigits->SetName(name) ;
307 emcalSubFolder->Add(sdigits) ;
312 //____________________________________________________________________________
313 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
314 { //------- SDigits ----------------------
316 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
318 if ( !fSDigitsFolder ) {
319 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
323 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
324 if ( !emcalFolder ) {
325 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
329 TFolder * emcalSubFolder = 0 ;
331 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
333 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
335 if(!emcalSubFolder) {
336 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
340 TObject * dis = emcalSubFolder->FindObject(name) ;
344 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
348 //____________________________________________________________________________
349 Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
350 { //---------- SDigitizer -------------------------
352 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
355 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
358 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
361 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
364 cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
365 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
367 emcal = new TTask("EMCAL", "") ;
370 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
373 cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
374 emcal->GetListOfTasks()->Remove(emcalsd) ;
376 emcal->Add(sdigitizer) ;
381 //____________________________________________________________________________
382 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
385 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
387 cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
391 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
393 cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
397 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
399 return emcal->GetListOfTasks()->GetObjectRef(task) ;
403 //____________________________________________________________________________
404 Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
405 { //---------- SDigitizer -------------------------
407 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
410 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
412 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
416 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
419 cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
420 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
422 emcal = new TTask("EMCAL", "") ;
426 TString sdname(name) ;
429 sdname.ReplaceAll("/","_") ;
430 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
432 emcalsd = new AliEMCALSDigitizer() ;
433 //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
434 emcalsd->SetName(sdname) ;
435 emcalsd->SetTitle(file) ;
436 emcal->Add(emcalsd) ;
442 //____________________________________________________________________________
443 Bool_t AliEMCALGetter::PostDigits(const char * name) const
444 { //---------- Digits -------------------------
446 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
448 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
450 if ( !emcalFolder ) {
452 cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
453 cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
455 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
458 TObject* dig = emcalFolder->FindObject( name ) ;
460 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
461 digits->SetName(name) ;
462 emcalFolder->Add(digits) ;
467 //____________________________________________________________________________
468 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
469 { //------- Digits ----------------------
471 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
473 if ( !fDigitsFolder ) {
474 cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
478 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
479 if ( !emcalFolder ) {
480 cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
484 TObject * d = emcalFolder->FindObject(name) ;
488 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
492 //____________________________________________________________________________
493 Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
494 { //---------- Digitizer -------------------------
496 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
499 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
502 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
505 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
506 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
508 emcal = new TTask("EMCAL", "") ;
512 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
515 emcal->GetListOfTasks()->Remove(emcald) ;
517 emcal->Add(digitizer) ;
521 //____________________________________________________________________________
522 Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
523 { //---------- Digitizer -------------------------
525 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
527 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
529 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
533 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
536 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
537 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
539 emcal = new TTask("EMCAL", "") ;
543 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
545 emcald = new AliEMCALDigitizer() ;
546 emcald->SetName(fDigitsTitle) ;
547 emcald->SetTitle(fHeaderFile) ;
553 //____________________________________________________________________________
554 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
556 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
558 cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
562 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
564 cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
568 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
570 return emcal->GetListOfTasks()->GetObjectRef(task) ;
574 //____________________________________________________________________________
575 Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
576 { // -------------- RecPoints -------------------------------------------
578 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
579 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
581 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
583 if ( !emcalFolder ) {
585 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
586 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
588 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
592 TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ;
593 if ( !emcalRPoTowerFolder ) {
595 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
596 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl;
598 emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ;
601 TObject * erp = emcalFolder->FindObject( name ) ;
603 TObjArray * towerrp = new TObjArray(100) ;
604 towerrp->SetName(name) ;
605 emcalRPoTowerFolder->Add(towerrp) ;
608 // Pre Shower RecPoints
609 TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ;
610 if ( !emcalRPoPreShoFolder ) {
612 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl;
613 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
615 emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ;
618 TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
620 TObjArray * preshorp = new TObjArray(100) ;
621 preshorp->SetName(name) ;
622 emcalRPoPreShoFolder->Add(preshorp) ;
627 //____________________________________________________________________________
628 TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const
629 { // -------------- RecPoints -------------------------------------------
631 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
633 if ( !fRecoFolder ) {
634 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
638 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
639 if ( !towerFolder ) {
640 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
645 TObject * trp = towerFolder->FindObject(name ) ;
649 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
653 //____________________________________________________________________________
654 TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const
655 { // -------------- RecPoints -------------------------------------------
657 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
659 if ( !fRecoFolder ) {
660 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
664 TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
665 if ( !preshoFolder ) {
666 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
670 TObject * prp = preshoFolder->FindObject(name ) ;
674 return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
678 //____________________________________________________________________________
679 Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const
680 { // ------------------ AliEMCALClusterizer ------------------------
682 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
684 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
687 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
691 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
694 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
695 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
697 emcal = new TTask("EMCAL", "") ;
701 AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
704 cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
706 emcal->GetListOfTasks()->Remove(emcalcl) ;
712 //____________________________________________________________________________
713 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
714 { // ------------------ AliEMCALClusterizer ------------------------
716 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
719 cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
723 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
725 cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
729 TList * l = emcal->GetListOfTasks() ;
733 TString cluname(name) ;
735 while((task = static_cast<TTask *>(it.Next()) )){
736 TString taskname(task->GetName()) ;
737 if(taskname.BeginsWith(cluname)){
744 return l->GetObjectRef(clu) ;
749 //____________________________________________________________________________
750 Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
751 { // ------------------ AliEMCALClusterizer ------------------------
753 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
755 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
758 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl;
762 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
765 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
766 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
768 emcal = new TTask("EMCAL", "") ;
772 AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
775 emcalcl->SetName(clun) ;
776 emcal->Add(emcalcl) ;
781 //____________________________________________________________________________
782 /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
783 { // ---------------TrackSegments -----------------------------------
785 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
787 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
789 if ( !emcalFolder ) {
791 cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
792 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl;
794 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
797 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
798 if ( !emcalTSFolder ) {
800 cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
801 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl;
803 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
806 TObject * tss = emcalTSFolder->FindObject( name ) ;
808 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
810 emcalTSFolder->Add(ts) ;
815 //____________________________________________________________________________
816 TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
817 { // ---------------TrackSegments -----------------------------------
819 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
821 if ( !fRecoFolder ) {
822 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
826 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
827 if ( !emcalFolder ) {
828 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
832 TObject * tss = emcalFolder->FindObject(name) ;
836 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
839 //____________________________________________________________________________
840 Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
841 { //------------Track Segment Maker ------------------------------
843 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
845 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
848 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
852 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
855 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
856 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
858 emcal = new TTask("EMCAL", "") ;
862 AliEMCALTrackSegmentMaker * emcalts =
863 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
866 emcal->GetListOfTasks()->Remove(emcalts) ;
868 emcal->Add(tsmaker) ;
872 //____________________________________________________________________________
873 Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
874 { //------------Track Segment Maker ------------------------------
876 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
879 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
882 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
886 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
889 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
890 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
892 emcal = new TTask("EMCAL", "") ;
896 AliEMCALTrackSegmentMaker * emcalts =
897 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ;
899 emcalts = new AliEMCALTrackSegmentMakerv1() ;
902 emcalts->SetName(tsn) ;
903 emcal->Add(emcalts) ;
909 //____________________________________________________________________________
910 TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
911 { //------------Track Segment Maker ------------------------------
913 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
916 cerr << "ERROR: AliEMCALGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
920 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
922 cerr <<"WARNING: AliEMCALGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
926 TList * l = emcal->GetListOfTasks() ;
930 TString tsmname(name) ;
932 while((task = static_cast<TTask *>(it.Next()) )){
933 TString taskname(task->GetName()) ;
934 if(taskname.BeginsWith(tsmname)){
941 return l->GetObjectRef(tsm) ;
947 //____________________________________________________________________________
948 Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
949 { // -------------------- RecParticles ------------------------
951 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
953 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
955 if ( !emcalFolder ) {
957 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
958 cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
960 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
963 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
964 if ( !emcalRPaFolder ) {
966 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
967 cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl;
969 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
972 TObject * rps = emcalRPaFolder->FindObject( name ) ;
974 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
976 emcalRPaFolder->Add(rp) ;
981 //____________________________________________________________________________
982 TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
983 { // ---------------TrackSegments -----------------------------------
985 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
987 if ( !fRecoFolder ) {
988 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
992 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
993 if ( !emcalFolder ) {
994 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
998 TObject * tss = emcalFolder->FindObject(name ) ;
1002 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
1005 //____________________________________________________________________________
1006 Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
1007 { // ------------AliEMCAL PID -----------------------------
1009 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1012 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1016 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1019 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1020 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1022 emcal = new TTask("EMCAL", "") ;
1026 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1029 cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName()
1030 << " already exists" << endl ;
1031 emcal->GetListOfTasks()->Remove(emcalpid) ;
1038 //____________________________________________________________________________
1039 Bool_t AliEMCALGetter::PostPID(const char * name) const
1041 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1043 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1046 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1050 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1053 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1054 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1056 emcal = new TTask("EMCAL", "") ;
1060 TList * l = emcal->GetListOfTasks() ;
1062 TString pidname(name) ;
1065 while((task = static_cast<TTask *>(it.Next()) )){
1066 TString taskname(task->GetName()) ;
1067 if(taskname.BeginsWith(pidname))
1071 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1073 emcalpid->SetName(pidname) ;
1074 emcal->Add(emcalpid) ;
1079 //____________________________________________________________________________
1080 TObject ** AliEMCALGetter::PIDRef(const char * name) const
1081 { //------------PID ------------------------------
1083 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1086 cerr << "ERROR: AliEMCALGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1090 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1092 cerr <<"WARNING: AliEMCALGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
1096 TList * l = emcal->GetListOfTasks() ;
1100 TString pidname(name) ;
1102 while((task = static_cast<TTask *>(it.Next()) )){
1103 TString taskname(task->GetName()) ;
1104 if(taskname.BeginsWith(pidname)){
1111 return l->GetObjectRef(pid) ;
1117 //____________________________________________________________________________
1118 Bool_t AliEMCALGetter::PostQA(void) const
1119 { // ------------------ QA ---------------------------------
1121 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
1123 TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ;
1124 if ( !emcalFolder ) {
1126 cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1127 cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl;
1129 emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ;
1135 //____________________________________________________________________________
1136 TObject ** AliEMCALGetter::AlarmsRef(void) const
1137 { //------- Alarms ----------------------
1140 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL
1142 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl;
1146 TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1147 if ( !emcalFolder ) {
1148 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1152 return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
1155 //____________________________________________________________________________
1156 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1158 // Return primary particle numbered by <index>
1163 Int_t primaryIndex = index % 10000000 ;
1164 Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ;
1166 if ( primaryList > 0 ) {
1168 cout << " Getter does not support currently Mixing of primary " << endl ;
1169 cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
1174 return gAlice->Particle(primaryIndex) ;
1178 //____________________________________________________________________________
1179 void AliEMCALGetter::ReadTreeD()
1181 // Read the digit tree gAlice->TreeD()
1182 if(gAlice->TreeD()== 0){
1183 cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ;
1187 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
1189 TBranch * branch = 0 ;
1190 TBranch * digitsbranch = 0 ;
1191 TBranch * digitizerbranch = 0 ;
1192 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1194 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1195 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1196 digitsbranch = branch ;
1197 emcalfound = kTRUE ;
1199 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1200 digitizerbranch = branch ;
1201 digitizerfound = kTRUE ;
1205 if ( !emcalfound || !digitizerfound ) {
1207 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
1208 << fDigitsTitle << endl ;
1213 if(!Digits(fDigitsTitle) )
1214 PostDigits(fDigitsTitle);
1215 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1216 digitsbranch->GetEntry(0) ;
1219 // read the Digitizer
1220 if(!Digitizer(fDigitsTitle))
1221 PostDigitizer(fDigitsTitle) ;
1222 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1223 digitizerbranch->GetEntry(0) ;
1228 //____________________________________________________________________________
1229 void AliEMCALGetter::ReadTreeH()
1231 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1233 if(gAlice->TreeH()== 0){
1234 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1238 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1239 if ( !hitsbranch ) {
1241 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1247 if (hitsbranch->GetEntries() > 1 ) {
1248 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1249 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1250 hitsbranch->SetAddress(&tempo) ;
1253 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1254 hitsbranch->GetEntry(i) ;
1256 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1257 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1258 new((*hits)[index]) AliEMCALHit( *hit ) ;
1265 hitsbranch->SetAddress(HitsRef()) ;
1266 hitsbranch->GetEntry(0) ;
1270 //____________________________________________________________________________
1271 void AliEMCALGetter::Track(Int_t itrack)
1273 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1275 if(gAlice->TreeH()== 0){
1276 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1280 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1281 if ( !hitsbranch ) {
1283 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1288 hitsbranch->SetAddress(HitsRef()) ;
1289 hitsbranch->GetEntry(itrack) ;
1293 //____________________________________________________________________________
1294 // void AliEMCALGetter::ReadTreeQA()
1296 // Read the digit tree gAlice->TreeQA()
1297 // so far only EMCAL knows about this Tree
1299 // if(EMCAL()->TreeQA()== 0){
1300 // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ;
1304 // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ;
1307 // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ;
1314 // qabranch->SetAddress(AlarmsRef()) ;
1316 // qabranch->GetEntry(0) ;
1318 // PostQA("EMCAL") ;
1319 // TFolder * alarmsF = Alarms() ;
1320 // alarmsF->Clear() ;
1321 // qabranch->SetAddress(&alarmsF) ;
1322 // qabranch->GetEntry(0) ;
1326 //____________________________________________________________________________
1327 void AliEMCALGetter::ReadTreeR()
1329 // Read the reconstrunction tree gAlice->TreeR()
1331 if(gAlice->TreeR()== 0){
1332 cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ;
1337 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
1339 TBranch * branch = 0 ;
1340 TBranch * towerbranch = 0 ;
1341 TBranch * preshobranch = 0 ;
1342 TBranch * clusterizerbranch = 0 ;
1343 Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ;
1345 while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) )
1346 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
1347 if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
1348 towerbranch = branch ;
1349 emcaltowerrpfound = kTRUE ;
1351 else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
1352 preshobranch = branch ;
1353 emcalpreshorpfound = kTRUE ;
1355 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1356 clusterizerbranch = branch ;
1357 clusterizerfound = kTRUE ;
1361 if ( !emcaltowerrpfound ) {
1363 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title "
1364 << fRecPointsTitle << endl ;
1367 if ( !emcalpreshorpfound ) {
1369 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title "
1370 << fRecPointsTitle << endl ;
1373 if ( !clusterizerfound ) {
1375 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title "
1376 << fRecPointsTitle << endl ;
1380 // Read and Post the RecPoints
1381 if(!TowerRecPoints(fRecPointsTitle) )
1382 PostRecPoints(fRecPointsTitle) ;
1383 towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
1384 towerbranch->GetEntry(0) ;
1386 preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ;
1387 preshobranch->GetEntry(0) ;
1389 if(!Clusterizer(fRecPointsTitle) )
1390 PostClusterizer(fRecPointsTitle) ;
1391 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1392 clusterizerbranch->GetEntry(0) ;
1395 //------------------- TrackSegments ---------------------
1397 // TBranch * tsbranch = 0 ;
1398 // TBranch * tsmakerbranch = 0 ;
1399 // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1401 // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) )
1402 // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
1403 // if ( strcmp(branch->GetName(), "EMCALTS")==0){
1404 // tsbranch = branch ;
1405 // emcaltsfound = kTRUE ;
1407 // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1408 // tsmakerbranch = branch ;
1409 // tsmakerfound = kTRUE ;
1413 // if ( !emcaltsfound || !tsmakerfound ) {
1415 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
1416 // << fTrackSegmentsTitle << endl ;
1420 // // Read and Post the TrackSegments
1421 // if(!TrackSegments(fTrackSegmentsTitle))
1422 // PostTrackSegments(fTrackSegmentsTitle) ;
1423 // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1424 // tsbranch->GetEntry(0) ;
1426 // // Read and Post the TrackSegment Maker
1427 // if(!TrackSegmentMaker(fTrackSegmentsTitle))
1428 // PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1429 // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
1430 // tsmakerbranch->GetEntry(0) ;
1433 // //------------ RecParticles ----------------------------
1435 // TBranch * rpabranch = 0 ;
1436 // TBranch * pidbranch = 0 ;
1437 // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
1439 // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
1440 // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1441 // if ( strcmp(branch->GetName(), "EMCALRP")==0) {
1442 // rpabranch = branch ;
1443 // emcalrpafound = kTRUE ;
1445 // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
1446 // pidbranch = branch ;
1447 // pidfound = kTRUE ;
1451 // if ( !emcalrpafound || !pidfound ) {
1453 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
1454 // << fRecParticlesTitle << endl ;
1458 // // Read and Post the RecParticles
1459 // if(!RecParticles(fRecParticlesTitle))
1460 // PostRecParticles(fRecParticlesTitle) ;
1461 // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1462 // rpabranch->GetEntry(0) ;
1464 // // Read and Post the PID
1465 // if(!PID(fRecParticlesTitle))
1466 // PostPID(fRecParticlesTitle) ;
1467 // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
1468 // pidbranch->GetEntry(0) ;
1473 //____________________________________________________________________________
1474 void AliEMCALGetter::ReadTreeS(Int_t event)
1476 // Read the summable digits tree gAlice->TreeS()
1478 // loop over all opened files and read their SDigits to the White Board
1479 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
1481 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1482 TCollection * folderslist = emcalF->GetListOfFolders() ;
1484 //Add current file to list if it is not there yet
1486 TString subdir(fHeaderFile) ;
1487 subdir.ReplaceAll("/","_") ;
1489 if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){
1490 emcalF->AddFolder(subdir, "");
1493 TIter next(folderslist) ;
1494 TFolder * folder = 0 ;
1497 while ( (folder = static_cast<TFolder*>(next())) ) {
1498 TString fileName(folder->GetName()) ;
1499 fileName.ReplaceAll("_","/") ;
1500 if(fHeaderFile.CompareTo(fileName) == 0 )
1501 treeS=gAlice->TreeS() ;
1503 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1506 // Get SDigits Tree header from file
1507 TString treeName("TreeS") ;
1509 treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
1512 cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl;
1516 //set address of the SDigits and SDigitizer
1517 TBranch * sdigitsBranch = 0;
1518 TBranch * sdigitizerBranch = 0;
1519 TBranch * branch = 0 ;
1520 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
1522 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1524 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
1525 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1526 emcalfound = kTRUE ;
1527 sdigitsBranch = branch ;
1530 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1531 sdigitizerfound = kTRUE ;
1532 sdigitizerBranch = branch ;
1535 if ( !emcalfound || !sdigitizerfound ) {
1537 cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
1538 << " not found" << endl ;
1542 if ( !folder->FindObject(fSDigitsTitle) )
1543 PostSDigits(fSDigitsTitle,folder->GetName()) ;
1544 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
1545 sdigitsBranch->GetEntry(0) ;
1547 TString sdname(fSDigitsTitle) ;
1549 sdname+=folder->GetName() ;
1550 if(!SDigitizer(sdname) )
1551 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
1552 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1553 sdigitizerBranch->GetEntry(0) ;
1557 // After SDigits have been read from all files, return to the first one
1560 folder = static_cast<TFolder*>(next());
1562 TString fileName(folder->GetName()) ;
1563 fileName.ReplaceAll("_","/") ;
1564 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1569 //____________________________________________________________________________
1570 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
1571 { // Read the summable digits fron treeS()
1574 TString filename("mergefile") ;
1577 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
1578 if ( !emcalFolder ) {
1579 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1581 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
1582 //set address of the SDigits and SDigitizer
1583 TBranch * sdigitsBranch = 0;
1584 TBranch * sdigitizerBranch = 0;
1585 TBranch * branch = 0 ;
1586 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
1588 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1590 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
1591 if ( strcmp(branch->GetName(), "EMCAL")==0) {
1592 emcalfound = kTRUE ;
1593 sdigitsBranch = branch ;
1596 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
1597 sdigitizerfound = kTRUE ;
1598 sdigitizerBranch = branch ;
1601 if ( !emcalfound || !sdigitizerfound ) {
1603 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
1607 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
1608 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
1610 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
1611 sdigitsBranch->GetEntry(0) ;
1613 TString sdname(sdigitsBranch->GetTitle()) ;
1616 if(!SDigitizer(sdigitsBranch->GetTitle()) )
1617 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
1619 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1620 sdigitizerBranch->GetEntry(0) ;
1625 //____________________________________________________________________________
1626 void AliEMCALGetter::ReadPrimaries()
1628 // Reads specific branches of primaries
1630 fNPrimaries = gAlice->GetNtrack();
1632 // //Check, is it necessary to open new files
1633 // TArrayI* events = fDigitizer->GetCurrentEvents() ;
1634 // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
1636 // for(input = 0; input < filenames->GetEntriesFast(); input++){
1638 // TObjString * filename = (TObjString *) filenames->At(input) ;
1640 // //Test, if this file already open
1641 // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
1643 // file = new TFile( filename->GetString()) ;
1646 // // Get Kine Tree from file
1647 // // char treeName[20];
1648 // // sprintf(treeName,"TreeK%d",events->At(input));
1649 // // TTree * treeK = (TTree*)gDirectory->Get(treeName);
1651 // // treeK->SetBranchAddress("Particles", &fParticleBuffer);
1653 // // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
1655 // // // Create the particle stack
1656 // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
1657 // // // Build the pointer list
1658 // // if(fParticleMap) { <----
1659 // // fParticleMap->Clear();
1660 // // fParticleMap->Expand(treeK->GetEntries());
1662 // // fParticleMap = new TObjArray(treeK->GetEntries());
1664 // // From gAlice->Particle(i)
1667 // // if(!(*fParticleMap)[i]) {
1668 // // Int_t nentries = fParticles->GetEntries();
1670 // // // algorithmic way of getting entry index
1671 // // // (primary particles are filled after secondaries)
1673 // // if (i<fHeader.GetNprimary())
1674 // // entry = i+fHeader.GetNsecondary();
1676 // // entry = i-fHeader.GetNprimary();
1678 // // // only check the algorithmic way and give
1679 // // // the fatal error if it is wrong
1680 // // if (entry != fParticleFileMap[i]) {
1681 // // Fatal("Particle",
1682 // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
1683 // // entry, fParticleFileMap[i]);
1686 // // fTreeK->GetEntry(fParticleFileMap[i]);
1687 // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
1688 // // fParticleMap->AddAt((*fParticles)[nentries],i);
1690 // // return (TParticle *) (*fParticleMap)[i];
1697 // //scan over opened files and read corresponding TreeK##
1701 //____________________________________________________________________________
1702 void AliEMCALGetter::Event(const Int_t event, const char* opt)
1704 // Reads the content of all Tree's S, D and R
1706 if (event >= gAlice->TreeE()->GetEntries() ) {
1707 cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
1710 gAlice->GetEvent(event) ;
1712 if(strstr(opt,"H") )
1715 if(strstr(opt,"S") )
1718 if( strstr(opt,"D") )
1721 if( strstr(opt,"R") )
1724 // if( strstr(opt,"Q") )
1727 // if( strstr(opt,"P") || (strcmp(opt,"")==0) )
1728 // ReadPrimaries() ;
1732 //____________________________________________________________________________
1733 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
1735 // get the object named "what" from the folder
1736 // folders are named like //Folders
1738 if ( file.IsNull() )
1739 file = fHeaderFile ;
1741 TFolder * folder = 0 ;
1742 TObject * emcalO = 0 ;
1744 // if ( name.IsNull() ) {
1745 if ( what.CompareTo("Hits") == 0 ) {
1746 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
1748 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
1750 else if ( what.CompareTo("SDigits") == 0 ) {
1751 file.ReplaceAll("/","_") ;
1752 TString path = "EMCAL/" + file ;
1753 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
1756 name = fSDigitsTitle ;
1757 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1760 else if ( what.CompareTo("Digits") == 0 ){
1761 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
1764 name = fDigitsTitle ;
1765 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1768 else if ( what.CompareTo("TowerRecPoints") == 0 ) {
1769 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
1772 name = fRecPointsTitle ;
1773 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1776 else if ( what.CompareTo("PreShoRecPoints") == 0 ) {
1777 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
1780 name = fRecPointsTitle ;
1781 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1785 else if ( what.CompareTo("TrackSegments") == 0 ) {
1786 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
1789 name = fTrackSegmentsTitle ;
1790 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1793 else if ( what.CompareTo("RecParticles") == 0 ) {
1794 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1797 name = fRecParticlesTitle ;
1798 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1801 else if ( what.CompareTo("Alarms") == 0 ){
1803 emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ;
1805 folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1809 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1815 cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
1821 //____________________________________________________________________________
1822 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
1824 // get the TTask named "what" from the folder
1825 // folders are named like //Folders/Tasks/what/EMCAL/name
1827 TString search(what) ;
1828 if ( what.CompareTo("Clusterizer") == 0 )
1829 search = "Reconstructioner" ;
1830 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
1831 search = "Reconstructioner" ;
1832 else if ( what.CompareTo("PID") == 0 )
1833 search = "Reconstructioner" ;
1834 else if ( what.CompareTo("QATasks") == 0 )
1837 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
1840 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
1844 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1846 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
1850 TList * list = emcalT->GetListOfTasks() ;
1852 if (what.CompareTo("SDigitizer") == 0) {
1853 if ( name.IsNull() )
1854 name = fSDigitsTitle ;
1855 } else if (what.CompareTo("Digitizer") == 0){
1856 if ( name.IsNull() )
1857 name = fDigitsTitle ;
1858 } else if (what.CompareTo("Clusterizer") == 0){
1859 if ( name.IsNull() )
1860 name = fRecPointsTitle ;
1861 name.Append(":clu") ;
1863 // else if (what.CompareTo("TrackSegmentMaker") == 0){
1864 // if ( name.IsNull() )
1865 // name = fTrackSegmentsTitle ;
1866 // name.Append(":tsm") ;
1868 // else if (what.CompareTo("PID") == 0){
1869 // if ( name.IsNull() )
1870 // name = fRecParticlesTitle ;
1871 // name.Append(":pid") ;
1873 // else if (what.CompareTo("QATasks") == 0){
1874 // if ( name.IsNull() )
1880 while((task = static_cast<TTask *>(it.Next()) )){
1881 TString taskname(task->GetName()) ;
1882 if(taskname.BeginsWith(name)){
1887 cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;