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")) ;
106 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
109 TFile * file = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
111 if(file == 0){ //if file was not opened yet, read gAlice
112 if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
113 file = TFile::Open(fHeaderFile.Data(),rw) ;
115 file = new TFile(fHeaderFile.Data(),rw) ;
117 if (!file->IsOpen()) {
118 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
122 gAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
127 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
132 cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ;
133 AliConfig * conf = AliConfig::Instance() ;
134 conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
135 conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
140 //____________________________________________________________________________
141 AliEMCALGetter::~AliEMCALGetter(){
145 //____________________________________________________________________________
146 void AliEMCALGetter::CreateWhiteBoard() const
151 //____________________________________________________________________________
152 AliEMCALGetter * AliEMCALGetter::GetInstance()
154 // Returns the pointer of the unique instance already defined
156 AliEMCALGetter * rv = 0 ;
160 cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
165 //____________________________________________________________________________
166 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
167 const char* branchTitle, const Option_t * rw)
169 // Creates and returns the pointer of the unique instance
170 // Must be called only when the environment has changed
173 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
174 (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
177 fgObjGetter->~AliEMCALGetter() ; // delete it if already exists another version
179 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
181 // Posts a few item to the white board (folders)
182 // fgObjGetter->CreateWhiteBoard() ;
188 //____________________________________________________________________________
189 const AliEMCALv1 * AliEMCALGetter::EMCAL()
191 // returns the EMCAL object
192 AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ;
195 cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
199 //____________________________________________________________________________
200 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
202 AliEMCALGeometry * rv = 0 ;
204 rv = EMCAL()->GetGeometry() ;
208 //____________________________________________________________________________
209 Bool_t AliEMCALGetter::PostHits(void) const
210 { //------- Hits ----------------------
212 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
214 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
215 if ( !emcalFolder ) {
217 cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
218 cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
220 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
222 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
223 hits->SetName("Hits") ;
224 emcalFolder->Add(hits) ;
229 //____________________________________________________________________________
230 TObject ** AliEMCALGetter::HitsRef(void) const
231 { //------- Hits ----------------------
234 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
235 if ( !fHitsFolder ) {
236 cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
240 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
241 if ( !emcalFolder ) {
242 cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
246 TObject * h = emcalFolder->FindObject("Hits") ;
248 cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
252 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
255 //____________________________________________________________________________
256 Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
257 { //---------- SDigits -------------------------
260 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
261 // because you can have sdigits from several hit files for mixing
263 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
264 if ( !emcalFolder ) {
266 cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
267 cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
269 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
271 TString subdir(headerFile) ;
272 subdir.ReplaceAll("/", "_") ;
273 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
274 if ( !emcalSubFolder )
275 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
277 TObject * sd = emcalSubFolder->FindObject(name);
280 cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
281 << " already exists!" << endl ;
283 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
284 sdigits->SetName(name) ;
285 emcalSubFolder->Add(sdigits) ;
290 //____________________________________________________________________________
291 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
292 { //------- SDigits ----------------------
294 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
296 if ( !fSDigitsFolder ) {
297 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
301 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
302 if ( !emcalFolder ) {
303 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
307 TFolder * emcalSubFolder = 0 ;
309 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
311 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
313 if(!emcalSubFolder) {
314 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
318 TObject * dis = emcalSubFolder->FindObject(name) ;
322 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
326 //____________________________________________________________________________
327 Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
328 { //---------- SDigitizer -------------------------
330 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
333 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
336 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
339 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
342 cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
343 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
345 emcal = new TTask("EMCAL", "") ;
348 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
351 cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
352 emcal->GetListOfTasks()->Remove(emcalsd) ;
354 emcal->Add(sdigitizer) ;
359 //____________________________________________________________________________
360 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
363 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
365 cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
369 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
371 cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
375 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
377 return emcal->GetListOfTasks()->GetObjectRef(task) ;
381 //____________________________________________________________________________
382 Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
383 { //---------- SDigitizer -------------------------
385 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
388 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
390 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
394 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
397 cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
398 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
400 emcal = new TTask("EMCAL", "") ;
404 TString sdname(name) ;
407 sdname.ReplaceAll("/","_") ;
408 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
410 emcalsd = new AliEMCALSDigitizer() ;
411 //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
412 emcalsd->SetName(sdname) ;
413 emcalsd->SetTitle(file) ;
414 emcal->Add(emcalsd) ;
420 //____________________________________________________________________________
421 Bool_t AliEMCALGetter::PostDigits(const char * name) const
422 { //---------- Digits -------------------------
424 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
426 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
428 if ( !emcalFolder ) {
430 cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
431 cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
433 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
436 TObject* dig = emcalFolder->FindObject( name ) ;
438 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
439 digits->SetName(name) ;
440 emcalFolder->Add(digits) ;
445 //____________________________________________________________________________
446 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
447 { //------- Digits ----------------------
449 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
451 if ( !fDigitsFolder ) {
452 cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
456 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
457 if ( !emcalFolder ) {
458 cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
462 TObject * d = emcalFolder->FindObject(name) ;
466 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
470 //____________________________________________________________________________
471 Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
472 { //---------- Digitizer -------------------------
474 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
477 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
480 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
483 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
484 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
486 emcal = new TTask("EMCAL", "") ;
490 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
493 emcal->GetListOfTasks()->Remove(emcald) ;
495 emcal->Add(digitizer) ;
499 //____________________________________________________________________________
500 Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
501 { //---------- Digitizer -------------------------
503 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
505 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
507 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
511 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
514 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
515 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
517 emcal = new TTask("EMCAL", "") ;
521 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
523 emcald = new AliEMCALDigitizer() ;
524 emcald->SetName(fDigitsTitle) ;
525 emcald->SetTitle(fHeaderFile) ;
531 //____________________________________________________________________________
532 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
534 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
536 cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
540 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
542 cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
546 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
548 return emcal->GetListOfTasks()->GetObjectRef(task) ;
552 //____________________________________________________________________________
553 Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
554 { // -------------- RecPoints -------------------------------------------
556 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
557 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
559 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
561 if ( !emcalFolder ) {
563 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
564 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
566 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
570 TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ;
571 if ( !emcalRPoTowerFolder ) {
573 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
574 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl;
576 emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ;
579 TObject * erp = emcalFolder->FindObject( name ) ;
581 TObjArray * towerrp = new TObjArray(100) ;
582 towerrp->SetName(name) ;
583 emcalRPoTowerFolder->Add(towerrp) ;
586 // Pre Shower RecPoints
587 TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ;
588 if ( !emcalRPoPreShoFolder ) {
590 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl;
591 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
593 emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ;
596 TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
598 TObjArray * preshorp = new TObjArray(100) ;
599 preshorp->SetName(name) ;
600 emcalRPoPreShoFolder->Add(preshorp) ;
605 //____________________________________________________________________________
606 TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const
607 { // -------------- RecPoints -------------------------------------------
609 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
611 if ( !fRecoFolder ) {
612 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
616 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
617 if ( !towerFolder ) {
618 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
623 TObject * trp = towerFolder->FindObject(name ) ;
627 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
631 //____________________________________________________________________________
632 TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const
633 { // -------------- RecPoints -------------------------------------------
635 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
637 if ( !fRecoFolder ) {
638 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
642 TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
643 if ( !preshoFolder ) {
644 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
648 TObject * prp = preshoFolder->FindObject(name ) ;
652 return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
656 //____________________________________________________________________________
657 Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const
658 { // ------------------ AliEMCALClusterizer ------------------------
660 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
662 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
665 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
669 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
672 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
673 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
675 emcal = new TTask("EMCAL", "") ;
679 AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
682 cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
684 emcal->GetListOfTasks()->Remove(emcalcl) ;
690 //____________________________________________________________________________
691 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
692 { // ------------------ AliEMCALClusterizer ------------------------
694 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
697 cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
701 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
703 cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
707 TList * l = emcal->GetListOfTasks() ;
711 TString cluname(name) ;
713 while((task = static_cast<TTask *>(it.Next()) )){
714 TString taskname(task->GetName()) ;
715 if(taskname.BeginsWith(cluname)){
722 return l->GetObjectRef(clu) ;
727 //____________________________________________________________________________
728 Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
729 { // ------------------ AliEMCALClusterizer ------------------------
731 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
733 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
736 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl;
740 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
743 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
744 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
746 emcal = new TTask("EMCAL", "") ;
750 AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
753 emcalcl->SetName(clun) ;
754 emcal->Add(emcalcl) ;
759 //____________________________________________________________________________
760 /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
761 { // ---------------TrackSegments -----------------------------------
763 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
765 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
767 if ( !emcalFolder ) {
769 cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
770 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl;
772 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
775 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
776 if ( !emcalTSFolder ) {
778 cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
779 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl;
781 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
784 TObject * tss = emcalTSFolder->FindObject( name ) ;
786 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
788 emcalTSFolder->Add(ts) ;
793 //____________________________________________________________________________
794 TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
795 { // ---------------TrackSegments -----------------------------------
797 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
799 if ( !fRecoFolder ) {
800 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
804 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
805 if ( !emcalFolder ) {
806 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
810 TObject * tss = emcalFolder->FindObject(name) ;
814 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
817 //____________________________________________________________________________
818 Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
819 { //------------Track Segment Maker ------------------------------
821 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
823 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
826 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
830 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
833 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
834 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
836 emcal = new TTask("EMCAL", "") ;
840 AliEMCALTrackSegmentMaker * emcalts =
841 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
844 emcal->GetListOfTasks()->Remove(emcalts) ;
846 emcal->Add(tsmaker) ;
850 //____________________________________________________________________________
851 Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
852 { //------------Track Segment Maker ------------------------------
854 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
857 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
860 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
864 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
867 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
868 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
870 emcal = new TTask("EMCAL", "") ;
874 AliEMCALTrackSegmentMaker * emcalts =
875 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ;
877 emcalts = new AliEMCALTrackSegmentMakerv1() ;
880 emcalts->SetName(tsn) ;
881 emcal->Add(emcalts) ;
887 //____________________________________________________________________________
888 TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
889 { //------------Track Segment Maker ------------------------------
891 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
894 cerr << "ERROR: AliEMCALGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
898 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
900 cerr <<"WARNING: AliEMCALGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
904 TList * l = emcal->GetListOfTasks() ;
908 TString tsmname(name) ;
910 while((task = static_cast<TTask *>(it.Next()) )){
911 TString taskname(task->GetName()) ;
912 if(taskname.BeginsWith(tsmname)){
919 return l->GetObjectRef(tsm) ;
925 //____________________________________________________________________________
926 Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
927 { // -------------------- RecParticles ------------------------
929 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
931 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
933 if ( !emcalFolder ) {
935 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
936 cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
938 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
941 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
942 if ( !emcalRPaFolder ) {
944 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
945 cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl;
947 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
950 TObject * rps = emcalRPaFolder->FindObject( name ) ;
952 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
954 emcalRPaFolder->Add(rp) ;
959 //____________________________________________________________________________
960 TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
961 { // ---------------TrackSegments -----------------------------------
963 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
965 if ( !fRecoFolder ) {
966 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
970 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
971 if ( !emcalFolder ) {
972 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
976 TObject * tss = emcalFolder->FindObject(name ) ;
980 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
983 //____________________________________________________________________________
984 Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
985 { // ------------AliEMCAL PID -----------------------------
987 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
990 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
994 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
997 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
998 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1000 emcal = new TTask("EMCAL", "") ;
1004 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1007 cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName()
1008 << " already exists" << endl ;
1009 emcal->GetListOfTasks()->Remove(emcalpid) ;
1016 //____________________________________________________________________________
1017 Bool_t AliEMCALGetter::PostPID(const char * name) const
1019 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1021 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1024 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1028 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1031 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1032 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1034 emcal = new TTask("EMCAL", "") ;
1038 TList * l = emcal->GetListOfTasks() ;
1040 TString pidname(name) ;
1043 while((task = static_cast<TTask *>(it.Next()) )){
1044 TString taskname(task->GetName()) ;
1045 if(taskname.BeginsWith(pidname))
1049 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1051 emcalpid->SetName(pidname) ;
1052 emcal->Add(emcalpid) ;
1057 //____________________________________________________________________________
1058 TObject ** AliEMCALGetter::PIDRef(const char * name) const
1059 { //------------PID ------------------------------
1061 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1064 cerr << "ERROR: AliEMCALGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1068 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1070 cerr <<"WARNING: AliEMCALGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
1074 TList * l = emcal->GetListOfTasks() ;
1078 TString pidname(name) ;
1080 while((task = static_cast<TTask *>(it.Next()) )){
1081 TString taskname(task->GetName()) ;
1082 if(taskname.BeginsWith(pidname)){
1089 return l->GetObjectRef(pid) ;
1095 //____________________________________________________________________________
1096 Bool_t AliEMCALGetter::PostQA(void) const
1097 { // ------------------ QA ---------------------------------
1099 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
1101 TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ;
1102 if ( !emcalFolder ) {
1104 cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1105 cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl;
1107 emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ;
1113 //____________________________________________________________________________
1114 TObject ** AliEMCALGetter::AlarmsRef(void) const
1115 { //------- Alarms ----------------------
1118 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL
1120 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl;
1124 TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1125 if ( !emcalFolder ) {
1126 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1130 return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
1133 //____________________________________________________________________________
1134 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1136 // Return primary particle numbered by <index>
1141 Int_t primaryIndex = index % 10000000 ;
1142 Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ;
1144 if ( primaryList > 0 ) {
1146 cout << " Getter does not support currently Mixing of primary " << endl ;
1147 cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
1152 return gAlice->Particle(primaryIndex) ;
1156 //____________________________________________________________________________
1157 void AliEMCALGetter::ReadTreeD()
1159 // Read the digit tree gAlice->TreeD()
1160 if(gAlice->TreeD()== 0){
1161 cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ;
1165 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
1167 TBranch * branch = 0 ;
1168 TBranch * digitsbranch = 0 ;
1169 TBranch * digitizerbranch = 0 ;
1170 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1172 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1173 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1174 digitsbranch = branch ;
1175 emcalfound = kTRUE ;
1177 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1178 digitizerbranch = branch ;
1179 digitizerfound = kTRUE ;
1183 if ( !emcalfound || !digitizerfound ) {
1185 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
1186 << fDigitsTitle << endl ;
1191 if(!Digits(fDigitsTitle) )
1192 PostDigits(fDigitsTitle);
1193 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1194 digitsbranch->GetEntry(0) ;
1197 // read the Digitizer
1198 if(!Digitizer(fDigitsTitle))
1199 PostDigitizer(fDigitsTitle) ;
1200 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1201 digitizerbranch->GetEntry(0) ;
1206 //____________________________________________________________________________
1207 void AliEMCALGetter::ReadTreeH()
1209 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1211 if(gAlice->TreeH()== 0){
1212 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1216 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1217 if ( !hitsbranch ) {
1219 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1225 if (hitsbranch->GetEntries() > 1 ) {
1226 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1227 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1228 hitsbranch->SetAddress(&tempo) ;
1231 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1232 hitsbranch->GetEntry(i) ;
1234 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1235 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1236 new((*hits)[index]) AliEMCALHit( *hit ) ;
1243 hitsbranch->SetAddress(HitsRef()) ;
1244 hitsbranch->GetEntry(0) ;
1248 //____________________________________________________________________________
1249 void AliEMCALGetter::Track(Int_t itrack)
1251 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1253 if(gAlice->TreeH()== 0){
1254 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1258 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1259 if ( !hitsbranch ) {
1261 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1266 hitsbranch->SetAddress(HitsRef()) ;
1267 hitsbranch->GetEntry(itrack) ;
1271 //____________________________________________________________________________
1272 // void AliEMCALGetter::ReadTreeQA()
1274 // Read the digit tree gAlice->TreeQA()
1275 // so far only EMCAL knows about this Tree
1277 // if(EMCAL()->TreeQA()== 0){
1278 // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ;
1282 // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ;
1285 // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ;
1292 // qabranch->SetAddress(AlarmsRef()) ;
1294 // qabranch->GetEntry(0) ;
1296 // PostQA("EMCAL") ;
1297 // TFolder * alarmsF = Alarms() ;
1298 // alarmsF->Clear() ;
1299 // qabranch->SetAddress(&alarmsF) ;
1300 // qabranch->GetEntry(0) ;
1304 //____________________________________________________________________________
1305 void AliEMCALGetter::ReadTreeR()
1307 // Read the reconstrunction tree gAlice->TreeR()
1309 if(gAlice->TreeR()== 0){
1310 cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ;
1315 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
1317 TBranch * branch = 0 ;
1318 TBranch * towerbranch = 0 ;
1319 TBranch * preshobranch = 0 ;
1320 TBranch * clusterizerbranch = 0 ;
1321 Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ;
1323 while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) )
1324 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
1325 if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
1326 towerbranch = branch ;
1327 emcaltowerrpfound = kTRUE ;
1329 else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
1330 preshobranch = branch ;
1331 emcalpreshorpfound = kTRUE ;
1333 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1334 clusterizerbranch = branch ;
1335 clusterizerfound = kTRUE ;
1339 if ( !emcaltowerrpfound ) {
1341 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title "
1342 << fRecPointsTitle << endl ;
1345 if ( !emcalpreshorpfound ) {
1347 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title "
1348 << fRecPointsTitle << endl ;
1351 if ( !clusterizerfound ) {
1353 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title "
1354 << fRecPointsTitle << endl ;
1358 // Read and Post the RecPoints
1359 if(!TowerRecPoints(fRecPointsTitle) )
1360 PostRecPoints(fRecPointsTitle) ;
1361 towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
1362 towerbranch->GetEntry(0) ;
1364 preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ;
1365 preshobranch->GetEntry(0) ;
1367 if(!Clusterizer(fRecPointsTitle) )
1368 PostClusterizer(fRecPointsTitle) ;
1369 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1370 clusterizerbranch->GetEntry(0) ;
1373 //------------------- TrackSegments ---------------------
1375 // TBranch * tsbranch = 0 ;
1376 // TBranch * tsmakerbranch = 0 ;
1377 // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1379 // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) )
1380 // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
1381 // if ( strcmp(branch->GetName(), "EMCALTS")==0){
1382 // tsbranch = branch ;
1383 // emcaltsfound = kTRUE ;
1385 // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1386 // tsmakerbranch = branch ;
1387 // tsmakerfound = kTRUE ;
1391 // if ( !emcaltsfound || !tsmakerfound ) {
1393 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
1394 // << fTrackSegmentsTitle << endl ;
1398 // // Read and Post the TrackSegments
1399 // if(!TrackSegments(fTrackSegmentsTitle))
1400 // PostTrackSegments(fTrackSegmentsTitle) ;
1401 // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1402 // tsbranch->GetEntry(0) ;
1404 // // Read and Post the TrackSegment Maker
1405 // if(!TrackSegmentMaker(fTrackSegmentsTitle))
1406 // PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1407 // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
1408 // tsmakerbranch->GetEntry(0) ;
1411 // //------------ RecParticles ----------------------------
1413 // TBranch * rpabranch = 0 ;
1414 // TBranch * pidbranch = 0 ;
1415 // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
1417 // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
1418 // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1419 // if ( strcmp(branch->GetName(), "EMCALRP")==0) {
1420 // rpabranch = branch ;
1421 // emcalrpafound = kTRUE ;
1423 // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
1424 // pidbranch = branch ;
1425 // pidfound = kTRUE ;
1429 // if ( !emcalrpafound || !pidfound ) {
1431 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
1432 // << fRecParticlesTitle << endl ;
1436 // // Read and Post the RecParticles
1437 // if(!RecParticles(fRecParticlesTitle))
1438 // PostRecParticles(fRecParticlesTitle) ;
1439 // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1440 // rpabranch->GetEntry(0) ;
1442 // // Read and Post the PID
1443 // if(!PID(fRecParticlesTitle))
1444 // PostPID(fRecParticlesTitle) ;
1445 // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
1446 // pidbranch->GetEntry(0) ;
1451 //____________________________________________________________________________
1452 void AliEMCALGetter::ReadTreeS(Int_t event)
1454 // Read the summable digits tree gAlice->TreeS()
1456 // loop over all opened files and read their SDigits to the White Board
1457 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
1459 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1460 TCollection * folderslist = emcalF->GetListOfFolders() ;
1462 //Add current file to list if it is not there yet
1464 TString subdir(fHeaderFile) ;
1465 subdir.ReplaceAll("/","_") ;
1467 if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){
1468 emcalF->AddFolder(subdir, "");
1471 TIter next(folderslist) ;
1472 TFolder * folder = 0 ;
1475 while ( (folder = static_cast<TFolder*>(next())) ) {
1476 TString fileName(folder->GetName()) ;
1477 fileName.ReplaceAll("_","/") ;
1478 if(fHeaderFile.CompareTo(fileName) == 0 )
1479 treeS=gAlice->TreeS() ;
1481 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1484 // Get SDigits Tree header from file
1485 TString treeName("TreeS") ;
1487 treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
1490 cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl;
1494 //set address of the SDigits and SDigitizer
1495 TBranch * sdigitsBranch = 0;
1496 TBranch * sdigitizerBranch = 0;
1497 TBranch * branch = 0 ;
1498 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
1500 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1502 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
1503 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1504 emcalfound = kTRUE ;
1505 sdigitsBranch = branch ;
1508 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1509 sdigitizerfound = kTRUE ;
1510 sdigitizerBranch = branch ;
1513 if ( !emcalfound || !sdigitizerfound ) {
1515 cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
1516 << " not found" << endl ;
1520 if ( !folder->FindObject(fSDigitsTitle) )
1521 PostSDigits(fSDigitsTitle,folder->GetName()) ;
1522 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
1523 sdigitsBranch->GetEntry(0) ;
1525 TString sdname(fSDigitsTitle) ;
1527 sdname+=folder->GetName() ;
1528 if(!SDigitizer(sdname) )
1529 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
1530 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1531 sdigitizerBranch->GetEntry(0) ;
1535 // After SDigits have been read from all files, return to the first one
1538 folder = static_cast<TFolder*>(next());
1540 TString fileName(folder->GetName()) ;
1541 fileName.ReplaceAll("_","/") ;
1542 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1547 //____________________________________________________________________________
1548 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
1549 { // Read the summable digits fron treeS()
1552 TString filename("mergefile") ;
1555 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
1556 if ( !emcalFolder ) {
1557 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1559 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
1560 //set address of the SDigits and SDigitizer
1561 TBranch * sdigitsBranch = 0;
1562 TBranch * sdigitizerBranch = 0;
1563 TBranch * branch = 0 ;
1564 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
1566 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1568 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
1569 if ( strcmp(branch->GetName(), "EMCAL")==0) {
1570 emcalfound = kTRUE ;
1571 sdigitsBranch = branch ;
1574 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
1575 sdigitizerfound = kTRUE ;
1576 sdigitizerBranch = branch ;
1579 if ( !emcalfound || !sdigitizerfound ) {
1581 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
1585 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
1586 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
1588 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
1589 sdigitsBranch->GetEntry(0) ;
1591 TString sdname(sdigitsBranch->GetTitle()) ;
1594 if(!SDigitizer(sdigitsBranch->GetTitle()) )
1595 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
1597 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1598 sdigitizerBranch->GetEntry(0) ;
1603 //____________________________________________________________________________
1604 void AliEMCALGetter::ReadPrimaries()
1606 // Reads specific branches of primaries
1608 fNPrimaries = gAlice->GetNtrack();
1610 // //Check, is it necessary to open new files
1611 // TArrayI* events = fDigitizer->GetCurrentEvents() ;
1612 // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
1614 // for(input = 0; input < filenames->GetEntriesFast(); input++){
1616 // TObjString * filename = (TObjString *) filenames->At(input) ;
1618 // //Test, if this file already open
1619 // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
1621 // file = new TFile( filename->GetString()) ;
1624 // // Get Kine Tree from file
1625 // // char treeName[20];
1626 // // sprintf(treeName,"TreeK%d",events->At(input));
1627 // // TTree * treeK = (TTree*)gDirectory->Get(treeName);
1629 // // treeK->SetBranchAddress("Particles", &fParticleBuffer);
1631 // // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
1633 // // // Create the particle stack
1634 // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
1635 // // // Build the pointer list
1636 // // if(fParticleMap) { <----
1637 // // fParticleMap->Clear();
1638 // // fParticleMap->Expand(treeK->GetEntries());
1640 // // fParticleMap = new TObjArray(treeK->GetEntries());
1642 // // From gAlice->Particle(i)
1645 // // if(!(*fParticleMap)[i]) {
1646 // // Int_t nentries = fParticles->GetEntries();
1648 // // // algorithmic way of getting entry index
1649 // // // (primary particles are filled after secondaries)
1651 // // if (i<fHeader.GetNprimary())
1652 // // entry = i+fHeader.GetNsecondary();
1654 // // entry = i-fHeader.GetNprimary();
1656 // // // only check the algorithmic way and give
1657 // // // the fatal error if it is wrong
1658 // // if (entry != fParticleFileMap[i]) {
1659 // // Fatal("Particle",
1660 // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
1661 // // entry, fParticleFileMap[i]);
1664 // // fTreeK->GetEntry(fParticleFileMap[i]);
1665 // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
1666 // // fParticleMap->AddAt((*fParticles)[nentries],i);
1668 // // return (TParticle *) (*fParticleMap)[i];
1675 // //scan over opened files and read corresponding TreeK##
1679 //____________________________________________________________________________
1680 void AliEMCALGetter::Event(const Int_t event, const char* opt)
1682 // Reads the content of all Tree's S, D and R
1684 if (event >= gAlice->TreeE()->GetEntries() ) {
1685 cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
1688 gAlice->GetEvent(event) ;
1690 if(strstr(opt,"H") )
1693 if(strstr(opt,"S") )
1696 if( strstr(opt,"D") )
1699 if( strstr(opt,"R") )
1702 // if( strstr(opt,"Q") )
1705 // if( strstr(opt,"P") || (strcmp(opt,"")==0) )
1706 // ReadPrimaries() ;
1710 //____________________________________________________________________________
1711 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
1713 // get the object named "what" from the folder
1714 // folders are named like //Folders
1716 if ( file.IsNull() )
1717 file = fHeaderFile ;
1719 TFolder * folder = 0 ;
1720 TObject * emcalO = 0 ;
1722 // if ( name.IsNull() ) {
1723 if ( what.CompareTo("Hits") == 0 ) {
1724 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
1726 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
1728 else if ( what.CompareTo("SDigits") == 0 ) {
1729 file.ReplaceAll("/","_") ;
1730 TString path = "EMCAL/" + file ;
1731 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
1734 name = fSDigitsTitle ;
1735 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1738 else if ( what.CompareTo("Digits") == 0 ){
1739 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
1742 name = fDigitsTitle ;
1743 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1746 else if ( what.CompareTo("TowerRecPoints") == 0 ) {
1747 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
1750 name = fRecPointsTitle ;
1751 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1754 else if ( what.CompareTo("PreShoRecPoints") == 0 ) {
1755 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
1758 name = fRecPointsTitle ;
1759 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1763 else if ( what.CompareTo("TrackSegments") == 0 ) {
1764 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
1767 name = fTrackSegmentsTitle ;
1768 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1771 else if ( what.CompareTo("RecParticles") == 0 ) {
1772 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1775 name = fRecParticlesTitle ;
1776 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1779 else if ( what.CompareTo("Alarms") == 0 ){
1781 emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ;
1783 folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1787 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1793 cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
1799 //____________________________________________________________________________
1800 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
1802 // get the TTask named "what" from the folder
1803 // folders are named like //Folders/Tasks/what/EMCAL/name
1805 TString search(what) ;
1806 if ( what.CompareTo("Clusterizer") == 0 )
1807 search = "Reconstructioner" ;
1808 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
1809 search = "Reconstructioner" ;
1810 else if ( what.CompareTo("PID") == 0 )
1811 search = "Reconstructioner" ;
1812 else if ( what.CompareTo("QATasks") == 0 )
1815 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
1818 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
1822 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1824 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
1828 TList * list = emcalT->GetListOfTasks() ;
1830 if (what.CompareTo("SDigitizer") == 0) {
1831 if ( name.IsNull() )
1832 name = fSDigitsTitle ;
1833 } else if (what.CompareTo("Digitizer") == 0){
1834 if ( name.IsNull() )
1835 name = fDigitsTitle ;
1836 } else if (what.CompareTo("Clusterizer") == 0){
1837 if ( name.IsNull() )
1838 name = fRecPointsTitle ;
1839 name.Append(":clu") ;
1841 // else if (what.CompareTo("TrackSegmentMaker") == 0){
1842 // if ( name.IsNull() )
1843 // name = fTrackSegmentsTitle ;
1844 // name.Append(":tsm") ;
1846 // else if (what.CompareTo("PID") == 0){
1847 // if ( name.IsNull() )
1848 // name = fRecParticlesTitle ;
1849 // name.Append(":pid") ;
1851 // else if (what.CompareTo("QATasks") == 0){
1852 // if ( name.IsNull() )
1858 while((task = static_cast<TTask *>(it.Next()) )){
1859 TString taskname(task->GetName()) ;
1860 if(taskname.BeginsWith(name)){
1865 cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;