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")) ;
109 fFile = new TFile() ;
111 if (fFile->IsOpen() )
114 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
117 fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
119 if(!fFile){ //if file was not opened yet, read gAlice
120 // if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
121 fFile = TFile::Open(fHeaderFile.Data(),rw) ;
123 //fFile = new TFile(fHeaderFile.Data(),rw) ;
125 if (!fFile->IsOpen()) {
126 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
131 gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ;
136 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
142 cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ;
143 AliConfig * conf = AliConfig::Instance() ;
144 conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
145 conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
150 //____________________________________________________________________________
151 AliEMCALGetter::~AliEMCALGetter(){
154 fPrimaries->Delete() ;
161 //____________________________________________________________________________
162 void AliEMCALGetter::CreateWhiteBoard() const
167 //____________________________________________________________________________
168 AliEMCALGetter * AliEMCALGetter::GetInstance()
170 // Returns the pointer of the unique instance already defined
172 AliEMCALGetter * rv = 0 ;
176 cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
181 //____________________________________________________________________________
182 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
183 const char* branchTitle, const Option_t * rw)
185 // Creates and returns the pointer of the unique instance
186 // Must be called only when the environment has changed
189 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
190 (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
193 fgObjGetter->~AliEMCALGetter() ; // delete it already exists another version
195 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
197 // Posts a few item to the white board (folders)
198 // fgObjGetter->CreateWhiteBoard() ;
204 //____________________________________________________________________________
205 const AliEMCALv1 * AliEMCALGetter::EMCAL()
207 // returns the EMCAL object
208 AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ;
211 cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
215 //____________________________________________________________________________
216 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
218 AliEMCALGeometry * rv = 0 ;
220 rv = EMCAL()->GetGeometry() ;
224 //____________________________________________________________________________
225 Bool_t AliEMCALGetter::PostHits(void) const
226 { //------- Hits ----------------------
228 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
230 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
231 if ( !emcalFolder ) {
233 cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
234 cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
236 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
238 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
239 hits->SetName("Hits") ;
240 emcalFolder->Add(hits) ;
245 //____________________________________________________________________________
246 TObject ** AliEMCALGetter::HitsRef(void) const
247 { //------- Hits ----------------------
250 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
251 if ( !fHitsFolder ) {
252 cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
256 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
257 if ( !emcalFolder ) {
258 cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
262 TObject * h = emcalFolder->FindObject("Hits") ;
264 cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
268 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
271 //____________________________________________________________________________
272 Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
273 { //---------- SDigits -------------------------
276 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
277 // because you can have sdigits from several hit files for mixing
279 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
280 if ( !emcalFolder ) {
282 cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
283 cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
285 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
287 TString subdir(headerFile) ;
288 subdir.ReplaceAll("/", "_") ;
289 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
290 if ( !emcalSubFolder )
291 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
293 TObject * sd = emcalSubFolder->FindObject(name);
296 cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
297 << " already exists!" << endl ;
299 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
300 sdigits->SetName(name) ;
301 emcalSubFolder->Add(sdigits) ;
306 //____________________________________________________________________________
307 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
308 { //------- SDigits ----------------------
310 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
312 if ( !fSDigitsFolder ) {
313 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
317 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
318 if ( !emcalFolder ) {
319 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
323 TFolder * emcalSubFolder = 0 ;
325 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
327 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
329 if(!emcalSubFolder) {
330 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
334 TObject * dis = emcalSubFolder->FindObject(name) ;
338 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
342 //____________________________________________________________________________
343 Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
344 { //---------- SDigitizer -------------------------
346 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
349 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
352 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
355 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
358 cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
359 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
361 emcal = new TTask("EMCAL", "") ;
364 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
367 cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
368 emcal->GetListOfTasks()->Remove(emcalsd) ;
370 emcal->Add(sdigitizer) ;
375 //____________________________________________________________________________
376 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
379 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
381 cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
385 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
387 cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
391 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
393 return emcal->GetListOfTasks()->GetObjectRef(task) ;
397 //____________________________________________________________________________
398 Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
399 { //---------- SDigitizer -------------------------
401 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
404 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
406 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
410 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
413 cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
414 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
416 emcal = new TTask("EMCAL", "") ;
420 TString sdname(name) ;
423 sdname.ReplaceAll("/","_") ;
424 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
426 emcalsd = new AliEMCALSDigitizer() ;
427 //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
428 emcalsd->SetName(sdname) ;
429 emcalsd->SetTitle(file) ;
430 emcal->Add(emcalsd) ;
436 //____________________________________________________________________________
437 Bool_t AliEMCALGetter::PostDigits(const char * name) const
438 { //---------- Digits -------------------------
440 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
442 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
444 if ( !emcalFolder ) {
446 cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
447 cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
449 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
452 TObject* dig = emcalFolder->FindObject( name ) ;
454 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
455 digits->SetName(name) ;
456 emcalFolder->Add(digits) ;
461 //____________________________________________________________________________
462 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
463 { //------- Digits ----------------------
465 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
467 if ( !fDigitsFolder ) {
468 cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
472 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
473 if ( !emcalFolder ) {
474 cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
478 TObject * d = emcalFolder->FindObject(name) ;
482 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
486 //____________________________________________________________________________
487 Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
488 { //---------- Digitizer -------------------------
490 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
493 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
496 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
499 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
500 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
502 emcal = new TTask("EMCAL", "") ;
506 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
509 emcal->GetListOfTasks()->Remove(emcald) ;
511 emcal->Add(digitizer) ;
515 //____________________________________________________________________________
516 Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
517 { //---------- Digitizer -------------------------
519 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
521 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
523 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
527 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
530 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
531 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
533 emcal = new TTask("EMCAL", "") ;
537 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
539 emcald = new AliEMCALDigitizer() ;
540 emcald->SetName(fDigitsTitle) ;
541 emcald->SetTitle(fHeaderFile) ;
547 //____________________________________________________________________________
548 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
550 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
552 cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
556 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
558 cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
562 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
564 return emcal->GetListOfTasks()->GetObjectRef(task) ;
568 //____________________________________________________________________________
569 Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
570 { // -------------- RecPoints -------------------------------------------
572 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
573 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
575 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
577 if ( !emcalFolder ) {
579 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
580 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
582 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
586 TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ;
587 if ( !emcalRPoTowerFolder ) {
589 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
590 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl;
592 emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ;
595 TObject * erp = emcalFolder->FindObject( name ) ;
597 TObjArray * towerrp = new TObjArray(100) ;
598 towerrp->SetName(name) ;
599 emcalRPoTowerFolder->Add(towerrp) ;
602 // Pre Shower RecPoints
603 TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ;
604 if ( !emcalRPoPreShoFolder ) {
606 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl;
607 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
609 emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ;
612 TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
614 TObjArray * preshorp = new TObjArray(100) ;
615 preshorp->SetName(name) ;
616 emcalRPoPreShoFolder->Add(preshorp) ;
621 //____________________________________________________________________________
622 TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const
623 { // -------------- RecPoints -------------------------------------------
625 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
627 if ( !fRecoFolder ) {
628 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
632 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
633 if ( !towerFolder ) {
634 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
639 TObject * trp = towerFolder->FindObject(name ) ;
643 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
647 //____________________________________________________________________________
648 TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const
649 { // -------------- RecPoints -------------------------------------------
651 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
653 if ( !fRecoFolder ) {
654 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
658 TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
659 if ( !preshoFolder ) {
660 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
664 TObject * prp = preshoFolder->FindObject(name ) ;
668 return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
672 //____________________________________________________________________________
673 Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const
674 { // ------------------ AliEMCALClusterizer ------------------------
676 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
678 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
681 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
685 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
688 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
689 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
691 emcal = new TTask("EMCAL", "") ;
695 AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
698 cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
700 emcal->GetListOfTasks()->Remove(emcalcl) ;
706 //____________________________________________________________________________
707 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
708 { // ------------------ AliEMCALClusterizer ------------------------
710 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
713 cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
717 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
719 cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
723 TList * l = emcal->GetListOfTasks() ;
727 TString cluname(name) ;
729 while((task = static_cast<TTask *>(it.Next()) )){
730 TString taskname(task->GetName()) ;
731 if(taskname.BeginsWith(cluname)){
738 return l->GetObjectRef(clu) ;
743 //____________________________________________________________________________
744 Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
745 { // ------------------ AliEMCALClusterizer ------------------------
747 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
749 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
752 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl;
756 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
759 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
760 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
762 emcal = new TTask("EMCAL", "") ;
766 AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
769 emcalcl->SetName(clun) ;
770 emcal->Add(emcalcl) ;
775 //____________________________________________________________________________
776 /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
777 { // ---------------TrackSegments -----------------------------------
779 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
781 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
783 if ( !emcalFolder ) {
785 cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
786 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl;
788 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
791 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
792 if ( !emcalTSFolder ) {
794 cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
795 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl;
797 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
800 TObject * tss = emcalTSFolder->FindObject( name ) ;
802 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
804 emcalTSFolder->Add(ts) ;
809 //____________________________________________________________________________
810 TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
811 { // ---------------TrackSegments -----------------------------------
813 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
815 if ( !fRecoFolder ) {
816 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
820 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
821 if ( !emcalFolder ) {
822 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
826 TObject * tss = emcalFolder->FindObject(name) ;
830 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
833 //____________________________________________________________________________
834 Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
835 { //------------Track Segment Maker ------------------------------
837 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
839 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
842 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
846 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
849 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
850 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
852 emcal = new TTask("EMCAL", "") ;
856 AliEMCALTrackSegmentMaker * emcalts =
857 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
860 emcal->GetListOfTasks()->Remove(emcalts) ;
862 emcal->Add(tsmaker) ;
866 //____________________________________________________________________________
867 Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
868 { //------------Track Segment Maker ------------------------------
870 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
873 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
876 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
880 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
883 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
884 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
886 emcal = new TTask("EMCAL", "") ;
890 AliEMCALTrackSegmentMaker * emcalts =
891 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ;
893 emcalts = new AliEMCALTrackSegmentMakerv1() ;
896 emcalts->SetName(tsn) ;
897 emcal->Add(emcalts) ;
903 //____________________________________________________________________________
904 TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
905 { //------------Track Segment Maker ------------------------------
907 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
910 cerr << "ERROR: AliEMCALGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
914 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
916 cerr <<"WARNING: AliEMCALGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
920 TList * l = emcal->GetListOfTasks() ;
924 TString tsmname(name) ;
926 while((task = static_cast<TTask *>(it.Next()) )){
927 TString taskname(task->GetName()) ;
928 if(taskname.BeginsWith(tsmname)){
935 return l->GetObjectRef(tsm) ;
941 //____________________________________________________________________________
942 Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
943 { // -------------------- RecParticles ------------------------
945 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
947 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
949 if ( !emcalFolder ) {
951 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
952 cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
954 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
957 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
958 if ( !emcalRPaFolder ) {
960 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
961 cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl;
963 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
966 TObject * rps = emcalRPaFolder->FindObject( name ) ;
968 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
970 emcalRPaFolder->Add(rp) ;
975 //____________________________________________________________________________
976 TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
977 { // ---------------TrackSegments -----------------------------------
979 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
981 if ( !fRecoFolder ) {
982 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
986 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
987 if ( !emcalFolder ) {
988 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
992 TObject * tss = emcalFolder->FindObject(name ) ;
996 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
999 //____________________________________________________________________________
1000 Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
1001 { // ------------AliEMCAL PID -----------------------------
1003 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1006 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1010 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1013 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1014 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1016 emcal = new TTask("EMCAL", "") ;
1020 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1023 cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName()
1024 << " already exists" << endl ;
1025 emcal->GetListOfTasks()->Remove(emcalpid) ;
1032 //____________________________________________________________________________
1033 Bool_t AliEMCALGetter::PostPID(const char * name) const
1035 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1037 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1040 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1044 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1047 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1048 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1050 emcal = new TTask("EMCAL", "") ;
1054 TList * l = emcal->GetListOfTasks() ;
1056 TString pidname(name) ;
1059 while((task = static_cast<TTask *>(it.Next()) )){
1060 TString taskname(task->GetName()) ;
1061 if(taskname.BeginsWith(pidname))
1065 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1067 emcalpid->SetName(pidname) ;
1068 emcal->Add(emcalpid) ;
1073 //____________________________________________________________________________
1074 TObject ** AliEMCALGetter::PIDRef(const char * name) const
1075 { //------------PID ------------------------------
1077 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1080 cerr << "ERROR: AliEMCALGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1084 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1086 cerr <<"WARNING: AliEMCALGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
1090 TList * l = emcal->GetListOfTasks() ;
1094 TString pidname(name) ;
1096 while((task = static_cast<TTask *>(it.Next()) )){
1097 TString taskname(task->GetName()) ;
1098 if(taskname.BeginsWith(pidname)){
1105 return l->GetObjectRef(pid) ;
1111 //____________________________________________________________________________
1112 Bool_t AliEMCALGetter::PostQA(void) const
1113 { // ------------------ QA ---------------------------------
1115 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
1117 TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ;
1118 if ( !emcalFolder ) {
1120 cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1121 cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl;
1123 emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ;
1129 //____________________________________________________________________________
1130 TObject ** AliEMCALGetter::AlarmsRef(void) const
1131 { //------- Alarms ----------------------
1134 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL
1136 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl;
1140 TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1141 if ( !emcalFolder ) {
1142 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1146 return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
1149 //____________________________________________________________________________
1150 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1152 // Return primary particle numbered by <index>
1157 Int_t primaryIndex = index % 10000000 ;
1158 Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ;
1160 if ( primaryList > 0 ) {
1162 cout << " Getter does not support currently Mixing of primary " << endl ;
1163 cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
1168 return gAlice->Particle(primaryIndex) ;
1172 //____________________________________________________________________________
1173 void AliEMCALGetter::ReadTreeD()
1175 // Read the digit tree gAlice->TreeD()
1176 if(gAlice->TreeD()== 0){
1177 cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ;
1181 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
1183 TBranch * branch = 0 ;
1184 TBranch * digitsbranch = 0 ;
1185 TBranch * digitizerbranch = 0 ;
1186 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1188 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1189 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1190 digitsbranch = branch ;
1191 emcalfound = kTRUE ;
1193 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1194 digitizerbranch = branch ;
1195 digitizerfound = kTRUE ;
1199 if ( !emcalfound || !digitizerfound ) {
1201 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
1202 << fDigitsTitle << endl ;
1207 if(!Digits(fDigitsTitle) )
1208 PostDigits(fDigitsTitle);
1209 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1210 digitsbranch->GetEntry(0) ;
1213 // read the Digitizer
1214 if(!Digitizer(fDigitsTitle))
1215 PostDigitizer(fDigitsTitle) ;
1216 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1217 digitizerbranch->GetEntry(0) ;
1222 //____________________________________________________________________________
1223 void AliEMCALGetter::ReadTreeH()
1225 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1227 if(gAlice->TreeH()== 0){
1228 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1232 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1233 if ( !hitsbranch ) {
1235 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1241 if (hitsbranch->GetEntries() > 1 ) {
1242 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1243 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1244 hitsbranch->SetAddress(&tempo) ;
1247 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1248 hitsbranch->GetEntry(i) ;
1250 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1251 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1252 new((*hits)[index]) AliEMCALHit( *hit ) ;
1259 hitsbranch->SetAddress(HitsRef()) ;
1260 hitsbranch->GetEntry(0) ;
1264 //____________________________________________________________________________
1265 void AliEMCALGetter::Track(Int_t itrack)
1267 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1269 if(gAlice->TreeH()== 0){
1270 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1274 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1275 if ( !hitsbranch ) {
1277 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1282 hitsbranch->SetAddress(HitsRef()) ;
1283 hitsbranch->GetEntry(itrack) ;
1287 //____________________________________________________________________________
1288 // void AliEMCALGetter::ReadTreeQA()
1290 // Read the digit tree gAlice->TreeQA()
1291 // so far only EMCAL knows about this Tree
1293 // if(EMCAL()->TreeQA()== 0){
1294 // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ;
1298 // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ;
1301 // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ;
1308 // qabranch->SetAddress(AlarmsRef()) ;
1310 // qabranch->GetEntry(0) ;
1312 // PostQA("EMCAL") ;
1313 // TFolder * alarmsF = Alarms() ;
1314 // alarmsF->Clear() ;
1315 // qabranch->SetAddress(&alarmsF) ;
1316 // qabranch->GetEntry(0) ;
1320 //____________________________________________________________________________
1321 void AliEMCALGetter::ReadTreeR()
1323 // Read the reconstrunction tree gAlice->TreeR()
1325 if(gAlice->TreeR()== 0){
1326 cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ;
1331 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
1333 TBranch * branch = 0 ;
1334 TBranch * towerbranch = 0 ;
1335 TBranch * preshobranch = 0 ;
1336 TBranch * clusterizerbranch = 0 ;
1337 Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ;
1339 while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) )
1340 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
1341 if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
1342 towerbranch = branch ;
1343 emcaltowerrpfound = kTRUE ;
1345 else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
1346 preshobranch = branch ;
1347 emcalpreshorpfound = kTRUE ;
1349 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1350 clusterizerbranch = branch ;
1351 clusterizerfound = kTRUE ;
1355 if ( !emcaltowerrpfound ) {
1357 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title "
1358 << fRecPointsTitle << endl ;
1361 if ( !emcalpreshorpfound ) {
1363 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title "
1364 << fRecPointsTitle << endl ;
1367 if ( !clusterizerfound ) {
1369 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title "
1370 << fRecPointsTitle << endl ;
1374 // Read and Post the RecPoints
1375 if(!TowerRecPoints(fRecPointsTitle) )
1376 PostRecPoints(fRecPointsTitle) ;
1377 towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
1378 towerbranch->GetEntry(0) ;
1380 preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ;
1381 preshobranch->GetEntry(0) ;
1383 if(!Clusterizer(fRecPointsTitle) )
1384 PostClusterizer(fRecPointsTitle) ;
1385 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1386 clusterizerbranch->GetEntry(0) ;
1389 //------------------- TrackSegments ---------------------
1391 // TBranch * tsbranch = 0 ;
1392 // TBranch * tsmakerbranch = 0 ;
1393 // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1395 // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) )
1396 // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
1397 // if ( strcmp(branch->GetName(), "EMCALTS")==0){
1398 // tsbranch = branch ;
1399 // emcaltsfound = kTRUE ;
1401 // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1402 // tsmakerbranch = branch ;
1403 // tsmakerfound = kTRUE ;
1407 // if ( !emcaltsfound || !tsmakerfound ) {
1409 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
1410 // << fTrackSegmentsTitle << endl ;
1414 // // Read and Post the TrackSegments
1415 // if(!TrackSegments(fTrackSegmentsTitle))
1416 // PostTrackSegments(fTrackSegmentsTitle) ;
1417 // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1418 // tsbranch->GetEntry(0) ;
1420 // // Read and Post the TrackSegment Maker
1421 // if(!TrackSegmentMaker(fTrackSegmentsTitle))
1422 // PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1423 // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
1424 // tsmakerbranch->GetEntry(0) ;
1427 // //------------ RecParticles ----------------------------
1429 // TBranch * rpabranch = 0 ;
1430 // TBranch * pidbranch = 0 ;
1431 // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
1433 // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
1434 // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1435 // if ( strcmp(branch->GetName(), "EMCALRP")==0) {
1436 // rpabranch = branch ;
1437 // emcalrpafound = kTRUE ;
1439 // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
1440 // pidbranch = branch ;
1441 // pidfound = kTRUE ;
1445 // if ( !emcalrpafound || !pidfound ) {
1447 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
1448 // << fRecParticlesTitle << endl ;
1452 // // Read and Post the RecParticles
1453 // if(!RecParticles(fRecParticlesTitle))
1454 // PostRecParticles(fRecParticlesTitle) ;
1455 // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1456 // rpabranch->GetEntry(0) ;
1458 // // Read and Post the PID
1459 // if(!PID(fRecParticlesTitle))
1460 // PostPID(fRecParticlesTitle) ;
1461 // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
1462 // pidbranch->GetEntry(0) ;
1467 //____________________________________________________________________________
1468 void AliEMCALGetter::ReadTreeS(Int_t event)
1470 // Read the summable digits tree gAlice->TreeS()
1472 // loop over all opened files and read their SDigits to the White Board
1473 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
1475 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1476 TCollection * folderslist = emcalF->GetListOfFolders() ;
1478 //Add current file to list if it is not there yet
1480 TString subdir(fHeaderFile) ;
1481 subdir.ReplaceAll("/","_") ;
1483 if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){
1484 emcalF->AddFolder(subdir, "");
1487 TIter next(folderslist) ;
1488 TFolder * folder = 0 ;
1491 while ( (folder = static_cast<TFolder*>(next())) ) {
1492 TString fileName(folder->GetName()) ;
1493 fileName.ReplaceAll("_","/") ;
1494 if(fHeaderFile.CompareTo(fileName) == 0 )
1495 treeS=gAlice->TreeS() ;
1497 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1500 // Get SDigits Tree header from file
1501 TString treeName("TreeS") ;
1503 treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
1506 cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl;
1510 //set address of the SDigits and SDigitizer
1511 TBranch * sdigitsBranch = 0;
1512 TBranch * sdigitizerBranch = 0;
1513 TBranch * branch = 0 ;
1514 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
1516 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1518 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
1519 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1520 emcalfound = kTRUE ;
1521 sdigitsBranch = branch ;
1524 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1525 sdigitizerfound = kTRUE ;
1526 sdigitizerBranch = branch ;
1529 if ( !emcalfound || !sdigitizerfound ) {
1531 cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
1532 << " not found" << endl ;
1536 if ( !folder->FindObject(fSDigitsTitle) )
1537 PostSDigits(fSDigitsTitle,folder->GetName()) ;
1538 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
1539 sdigitsBranch->GetEntry(0) ;
1541 TString sdname(fSDigitsTitle) ;
1543 sdname+=folder->GetName() ;
1544 if(!SDigitizer(sdname) )
1545 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
1546 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1547 sdigitizerBranch->GetEntry(0) ;
1551 // After SDigits have been read from all files, return to the first one
1554 folder = static_cast<TFolder*>(next());
1556 TString fileName(folder->GetName()) ;
1557 fileName.ReplaceAll("_","/") ;
1558 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1563 //____________________________________________________________________________
1564 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
1565 { // Read the summable digits fron treeS()
1568 TString filename("mergefile") ;
1571 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
1572 if ( !emcalFolder ) {
1573 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1575 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
1576 //set address of the SDigits and SDigitizer
1577 TBranch * sdigitsBranch = 0;
1578 TBranch * sdigitizerBranch = 0;
1579 TBranch * branch = 0 ;
1580 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
1582 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1584 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
1585 if ( strcmp(branch->GetName(), "EMCAL")==0) {
1586 emcalfound = kTRUE ;
1587 sdigitsBranch = branch ;
1590 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
1591 sdigitizerfound = kTRUE ;
1592 sdigitizerBranch = branch ;
1595 if ( !emcalfound || !sdigitizerfound ) {
1597 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
1601 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
1602 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
1604 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
1605 sdigitsBranch->GetEntry(0) ;
1607 TString sdname(sdigitsBranch->GetTitle()) ;
1610 if(!SDigitizer(sdigitsBranch->GetTitle()) )
1611 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
1613 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1614 sdigitizerBranch->GetEntry(0) ;
1619 //____________________________________________________________________________
1620 void AliEMCALGetter::ReadPrimaries()
1622 // Reads specific branches of primaries
1624 fNPrimaries = gAlice->GetNtrack();
1626 // //Check, is it necessary to open new files
1627 // TArrayI* events = fDigitizer->GetCurrentEvents() ;
1628 // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
1630 // for(input = 0; input < filenames->GetEntriesFast(); input++){
1632 // TObjString * filename = (TObjString *) filenames->At(input) ;
1634 // //Test, if this file already open
1635 // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
1637 // file = new TFile( filename->GetString()) ;
1640 // // Get Kine Tree from file
1641 // // char treeName[20];
1642 // // sprintf(treeName,"TreeK%d",events->At(input));
1643 // // TTree * treeK = (TTree*)gDirectory->Get(treeName);
1645 // // treeK->SetBranchAddress("Particles", &fParticleBuffer);
1647 // // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
1649 // // // Create the particle stack
1650 // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
1651 // // // Build the pointer list
1652 // // if(fParticleMap) { <----
1653 // // fParticleMap->Clear();
1654 // // fParticleMap->Expand(treeK->GetEntries());
1656 // // fParticleMap = new TObjArray(treeK->GetEntries());
1658 // // From gAlice->Particle(i)
1661 // // if(!(*fParticleMap)[i]) {
1662 // // Int_t nentries = fParticles->GetEntries();
1664 // // // algorithmic way of getting entry index
1665 // // // (primary particles are filled after secondaries)
1667 // // if (i<fHeader.GetNprimary())
1668 // // entry = i+fHeader.GetNsecondary();
1670 // // entry = i-fHeader.GetNprimary();
1672 // // // only check the algorithmic way and give
1673 // // // the fatal error if it is wrong
1674 // // if (entry != fParticleFileMap[i]) {
1675 // // Fatal("Particle",
1676 // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
1677 // // entry, fParticleFileMap[i]);
1680 // // fTreeK->GetEntry(fParticleFileMap[i]);
1681 // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
1682 // // fParticleMap->AddAt((*fParticles)[nentries],i);
1684 // // return (TParticle *) (*fParticleMap)[i];
1691 // //scan over opened files and read corresponding TreeK##
1695 //____________________________________________________________________________
1696 void AliEMCALGetter::Event(const Int_t event, const char* opt)
1698 // Reads the content of all Tree's S, D and R
1700 if (event >= gAlice->TreeE()->GetEntries() ) {
1701 cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
1704 gAlice->GetEvent(event) ;
1706 if(strstr(opt,"H") )
1709 if(strstr(opt,"S") )
1712 if( strstr(opt,"D") )
1715 if( strstr(opt,"R") )
1718 // if( strstr(opt,"Q") )
1721 // if( strstr(opt,"P") || (strcmp(opt,"")==0) )
1722 // ReadPrimaries() ;
1726 //____________________________________________________________________________
1727 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
1729 // get the object named "what" from the folder
1730 // folders are named like //Folders
1732 if ( file.IsNull() )
1733 file = fHeaderFile ;
1735 TFolder * folder = 0 ;
1736 TObject * emcalO = 0 ;
1738 // if ( name.IsNull() ) {
1739 if ( what.CompareTo("Hits") == 0 ) {
1740 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
1742 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
1744 else if ( what.CompareTo("SDigits") == 0 ) {
1745 file.ReplaceAll("/","_") ;
1746 TString path = "EMCAL/" + file ;
1747 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
1750 name = fSDigitsTitle ;
1751 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1754 else if ( what.CompareTo("Digits") == 0 ){
1755 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
1758 name = fDigitsTitle ;
1759 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1762 else if ( what.CompareTo("TowerRecPoints") == 0 ) {
1763 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
1766 name = fRecPointsTitle ;
1767 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1770 else if ( what.CompareTo("PreShoRecPoints") == 0 ) {
1771 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
1774 name = fRecPointsTitle ;
1775 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1779 else if ( what.CompareTo("TrackSegments") == 0 ) {
1780 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
1783 name = fTrackSegmentsTitle ;
1784 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1787 else if ( what.CompareTo("RecParticles") == 0 ) {
1788 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1791 name = fRecParticlesTitle ;
1792 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1795 else if ( what.CompareTo("Alarms") == 0 ){
1797 emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ;
1799 folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1803 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1809 cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
1815 //____________________________________________________________________________
1816 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
1818 // get the TTask named "what" from the folder
1819 // folders are named like //Folders/Tasks/what/EMCAL/name
1821 TString search(what) ;
1822 if ( what.CompareTo("Clusterizer") == 0 )
1823 search = "Reconstructioner" ;
1824 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
1825 search = "Reconstructioner" ;
1826 else if ( what.CompareTo("PID") == 0 )
1827 search = "Reconstructioner" ;
1828 else if ( what.CompareTo("QATasks") == 0 )
1831 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
1834 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
1838 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1840 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
1844 TList * list = emcalT->GetListOfTasks() ;
1846 if (what.CompareTo("SDigitizer") == 0) {
1847 if ( name.IsNull() )
1848 name = fSDigitsTitle ;
1849 } else if (what.CompareTo("Digitizer") == 0){
1850 if ( name.IsNull() )
1851 name = fDigitsTitle ;
1852 } else if (what.CompareTo("Clusterizer") == 0){
1853 if ( name.IsNull() )
1854 name = fRecPointsTitle ;
1855 name.Append(":clu") ;
1857 // else if (what.CompareTo("TrackSegmentMaker") == 0){
1858 // if ( name.IsNull() )
1859 // name = fTrackSegmentsTitle ;
1860 // name.Append(":tsm") ;
1862 // else if (what.CompareTo("PID") == 0){
1863 // if ( name.IsNull() )
1864 // name = fRecParticlesTitle ;
1865 // name.Append(":pid") ;
1867 // else if (what.CompareTo("QATasks") == 0){
1868 // if ( name.IsNull() )
1874 while((task = static_cast<TTask *>(it.Next()) )){
1875 TString taskname(task->GetName()) ;
1876 if(taskname.BeginsWith(name)){
1881 cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;