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
86 fHeaderFile = headerFile ;
87 fBranchTitle = branchTitle ;
88 fSDigitsTitle = branchTitle ;
89 fDigitsTitle = branchTitle ;
90 fRecPointsTitle = branchTitle ;
91 //fRecParticlesTitle = branchTitle ;
92 //fTrackSegmentsTitle = branchTitle ;
94 fPrimaries = new TObjArray(1) ;
96 fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules"));
97 fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits"));
98 fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits"));
99 fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data"));
100 fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData"));
101 //fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA"));
102 fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ;
104 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
107 TFile * file = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
109 if(file == 0){ //if file was not opened yet, read gAlice
110 if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
111 file = TFile::Open(fHeaderFile.Data(),rw) ;
113 file = new TFile(fHeaderFile.Data(),rw) ;
115 if (!file->IsOpen()) {
116 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
120 gAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
125 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
130 cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ;
131 AliConfig * conf = AliConfig::Instance() ;
132 conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
133 conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
138 //____________________________________________________________________________
139 AliEMCALGetter::~AliEMCALGetter(){
143 //____________________________________________________________________________
144 void AliEMCALGetter::CreateWhiteBoard() const
149 //____________________________________________________________________________
150 AliEMCALGetter * AliEMCALGetter::GetInstance()
152 // Returns the pointer of the unique instance already defined
154 AliEMCALGetter * rv = 0 ;
158 cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
163 //____________________________________________________________________________
164 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
165 const char* branchTitle, const Option_t * rw)
167 // Creates and returns the pointer of the unique instance
168 // Must be called only when the environment has changed
171 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
172 (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
175 fgObjGetter->~AliEMCALGetter() ; // delete it if already exists another version
177 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
179 // Posts a few item to the white board (folders)
180 // fgObjGetter->CreateWhiteBoard() ;
186 //____________________________________________________________________________
187 const AliEMCALv1 * AliEMCALGetter::EMCAL()
189 // returns the EMCAL object
190 AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ;
193 cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
197 //____________________________________________________________________________
198 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
200 AliEMCALGeometry * rv = 0 ;
202 rv = EMCAL()->GetGeometry() ;
206 //____________________________________________________________________________
207 Bool_t AliEMCALGetter::PostHits(void) const
208 { //------- Hits ----------------------
210 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
212 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
213 if ( !emcalFolder ) {
215 cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
216 cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
218 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
220 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
221 hits->SetName("Hits") ;
222 emcalFolder->Add(hits) ;
227 //____________________________________________________________________________
228 TObject ** AliEMCALGetter::HitsRef(void) const
229 { //------- Hits ----------------------
232 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
233 if ( !fHitsFolder ) {
234 cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
238 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
239 if ( !emcalFolder ) {
240 cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
244 TObject * h = emcalFolder->FindObject("Hits") ;
246 cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
250 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
253 //____________________________________________________________________________
254 Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
255 { //---------- SDigits -------------------------
258 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
259 // because you can have sdigits from several hit files for mixing
261 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
262 if ( !emcalFolder ) {
264 cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
265 cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
267 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
269 TString subdir(headerFile) ;
270 subdir.ReplaceAll("/", "_") ;
271 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
272 if ( !emcalSubFolder )
273 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
275 TObject * sd = emcalSubFolder->FindObject(name);
278 cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
279 << " already exists!" << endl ;
281 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
282 sdigits->SetName(name) ;
283 emcalSubFolder->Add(sdigits) ;
288 //____________________________________________________________________________
289 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
290 { //------- SDigits ----------------------
292 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
294 if ( !fSDigitsFolder ) {
295 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
299 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
300 if ( !emcalFolder ) {
301 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
305 TFolder * emcalSubFolder = 0 ;
307 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
309 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
311 if(!emcalSubFolder) {
312 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
316 TObject * dis = emcalSubFolder->FindObject(name) ;
320 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
324 //____________________________________________________________________________
325 Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
326 { //---------- SDigitizer -------------------------
328 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
331 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
334 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
337 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
340 cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
341 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
343 emcal = new TTask("EMCAL", "") ;
346 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
349 cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
350 emcal->GetListOfTasks()->Remove(emcalsd) ;
352 emcal->Add(sdigitizer) ;
357 //____________________________________________________________________________
358 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
361 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
363 cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
367 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
369 cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
373 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
375 return emcal->GetListOfTasks()->GetObjectRef(task) ;
379 //____________________________________________________________________________
380 Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
381 { //---------- SDigitizer -------------------------
383 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
386 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
388 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
392 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
395 cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
396 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
398 emcal = new TTask("EMCAL", "") ;
402 TString sdname(name) ;
405 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
407 emcalsd = new AliEMCALSDigitizer() ;
408 //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
409 emcalsd->SetName(sdname) ;
410 emcalsd->SetTitle(file) ;
411 emcal->Add(emcalsd) ;
417 //____________________________________________________________________________
418 Bool_t AliEMCALGetter::PostDigits(const char * name) const
419 { //---------- Digits -------------------------
421 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
423 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
425 if ( !emcalFolder ) {
427 cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
428 cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
430 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
433 TObject* dig = emcalFolder->FindObject( name ) ;
435 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
436 digits->SetName(name) ;
437 emcalFolder->Add(digits) ;
442 //____________________________________________________________________________
443 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
444 { //------- Digits ----------------------
446 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
448 if ( !fDigitsFolder ) {
449 cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
453 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
454 if ( !emcalFolder ) {
455 cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
459 TObject * d = emcalFolder->FindObject(name) ;
463 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
467 //____________________________________________________________________________
468 Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
469 { //---------- Digitizer -------------------------
471 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
474 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
477 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
480 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
481 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
483 emcal = new TTask("EMCAL", "") ;
487 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
490 emcal->GetListOfTasks()->Remove(emcald) ;
492 emcal->Add(digitizer) ;
496 //____________________________________________________________________________
497 Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
498 { //---------- Digitizer -------------------------
500 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
502 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
504 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
508 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
511 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
512 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
514 emcal = new TTask("EMCAL", "") ;
518 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
520 emcald = new AliEMCALDigitizer() ;
521 emcald->SetName(fDigitsTitle) ;
522 emcald->SetTitle(fHeaderFile) ;
528 //____________________________________________________________________________
529 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
531 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
533 cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
537 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
539 cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
543 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
545 return emcal->GetListOfTasks()->GetObjectRef(task) ;
549 //____________________________________________________________________________
550 Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
551 { // -------------- RecPoints -------------------------------------------
553 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
554 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
556 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
558 if ( !emcalFolder ) {
560 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
561 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
563 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
567 TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ;
568 if ( !emcalRPoTowerFolder ) {
570 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
571 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl;
573 emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ;
576 TObject * erp = emcalFolder->FindObject( name ) ;
578 TObjArray * towerrp = new TObjArray(100) ;
579 towerrp->SetName(name) ;
580 emcalRPoTowerFolder->Add(towerrp) ;
583 // Pre Shower RecPoints
584 TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ;
585 if ( !emcalRPoPreShoFolder ) {
587 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl;
588 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
590 emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ;
593 TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
595 TObjArray * preshorp = new TObjArray(100) ;
596 preshorp->SetName(name) ;
597 emcalRPoPreShoFolder->Add(preshorp) ;
602 //____________________________________________________________________________
603 TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const
604 { // -------------- RecPoints -------------------------------------------
606 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
608 if ( !fRecoFolder ) {
609 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
613 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
614 if ( !towerFolder ) {
615 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
620 TObject * trp = towerFolder->FindObject(name ) ;
624 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
628 //____________________________________________________________________________
629 TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const
630 { // -------------- RecPoints -------------------------------------------
632 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
634 if ( !fRecoFolder ) {
635 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
639 TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
640 if ( !preshoFolder ) {
641 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
645 TObject * prp = preshoFolder->FindObject(name ) ;
649 return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
653 //____________________________________________________________________________
654 Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const
655 { // ------------------ AliEMCALClusterizer ------------------------
657 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
659 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
662 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
666 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
669 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
670 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
672 emcal = new TTask("EMCAL", "") ;
676 AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
679 cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
681 emcal->GetListOfTasks()->Remove(emcalcl) ;
687 //____________________________________________________________________________
688 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
689 { // ------------------ AliEMCALClusterizer ------------------------
691 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
694 cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
698 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
700 cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
704 TList * l = emcal->GetListOfTasks() ;
708 TString cluname(name) ;
710 while((task = static_cast<TTask *>(it.Next()) )){
711 TString taskname(task->GetName()) ;
712 if(taskname.BeginsWith(cluname)){
719 return l->GetObjectRef(clu) ;
724 //____________________________________________________________________________
725 Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
726 { // ------------------ AliEMCALClusterizer ------------------------
728 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
730 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
733 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl;
737 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
740 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
741 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
743 emcal = new TTask("EMCAL", "") ;
747 AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
750 emcalcl->SetName(clun) ;
751 emcal->Add(emcalcl) ;
756 //____________________________________________________________________________
757 /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
758 { // ---------------TrackSegments -----------------------------------
760 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
762 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
764 if ( !emcalFolder ) {
766 cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
767 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl;
769 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
772 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
773 if ( !emcalTSFolder ) {
775 cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
776 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl;
778 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
781 TObject * tss = emcalTSFolder->FindObject( name ) ;
783 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
785 emcalTSFolder->Add(ts) ;
790 //____________________________________________________________________________
791 TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
792 { // ---------------TrackSegments -----------------------------------
794 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
796 if ( !fRecoFolder ) {
797 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
801 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
802 if ( !emcalFolder ) {
803 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
807 TObject * tss = emcalFolder->FindObject(name) ;
811 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
814 //____________________________________________________________________________
815 Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
816 { //------------Track Segment Maker ------------------------------
818 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
820 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
823 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
827 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
830 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
831 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
833 emcal = new TTask("EMCAL", "") ;
837 AliEMCALTrackSegmentMaker * emcalts =
838 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
841 emcal->GetListOfTasks()->Remove(emcalts) ;
843 emcal->Add(tsmaker) ;
847 //____________________________________________________________________________
848 Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
849 { //------------Track Segment Maker ------------------------------
851 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
854 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
857 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
861 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
864 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
865 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
867 emcal = new TTask("EMCAL", "") ;
871 AliEMCALTrackSegmentMaker * emcalts =
872 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ;
874 emcalts = new AliEMCALTrackSegmentMakerv1() ;
877 emcalts->SetName(tsn) ;
878 emcal->Add(emcalts) ;
884 //____________________________________________________________________________
885 TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
886 { //------------Track Segment Maker ------------------------------
888 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
891 cerr << "ERROR: AliEMCALGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
895 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
897 cerr <<"WARNING: AliEMCALGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
901 TList * l = emcal->GetListOfTasks() ;
905 TString tsmname(name) ;
907 while((task = static_cast<TTask *>(it.Next()) )){
908 TString taskname(task->GetName()) ;
909 if(taskname.BeginsWith(tsmname)){
916 return l->GetObjectRef(tsm) ;
922 //____________________________________________________________________________
923 Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
924 { // -------------------- RecParticles ------------------------
926 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
928 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
930 if ( !emcalFolder ) {
932 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
933 cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
935 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
938 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
939 if ( !emcalRPaFolder ) {
941 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
942 cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl;
944 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
947 TObject * rps = emcalRPaFolder->FindObject( name ) ;
949 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
951 emcalRPaFolder->Add(rp) ;
956 //____________________________________________________________________________
957 TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
958 { // ---------------TrackSegments -----------------------------------
960 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
962 if ( !fRecoFolder ) {
963 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
967 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
968 if ( !emcalFolder ) {
969 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
973 TObject * tss = emcalFolder->FindObject(name ) ;
977 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
980 //____________________________________________________________________________
981 Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
982 { // ------------AliEMCAL PID -----------------------------
984 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
987 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
991 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
994 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
995 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
997 emcal = new TTask("EMCAL", "") ;
1001 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1004 cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName()
1005 << " already exists" << endl ;
1006 emcal->GetListOfTasks()->Remove(emcalpid) ;
1013 //____________________________________________________________________________
1014 Bool_t AliEMCALGetter::PostPID(const char * name) const
1016 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1018 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1021 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1025 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1028 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1029 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1031 emcal = new TTask("EMCAL", "") ;
1035 TList * l = emcal->GetListOfTasks() ;
1037 TString pidname(name) ;
1040 while((task = static_cast<TTask *>(it.Next()) )){
1041 TString taskname(task->GetName()) ;
1042 if(taskname.BeginsWith(pidname))
1046 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1048 emcalpid->SetName(pidname) ;
1049 emcal->Add(emcalpid) ;
1054 //____________________________________________________________________________
1055 TObject ** AliEMCALGetter::PIDRef(const char * name) const
1056 { //------------PID ------------------------------
1058 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1061 cerr << "ERROR: AliEMCALGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1065 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1067 cerr <<"WARNING: AliEMCALGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
1071 TList * l = emcal->GetListOfTasks() ;
1075 TString pidname(name) ;
1077 while((task = static_cast<TTask *>(it.Next()) )){
1078 TString taskname(task->GetName()) ;
1079 if(taskname.BeginsWith(pidname)){
1086 return l->GetObjectRef(pid) ;
1092 //____________________________________________________________________________
1093 Bool_t AliEMCALGetter::PostQA(void) const
1094 { // ------------------ QA ---------------------------------
1096 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
1098 TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ;
1099 if ( !emcalFolder ) {
1101 cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1102 cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl;
1104 emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ;
1110 //____________________________________________________________________________
1111 TObject ** AliEMCALGetter::AlarmsRef(void) const
1112 { //------- Alarms ----------------------
1115 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL
1117 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl;
1121 TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1122 if ( !emcalFolder ) {
1123 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1127 return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
1130 //____________________________________________________________________________
1131 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1133 // Return primary particle numbered by <index>
1138 Int_t primaryIndex = index % 10000000 ;
1139 Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ;
1141 if ( primaryList > 0 ) {
1143 cout << " Getter does not support currently Mixing of primary " << endl ;
1144 cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
1149 return gAlice->Particle(primaryIndex) ;
1153 //____________________________________________________________________________
1154 void AliEMCALGetter::ReadTreeD()
1156 // Read the digit tree gAlice->TreeD()
1157 if(gAlice->TreeD()== 0){
1158 cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ;
1162 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
1164 TBranch * branch = 0 ;
1165 TBranch * digitsbranch = 0 ;
1166 TBranch * digitizerbranch = 0 ;
1167 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1169 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1170 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1171 digitsbranch = branch ;
1172 emcalfound = kTRUE ;
1174 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1175 digitizerbranch = branch ;
1176 digitizerfound = kTRUE ;
1180 if ( !emcalfound || !digitizerfound ) {
1182 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
1183 << fDigitsTitle << endl ;
1188 if(!Digits(fDigitsTitle) )
1189 PostDigits(fDigitsTitle);
1190 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1191 digitsbranch->GetEntry(0) ;
1194 // read the Digitizer
1195 if(!Digitizer(fDigitsTitle))
1196 PostDigitizer(fDigitsTitle) ;
1197 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1198 digitizerbranch->GetEntry(0) ;
1203 //____________________________________________________________________________
1204 void AliEMCALGetter::ReadTreeH()
1206 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1208 if(gAlice->TreeH()== 0){
1209 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1213 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1214 if ( !hitsbranch ) {
1216 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1222 if (hitsbranch->GetEntries() > 1 ) {
1223 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1224 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1225 hitsbranch->SetAddress(&tempo) ;
1228 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1229 hitsbranch->GetEntry(i) ;
1231 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1232 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1233 new((*hits)[index]) AliEMCALHit( *hit ) ;
1240 hitsbranch->SetAddress(HitsRef()) ;
1241 hitsbranch->GetEntry(0) ;
1245 //____________________________________________________________________________
1246 void AliEMCALGetter::Track(Int_t itrack)
1248 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1250 if(gAlice->TreeH()== 0){
1251 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1255 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1256 if ( !hitsbranch ) {
1258 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1263 hitsbranch->SetAddress(HitsRef()) ;
1264 hitsbranch->GetEntry(itrack) ;
1268 //____________________________________________________________________________
1269 // void AliEMCALGetter::ReadTreeQA()
1271 // Read the digit tree gAlice->TreeQA()
1272 // so far only EMCAL knows about this Tree
1274 // if(EMCAL()->TreeQA()== 0){
1275 // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ;
1279 // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ;
1282 // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ;
1289 // qabranch->SetAddress(AlarmsRef()) ;
1291 // qabranch->GetEntry(0) ;
1293 // PostQA("EMCAL") ;
1294 // TFolder * alarmsF = Alarms() ;
1295 // alarmsF->Clear() ;
1296 // qabranch->SetAddress(&alarmsF) ;
1297 // qabranch->GetEntry(0) ;
1301 //____________________________________________________________________________
1302 void AliEMCALGetter::ReadTreeR()
1304 // Read the reconstrunction tree gAlice->TreeR()
1306 if(gAlice->TreeR()== 0){
1307 cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ;
1312 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
1314 TBranch * branch = 0 ;
1315 TBranch * towerbranch = 0 ;
1316 TBranch * preshobranch = 0 ;
1317 TBranch * clusterizerbranch = 0 ;
1318 Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ;
1320 while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) )
1321 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
1322 if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
1323 towerbranch = branch ;
1324 emcaltowerrpfound = kTRUE ;
1326 else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
1327 preshobranch = branch ;
1328 emcalpreshorpfound = kTRUE ;
1330 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1331 clusterizerbranch = branch ;
1332 clusterizerfound = kTRUE ;
1336 if ( !emcaltowerrpfound ) {
1338 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title "
1339 << fRecPointsTitle << endl ;
1342 if ( !emcalpreshorpfound ) {
1344 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title "
1345 << fRecPointsTitle << endl ;
1348 if ( !clusterizerfound ) {
1350 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title "
1351 << fRecPointsTitle << endl ;
1355 // Read and Post the RecPoints
1356 if(!TowerRecPoints(fRecPointsTitle) )
1357 PostRecPoints(fRecPointsTitle) ;
1358 towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
1359 towerbranch->GetEntry(0) ;
1361 preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ;
1362 preshobranch->GetEntry(0) ;
1364 if(!Clusterizer(fRecPointsTitle) )
1365 PostClusterizer(fRecPointsTitle) ;
1366 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1367 clusterizerbranch->GetEntry(0) ;
1370 //------------------- TrackSegments ---------------------
1372 // TBranch * tsbranch = 0 ;
1373 // TBranch * tsmakerbranch = 0 ;
1374 // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1376 // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) )
1377 // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
1378 // if ( strcmp(branch->GetName(), "EMCALTS")==0){
1379 // tsbranch = branch ;
1380 // emcaltsfound = kTRUE ;
1382 // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1383 // tsmakerbranch = branch ;
1384 // tsmakerfound = kTRUE ;
1388 // if ( !emcaltsfound || !tsmakerfound ) {
1390 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
1391 // << fTrackSegmentsTitle << endl ;
1395 // // Read and Post the TrackSegments
1396 // if(!TrackSegments(fTrackSegmentsTitle))
1397 // PostTrackSegments(fTrackSegmentsTitle) ;
1398 // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1399 // tsbranch->GetEntry(0) ;
1401 // // Read and Post the TrackSegment Maker
1402 // if(!TrackSegmentMaker(fTrackSegmentsTitle))
1403 // PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1404 // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
1405 // tsmakerbranch->GetEntry(0) ;
1408 // //------------ RecParticles ----------------------------
1410 // TBranch * rpabranch = 0 ;
1411 // TBranch * pidbranch = 0 ;
1412 // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
1414 // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
1415 // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1416 // if ( strcmp(branch->GetName(), "EMCALRP")==0) {
1417 // rpabranch = branch ;
1418 // emcalrpafound = kTRUE ;
1420 // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
1421 // pidbranch = branch ;
1422 // pidfound = kTRUE ;
1426 // if ( !emcalrpafound || !pidfound ) {
1428 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
1429 // << fRecParticlesTitle << endl ;
1433 // // Read and Post the RecParticles
1434 // if(!RecParticles(fRecParticlesTitle))
1435 // PostRecParticles(fRecParticlesTitle) ;
1436 // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1437 // rpabranch->GetEntry(0) ;
1439 // // Read and Post the PID
1440 // if(!PID(fRecParticlesTitle))
1441 // PostPID(fRecParticlesTitle) ;
1442 // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
1443 // pidbranch->GetEntry(0) ;
1448 //____________________________________________________________________________
1449 void AliEMCALGetter::ReadTreeS(Int_t event)
1451 // Read the summable digits tree gAlice->TreeS()
1453 // loop over all opened files and read their SDigits to the White Board
1454 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
1456 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1457 TCollection * folderslist = emcalF->GetListOfFolders() ;
1459 //Add current file to list if it is not there yet
1460 if ( (fHeaderFile != "aliroot") && ( !folderslist->Contains(fHeaderFile) ) ){
1461 emcalF->AddFolder(fHeaderFile, "");
1464 TIter next(folderslist) ;
1465 TFolder * folder = 0 ;
1468 while ( (folder = static_cast<TFolder*>(next())) ) {
1469 if(fHeaderFile.CompareTo(folder->GetName()) == 0 )
1470 treeS=gAlice->TreeS() ;
1472 file = static_cast<TFile*>(gROOT->GetFile(folder->GetName()));
1475 // Get SDigits Tree header from file
1476 TString treeName("TreeS") ;
1478 treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
1481 cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl;
1485 //set address of the SDigits and SDigitizer
1486 TBranch * sdigitsBranch = 0;
1487 TBranch * sdigitizerBranch = 0;
1488 TBranch * branch = 0 ;
1489 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
1491 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1493 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
1494 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1495 emcalfound = kTRUE ;
1496 sdigitsBranch = branch ;
1499 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1500 sdigitizerfound = kTRUE ;
1501 sdigitizerBranch = branch ;
1504 if ( !emcalfound || !sdigitizerfound ) {
1506 cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
1507 << " not found" << endl ;
1511 if ( !folder->FindObject(fSDigitsTitle) )
1512 PostSDigits(fSDigitsTitle,folder->GetName()) ;
1513 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
1514 sdigitsBranch->GetEntry(0) ;
1516 TString sdname(fSDigitsTitle) ;
1518 sdname+=folder->GetName() ;
1519 if(!SDigitizer(sdname) )
1520 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
1521 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1522 sdigitizerBranch->GetEntry(0) ;
1526 // After SDigits have been read from all files, return to the first one
1529 folder = static_cast<TFolder*>(next());
1531 file = static_cast<TFile*>(gROOT->GetFile(folder->GetName()));
1536 //____________________________________________________________________________
1537 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
1538 { // Read the summable digits fron treeS()
1541 TString filename("mergefile") ;
1544 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
1545 if ( !emcalFolder ) {
1546 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1548 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
1549 //set address of the SDigits and SDigitizer
1550 TBranch * sdigitsBranch = 0;
1551 TBranch * sdigitizerBranch = 0;
1552 TBranch * branch = 0 ;
1553 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
1555 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1557 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
1558 if ( strcmp(branch->GetName(), "EMCAL")==0) {
1559 emcalfound = kTRUE ;
1560 sdigitsBranch = branch ;
1563 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
1564 sdigitizerfound = kTRUE ;
1565 sdigitizerBranch = branch ;
1568 if ( !emcalfound || !sdigitizerfound ) {
1570 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
1574 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
1575 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
1577 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
1578 sdigitsBranch->GetEntry(0) ;
1580 TString sdname(sdigitsBranch->GetTitle()) ;
1583 if(!SDigitizer(sdigitsBranch->GetTitle()) )
1584 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
1586 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1587 sdigitizerBranch->GetEntry(0) ;
1592 //____________________________________________________________________________
1593 void AliEMCALGetter::ReadPrimaries()
1595 // Reads specific branches of primaries
1597 fNPrimaries = gAlice->GetNtrack();
1599 // //Check, is it necessary to open new files
1600 // TArrayI* events = fDigitizer->GetCurrentEvents() ;
1601 // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
1603 // for(input = 0; input < filenames->GetEntriesFast(); input++){
1605 // TObjString * filename = (TObjString *) filenames->At(input) ;
1607 // //Test, if this file already open
1608 // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
1610 // file = new TFile( filename->GetString()) ;
1613 // // Get Kine Tree from file
1614 // // char treeName[20];
1615 // // sprintf(treeName,"TreeK%d",events->At(input));
1616 // // TTree * treeK = (TTree*)gDirectory->Get(treeName);
1618 // // treeK->SetBranchAddress("Particles", &fParticleBuffer);
1620 // // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
1622 // // // Create the particle stack
1623 // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
1624 // // // Build the pointer list
1625 // // if(fParticleMap) { <----
1626 // // fParticleMap->Clear();
1627 // // fParticleMap->Expand(treeK->GetEntries());
1629 // // fParticleMap = new TObjArray(treeK->GetEntries());
1631 // // From gAlice->Particle(i)
1634 // // if(!(*fParticleMap)[i]) {
1635 // // Int_t nentries = fParticles->GetEntries();
1637 // // // algorithmic way of getting entry index
1638 // // // (primary particles are filled after secondaries)
1640 // // if (i<fHeader.GetNprimary())
1641 // // entry = i+fHeader.GetNsecondary();
1643 // // entry = i-fHeader.GetNprimary();
1645 // // // only check the algorithmic way and give
1646 // // // the fatal error if it is wrong
1647 // // if (entry != fParticleFileMap[i]) {
1648 // // Fatal("Particle",
1649 // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
1650 // // entry, fParticleFileMap[i]);
1653 // // fTreeK->GetEntry(fParticleFileMap[i]);
1654 // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
1655 // // fParticleMap->AddAt((*fParticles)[nentries],i);
1657 // // return (TParticle *) (*fParticleMap)[i];
1664 // //scan over opened files and read corresponding TreeK##
1668 //____________________________________________________________________________
1669 void AliEMCALGetter::Event(const Int_t event, const char* opt)
1671 // Reads the content of all Tree's S, D and R
1673 if (event >= gAlice->TreeE()->GetEntries() ) {
1674 cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
1677 gAlice->GetEvent(event) ;
1679 if(strstr(opt,"H") )
1682 if(strstr(opt,"S") )
1685 if( strstr(opt,"D") )
1688 if( strstr(opt,"R") )
1691 // if( strstr(opt,"Q") )
1694 // if( strstr(opt,"P") || (strcmp(opt,"")==0) )
1695 // ReadPrimaries() ;
1699 //____________________________________________________________________________
1700 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
1702 // get the object named "what" from the folder
1703 // folders are named like //Folders
1705 if ( file.IsNull() )
1706 file = fHeaderFile ;
1708 TFolder * folder = 0 ;
1709 TObject * emcalO = 0 ;
1711 // if ( name.IsNull() ) {
1712 if ( what.CompareTo("Hits") == 0 ) {
1713 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
1715 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
1717 else if ( what.CompareTo("SDigits") == 0 ) {
1718 TString path = "EMCAL/" + file ;
1719 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
1722 name = fSDigitsTitle ;
1723 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1726 else if ( what.CompareTo("Digits") == 0 ){
1727 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
1730 name = fDigitsTitle ;
1731 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1734 else if ( what.CompareTo("TowerRecPoints") == 0 ) {
1735 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
1738 name = fRecPointsTitle ;
1739 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1742 else if ( what.CompareTo("PreShoRecPoints") == 0 ) {
1743 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
1746 name = fRecPointsTitle ;
1747 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1751 else if ( what.CompareTo("TrackSegments") == 0 ) {
1752 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
1755 name = fTrackSegmentsTitle ;
1756 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1759 else if ( what.CompareTo("RecParticles") == 0 ) {
1760 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1763 name = fRecParticlesTitle ;
1764 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1767 else if ( what.CompareTo("Alarms") == 0 ){
1769 emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ;
1771 folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1775 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1781 cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
1787 //____________________________________________________________________________
1788 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
1790 // get the TTask named "what" from the folder
1791 // folders are named like //Folders/Tasks/what/EMCAL/name
1793 TString search(what) ;
1794 if ( what.CompareTo("Clusterizer") == 0 )
1795 search = "Reconstructioner" ;
1796 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
1797 search = "Reconstructioner" ;
1798 else if ( what.CompareTo("PID") == 0 )
1799 search = "Reconstructioner" ;
1800 else if ( what.CompareTo("QATasks") == 0 )
1803 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
1806 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
1810 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1812 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
1816 TList * list = emcalT->GetListOfTasks() ;
1818 if (what.CompareTo("SDigitizer") == 0) {
1819 if ( name.IsNull() )
1820 name = fSDigitsTitle ;
1821 } else if (what.CompareTo("Digitizer") == 0){
1822 if ( name.IsNull() )
1823 name = fDigitsTitle ;
1824 } else if (what.CompareTo("Clusterizer") == 0){
1825 if ( name.IsNull() )
1826 name = fRecPointsTitle ;
1827 name.Append(":clu") ;
1829 // else if (what.CompareTo("TrackSegmentMaker") == 0){
1830 // if ( name.IsNull() )
1831 // name = fTrackSegmentsTitle ;
1832 // name.Append(":tsm") ;
1834 // else if (what.CompareTo("PID") == 0){
1835 // if ( name.IsNull() )
1836 // name = fRecParticlesTitle ;
1837 // name.Append(":pid") ;
1839 // else if (what.CompareTo("QATasks") == 0){
1840 // if ( name.IsNull() )
1846 while((task = static_cast<TTask *>(it.Next()) )){
1847 TString taskname(task->GetName()) ;
1848 if(taskname.BeginsWith(name))
1853 cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;