1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 29.05.2001 Yuri Kharlov:
20 Everywhere reading the treese TTree->GetEvent(i)
21 is replaced by reading the branches TBranch->GetEntry(0)
24 //_________________________________________________________________________
25 // A singleton. This class should be used in the analysis stage to get
26 // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
27 // instead of directly reading them from galice.root file. This container
28 // ensures, that one reads Digits, made of these particular digits, RecPoints,
29 // made of these particular RecPoints, TrackSegments and RecParticles.
30 // This becomes non trivial if there are several identical branches, produced with
31 // different set of parameters.
33 // An example of how to use (see also class AliEMCALAnalyser):
34 // AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ;
35 // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
36 // AliEMCALRecParticle * part = gime->RecParticle(1) ;
38 // please->GetEvent(event) ; // reads new event from galice.root
40 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
41 //*-- Completely redesigned by Dmitri Peressounko March 2001
43 //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
44 //*-- systematic usage of TFolders without changing the interface
45 //////////////////////////////////////////////////////////////////////////////
48 // --- ROOT system ---
53 #include "TObjString.h"
56 // --- Standard library ---
59 // --- AliRoot header files ---
62 #include "AliConfig.h"
63 #include "AliEMCALGetter.h"
64 #include "AliEMCALHit.h"
65 #include "AliEMCALv1.h"
66 #include "AliEMCALDigitizer.h"
67 #include "AliEMCALSDigitizer.h"
68 #include "AliEMCALClusterizer.h"
69 #include "AliEMCALClusterizerv1.h"
70 //#include "AliEMCALTrackSegmentMaker.h"
71 //#include "AliEMCALTrackSegmentMakerv1.h"
72 //#include "AliEMCALTrackSegment.h"
73 //#include "AliEMCALPID.h"
74 //#include "AliEMCALPIDv1.h"
75 #include "AliEMCALGeometry.h"
77 ClassImp(AliEMCALGetter)
79 AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ;
81 //____________________________________________________________________________
82 AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Option_t * rw)
84 //Initialize all lists
86 fHeaderFile = headerFile ;
87 fBranchTitle = branchTitle ;
88 fSDigitsTitle = branchTitle ;
89 fDigitsTitle = branchTitle ;
90 fRecPointsTitle = branchTitle ;
91 //fRecParticlesTitle = branchTitle ;
92 //fTrackSegmentsTitle = branchTitle ;
94 fPrimaries = new TObjArray(1) ;
96 fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules"));
97 fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits"));
98 fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits"));
99 fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data"));
100 fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData"));
101 //fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA"));
102 fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ;
104 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
107 TFile * file = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
109 if(file == 0){ //if file was not opened yet, read gAlice
110 if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
111 file = TFile::Open(fHeaderFile.Data(),rw) ;
113 file = new TFile(fHeaderFile.Data(),rw) ;
115 if (!file->IsOpen()) {
116 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
120 gAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
125 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
130 cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ;
131 AliConfig * conf = AliConfig::Instance() ;
132 conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
133 conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
138 //____________________________________________________________________________
139 AliEMCALGetter::~AliEMCALGetter(){
143 //____________________________________________________________________________
144 void AliEMCALGetter::CreateWhiteBoard() const
149 //____________________________________________________________________________
150 AliEMCALGetter * AliEMCALGetter::GetInstance()
152 // Returns the pointer of the unique instance already defined
154 AliEMCALGetter * rv = 0 ;
158 cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
163 //____________________________________________________________________________
164 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
165 const char* branchTitle, const Option_t * rw)
167 // Creates and returns the pointer of the unique instance
168 // Must be called only when the environment has changed
171 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
172 (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
175 fgObjGetter->~AliEMCALGetter() ; // delete it if already exists another version
177 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
179 // Posts a few item to the white board (folders)
180 // fgObjGetter->CreateWhiteBoard() ;
186 //____________________________________________________________________________
187 const AliEMCALv1 * AliEMCALGetter::EMCAL()
189 // returns the EMCAL object
190 AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ;
193 cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
197 //____________________________________________________________________________
198 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
200 AliEMCALGeometry * rv = 0 ;
202 rv = EMCAL()->GetGeometry() ;
206 //____________________________________________________________________________
207 Bool_t AliEMCALGetter::PostHits(void) const
208 { //------- Hits ----------------------
210 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
212 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
213 if ( !emcalFolder ) {
215 cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
216 cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
218 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
220 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
221 hits->SetName("Hits") ;
222 emcalFolder->Add(hits) ;
227 //____________________________________________________________________________
228 TObject ** AliEMCALGetter::HitsRef(void) const
229 { //------- Hits ----------------------
232 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
233 if ( !fHitsFolder ) {
234 cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
238 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
239 if ( !emcalFolder ) {
240 cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
244 TObject * h = emcalFolder->FindObject("Hits") ;
246 cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
250 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
253 //____________________________________________________________________________
254 Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
255 { //---------- SDigits -------------------------
258 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
259 // because you can have sdigits from several hit files for mixing
261 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
262 if ( !emcalFolder ) {
264 cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
265 cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
267 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
269 TString subdir(headerFile) ;
270 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
271 if ( !emcalSubFolder )
272 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
274 TObject * sd = emcalSubFolder->FindObject(name);
277 cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
278 << " already exists!" << endl ;
280 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
281 sdigits->SetName(name) ;
282 emcalSubFolder->Add(sdigits) ;
287 //____________________________________________________________________________
288 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
289 { //------- SDigits ----------------------
291 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
293 if ( !fSDigitsFolder ) {
294 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
298 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
299 if ( !emcalFolder ) {
300 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
304 TFolder * emcalSubFolder = 0 ;
306 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
308 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
310 if(!emcalSubFolder) {
311 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
315 TObject * dis = emcalSubFolder->FindObject(name) ;
319 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
323 //____________________________________________________________________________
324 Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
325 { //---------- SDigitizer -------------------------
327 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
330 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
333 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
336 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
339 cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
340 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
342 emcal = new TTask("EMCAL", "") ;
345 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
348 cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
349 emcal->GetListOfTasks()->Remove(emcalsd) ;
351 emcal->Add(sdigitizer) ;
356 //____________________________________________________________________________
357 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
360 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
362 cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
366 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
368 cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
372 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
374 return emcal->GetListOfTasks()->GetObjectRef(task) ;
378 //____________________________________________________________________________
379 Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
380 { //---------- SDigitizer -------------------------
382 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
385 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
387 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
391 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
394 cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
395 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
397 emcal = new TTask("EMCAL", "") ;
401 TString sdname(name) ;
404 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
406 emcalsd = new AliEMCALSDigitizer() ;
407 //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
408 emcalsd->SetName(sdname) ;
409 emcalsd->SetTitle(file) ;
410 emcal->Add(emcalsd) ;
416 //____________________________________________________________________________
417 Bool_t AliEMCALGetter::PostDigits(const char * name) const
418 { //---------- Digits -------------------------
420 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
422 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
424 if ( !emcalFolder ) {
426 cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
427 cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
429 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
432 TObject* dig = emcalFolder->FindObject( name ) ;
434 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
435 digits->SetName(name) ;
436 emcalFolder->Add(digits) ;
441 //____________________________________________________________________________
442 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
443 { //------- Digits ----------------------
445 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
447 if ( !fDigitsFolder ) {
448 cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
452 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
453 if ( !emcalFolder ) {
454 cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
458 TObject * d = emcalFolder->FindObject(name) ;
462 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
466 //____________________________________________________________________________
467 Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
468 { //---------- Digitizer -------------------------
470 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
473 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
476 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
479 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
480 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
482 emcal = new TTask("EMCAL", "") ;
486 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
489 emcal->GetListOfTasks()->Remove(emcald) ;
491 emcal->Add(digitizer) ;
495 //____________________________________________________________________________
496 Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
497 { //---------- Digitizer -------------------------
499 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
501 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
503 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
507 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
510 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
511 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
513 emcal = new TTask("EMCAL", "") ;
517 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
519 emcald = new AliEMCALDigitizer() ;
520 emcald->SetName(fDigitsTitle) ;
521 emcald->SetTitle(fHeaderFile) ;
527 //____________________________________________________________________________
528 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
530 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
532 cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
536 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
538 cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
542 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
544 return emcal->GetListOfTasks()->GetObjectRef(task) ;
548 //____________________________________________________________________________
549 Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
550 { // -------------- RecPoints -------------------------------------------
552 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
553 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
555 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
557 if ( !emcalFolder ) {
559 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
560 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
562 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
566 TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ;
567 if ( !emcalRPoTowerFolder ) {
569 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
570 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl;
572 emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ;
575 TObject * erp = emcalFolder->FindObject( name ) ;
577 TObjArray * towerrp = new TObjArray(100) ;
578 towerrp->SetName(name) ;
579 emcalRPoTowerFolder->Add(towerrp) ;
582 // Pre Shower RecPoints
583 TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ;
584 if ( !emcalRPoPreShoFolder ) {
586 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl;
587 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
589 emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ;
592 TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
594 TObjArray * preshorp = new TObjArray(100) ;
595 preshorp->SetName(name) ;
596 emcalRPoPreShoFolder->Add(preshorp) ;
601 //____________________________________________________________________________
602 TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const
603 { // -------------- RecPoints -------------------------------------------
605 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
607 if ( !fRecoFolder ) {
608 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
612 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
613 if ( !towerFolder ) {
614 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
619 TObject * trp = towerFolder->FindObject(name ) ;
623 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
627 //____________________________________________________________________________
628 TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const
629 { // -------------- RecPoints -------------------------------------------
631 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
633 if ( !fRecoFolder ) {
634 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
638 TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
639 if ( !preshoFolder ) {
640 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
644 TObject * prp = preshoFolder->FindObject(name ) ;
648 return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
652 //____________________________________________________________________________
653 Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizer * clu) const
654 { // ------------------ AliEMCALClusterizer ------------------------
656 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
658 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
661 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
665 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
668 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
669 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
671 emcal = new TTask("EMCAL", "") ;
675 AliEMCALClusterizer * emcalcl = dynamic_cast<AliEMCALClusterizer*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
678 cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
680 emcal->GetListOfTasks()->Remove(emcalcl) ;
686 //____________________________________________________________________________
687 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
688 { // ------------------ AliEMCALClusterizer ------------------------
690 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
693 cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
697 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
699 cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
703 TList * l = emcal->GetListOfTasks() ;
707 TString cluname(name) ;
709 while((task = static_cast<TTask *>(it.Next()) )){
710 TString taskname(task->GetName()) ;
711 if(taskname.BeginsWith(cluname)){
718 return l->GetObjectRef(clu) ;
723 //____________________________________________________________________________
724 Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
725 { // ------------------ AliEMCALClusterizer ------------------------
727 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
729 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
732 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl;
736 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
739 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
740 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
742 emcal = new TTask("EMCAL", "") ;
746 AliEMCALClusterizer * emcalcl = new AliEMCALClusterizerv1() ;
749 emcalcl->SetName(clun) ;
750 emcal->Add(emcalcl) ;
755 //____________________________________________________________________________
756 /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
757 { // ---------------TrackSegments -----------------------------------
759 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
761 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
763 if ( !emcalFolder ) {
765 cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
766 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl;
768 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
771 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
772 if ( !emcalTSFolder ) {
774 cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
775 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl;
777 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
780 TObject * tss = emcalTSFolder->FindObject( name ) ;
782 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
784 emcalTSFolder->Add(ts) ;
789 //____________________________________________________________________________
790 TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
791 { // ---------------TrackSegments -----------------------------------
793 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
795 if ( !fRecoFolder ) {
796 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
800 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
801 if ( !emcalFolder ) {
802 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
806 TObject * tss = emcalFolder->FindObject(name) ;
810 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
813 //____________________________________________________________________________
814 Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
815 { //------------Track Segment Maker ------------------------------
817 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
819 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
822 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
826 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
829 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
830 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
832 emcal = new TTask("EMCAL", "") ;
836 AliEMCALTrackSegmentMaker * emcalts =
837 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
840 emcal->GetListOfTasks()->Remove(emcalts) ;
842 emcal->Add(tsmaker) ;
846 //____________________________________________________________________________
847 Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
848 { //------------Track Segment Maker ------------------------------
850 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
853 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
856 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
860 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
863 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
864 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
866 emcal = new TTask("EMCAL", "") ;
870 AliEMCALTrackSegmentMaker * emcalts =
871 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ;
873 emcalts = new AliEMCALTrackSegmentMakerv1() ;
876 emcalts->SetName(tsn) ;
877 emcal->Add(emcalts) ;
883 //____________________________________________________________________________
884 TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
885 { //------------Track Segment Maker ------------------------------
887 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
890 cerr << "ERROR: AliEMCALGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
894 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
896 cerr <<"WARNING: AliEMCALGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
900 TList * l = emcal->GetListOfTasks() ;
904 TString tsmname(name) ;
906 while((task = static_cast<TTask *>(it.Next()) )){
907 TString taskname(task->GetName()) ;
908 if(taskname.BeginsWith(tsmname)){
915 return l->GetObjectRef(tsm) ;
921 //____________________________________________________________________________
922 Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
923 { // -------------------- RecParticles ------------------------
925 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
927 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
929 if ( !emcalFolder ) {
931 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
932 cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
934 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
937 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
938 if ( !emcalRPaFolder ) {
940 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
941 cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl;
943 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
946 TObject * rps = emcalRPaFolder->FindObject( name ) ;
948 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
950 emcalRPaFolder->Add(rp) ;
955 //____________________________________________________________________________
956 TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
957 { // ---------------TrackSegments -----------------------------------
959 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
961 if ( !fRecoFolder ) {
962 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
966 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
967 if ( !emcalFolder ) {
968 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
972 TObject * tss = emcalFolder->FindObject(name ) ;
976 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
979 //____________________________________________________________________________
980 Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
981 { // ------------AliEMCAL PID -----------------------------
983 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
986 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
990 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
993 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
994 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
996 emcal = new TTask("EMCAL", "") ;
1000 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1003 cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName()
1004 << " already exists" << endl ;
1005 emcal->GetListOfTasks()->Remove(emcalpid) ;
1012 //____________________________________________________________________________
1013 Bool_t AliEMCALGetter::PostPID(const char * name) const
1015 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1017 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1020 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1024 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1027 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1028 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1030 emcal = new TTask("EMCAL", "") ;
1034 TList * l = emcal->GetListOfTasks() ;
1036 TString pidname(name) ;
1039 while((task = static_cast<TTask *>(it.Next()) )){
1040 TString taskname(task->GetName()) ;
1041 if(taskname.BeginsWith(pidname))
1045 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1047 emcalpid->SetName(pidname) ;
1048 emcal->Add(emcalpid) ;
1053 //____________________________________________________________________________
1054 TObject ** AliEMCALGetter::PIDRef(const char * name) const
1055 { //------------PID ------------------------------
1057 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1060 cerr << "ERROR: AliEMCALGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1064 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1066 cerr <<"WARNING: AliEMCALGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
1070 TList * l = emcal->GetListOfTasks() ;
1074 TString pidname(name) ;
1076 while((task = static_cast<TTask *>(it.Next()) )){
1077 TString taskname(task->GetName()) ;
1078 if(taskname.BeginsWith(pidname)){
1085 return l->GetObjectRef(pid) ;
1091 //____________________________________________________________________________
1092 Bool_t AliEMCALGetter::PostQA(void) const
1093 { // ------------------ QA ---------------------------------
1095 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
1097 TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ;
1098 if ( !emcalFolder ) {
1100 cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1101 cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl;
1103 emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ;
1109 //____________________________________________________________________________
1110 TObject ** AliEMCALGetter::AlarmsRef(void) const
1111 { //------- Alarms ----------------------
1114 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL
1116 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl;
1120 TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1121 if ( !emcalFolder ) {
1122 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1126 return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
1129 //____________________________________________________________________________
1130 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1132 // Return primary particle numbered by <index>
1137 Int_t primaryIndex = index % 10000000 ;
1138 Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ;
1140 if ( primaryList > 0 ) {
1142 cout << " Getter does not support currently Mixing of primary " << endl ;
1143 cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
1148 return gAlice->Particle(primaryIndex) ;
1152 //____________________________________________________________________________
1153 void AliEMCALGetter::ReadTreeD()
1155 // Read the digit tree gAlice->TreeD()
1156 if(gAlice->TreeD()== 0){
1157 cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ;
1161 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
1163 TBranch * branch = 0 ;
1164 TBranch * digitsbranch = 0 ;
1165 TBranch * digitizerbranch = 0 ;
1166 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1168 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1169 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1170 digitsbranch = branch ;
1171 emcalfound = kTRUE ;
1173 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1174 digitizerbranch = branch ;
1175 digitizerfound = kTRUE ;
1179 if ( !emcalfound || !digitizerfound ) {
1181 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
1182 << fDigitsTitle << endl ;
1187 if(!Digits(fDigitsTitle) )
1188 PostDigits(fDigitsTitle);
1189 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1190 digitsbranch->GetEntry(0) ;
1193 // read the Digitizer
1194 if(!Digitizer(fDigitsTitle))
1195 PostDigitizer(fDigitsTitle) ;
1196 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1197 digitizerbranch->GetEntry(0) ;
1202 //____________________________________________________________________________
1203 void AliEMCALGetter::ReadTreeH()
1205 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1207 if(gAlice->TreeH()== 0){
1208 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1212 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1213 if ( !hitsbranch ) {
1215 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1221 if (hitsbranch->GetEntries() > 1 ) {
1222 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1223 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1224 hitsbranch->SetAddress(&tempo) ;
1227 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1228 hitsbranch->GetEntry(i) ;
1230 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1231 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1232 new((*hits)[index]) AliEMCALHit( *hit ) ;
1239 hitsbranch->SetAddress(HitsRef()) ;
1240 hitsbranch->GetEntry(0) ;
1244 //____________________________________________________________________________
1245 void AliEMCALGetter::Track(Int_t itrack)
1247 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1249 if(gAlice->TreeH()== 0){
1250 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1254 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1255 if ( !hitsbranch ) {
1257 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1262 hitsbranch->SetAddress(HitsRef()) ;
1263 hitsbranch->GetEntry(itrack) ;
1267 //____________________________________________________________________________
1268 // void AliEMCALGetter::ReadTreeQA()
1270 // Read the digit tree gAlice->TreeQA()
1271 // so far only EMCAL knows about this Tree
1273 // if(EMCAL()->TreeQA()== 0){
1274 // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ;
1278 // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ;
1281 // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ;
1288 // qabranch->SetAddress(AlarmsRef()) ;
1290 // qabranch->GetEntry(0) ;
1292 // PostQA("EMCAL") ;
1293 // TFolder * alarmsF = Alarms() ;
1294 // alarmsF->Clear() ;
1295 // qabranch->SetAddress(&alarmsF) ;
1296 // qabranch->GetEntry(0) ;
1300 //____________________________________________________________________________
1301 void AliEMCALGetter::ReadTreeR()
1303 // Read the reconstrunction tree gAlice->TreeR()
1305 if(gAlice->TreeR()== 0){
1306 cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ;
1311 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
1313 TBranch * branch = 0 ;
1314 TBranch * towerbranch = 0 ;
1315 TBranch * preshobranch = 0 ;
1316 TBranch * clusterizerbranch = 0 ;
1317 Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ;
1319 while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) )
1320 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
1321 if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
1322 towerbranch = branch ;
1323 emcaltowerrpfound = kTRUE ;
1325 else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
1326 preshobranch = branch ;
1327 emcalpreshorpfound = kTRUE ;
1329 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1330 clusterizerbranch = branch ;
1331 clusterizerfound = kTRUE ;
1335 if ( !emcaltowerrpfound ) {
1337 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title "
1338 << fRecPointsTitle << endl ;
1341 if ( !emcalpreshorpfound ) {
1343 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title "
1344 << fRecPointsTitle << endl ;
1347 if ( !clusterizerfound ) {
1349 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title "
1350 << fRecPointsTitle << endl ;
1354 // Read and Post the RecPoints
1355 if(!TowerRecPoints(fRecPointsTitle) )
1356 PostRecPoints(fRecPointsTitle) ;
1357 towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
1358 towerbranch->GetEntry(0) ;
1360 preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ;
1361 preshobranch->GetEntry(0) ;
1363 if(!Clusterizer(fRecPointsTitle) )
1364 PostClusterizer(fRecPointsTitle) ;
1365 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1366 clusterizerbranch->GetEntry(0) ;
1369 //------------------- TrackSegments ---------------------
1371 // TBranch * tsbranch = 0 ;
1372 // TBranch * tsmakerbranch = 0 ;
1373 // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1375 // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) )
1376 // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
1377 // if ( strcmp(branch->GetName(), "EMCALTS")==0){
1378 // tsbranch = branch ;
1379 // emcaltsfound = kTRUE ;
1381 // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1382 // tsmakerbranch = branch ;
1383 // tsmakerfound = kTRUE ;
1387 // if ( !emcaltsfound || !tsmakerfound ) {
1389 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
1390 // << fTrackSegmentsTitle << endl ;
1394 // // Read and Post the TrackSegments
1395 // if(!TrackSegments(fTrackSegmentsTitle))
1396 // PostTrackSegments(fTrackSegmentsTitle) ;
1397 // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1398 // tsbranch->GetEntry(0) ;
1400 // // Read and Post the TrackSegment Maker
1401 // if(!TrackSegmentMaker(fTrackSegmentsTitle))
1402 // PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1403 // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
1404 // tsmakerbranch->GetEntry(0) ;
1407 // //------------ RecParticles ----------------------------
1409 // TBranch * rpabranch = 0 ;
1410 // TBranch * pidbranch = 0 ;
1411 // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
1413 // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
1414 // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1415 // if ( strcmp(branch->GetName(), "EMCALRP")==0) {
1416 // rpabranch = branch ;
1417 // emcalrpafound = kTRUE ;
1419 // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
1420 // pidbranch = branch ;
1421 // pidfound = kTRUE ;
1425 // if ( !emcalrpafound || !pidfound ) {
1427 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
1428 // << fRecParticlesTitle << endl ;
1432 // // Read and Post the RecParticles
1433 // if(!RecParticles(fRecParticlesTitle))
1434 // PostRecParticles(fRecParticlesTitle) ;
1435 // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1436 // rpabranch->GetEntry(0) ;
1438 // // Read and Post the PID
1439 // if(!PID(fRecParticlesTitle))
1440 // PostPID(fRecParticlesTitle) ;
1441 // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
1442 // pidbranch->GetEntry(0) ;
1447 //____________________________________________________________________________
1448 void AliEMCALGetter::ReadTreeS(Int_t event)
1450 // Read the summable digits tree gAlice->TreeS()
1452 // loop over all opened files and read their SDigits to the White Board
1453 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
1455 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1456 TCollection * folderslist = emcalF->GetListOfFolders() ;
1458 //Add current file to list if it is not there yet
1459 if ( (fHeaderFile != "aliroot") && ( !folderslist->Contains(fHeaderFile) ) ){
1460 emcalF->AddFolder(fHeaderFile, "");
1463 TIter next(folderslist) ;
1464 TFolder * folder = 0 ;
1467 while ( (folder = static_cast<TFolder*>(next())) ) {
1468 if(fHeaderFile.CompareTo(folder->GetName()) == 0 )
1469 treeS=gAlice->TreeS() ;
1471 file = static_cast<TFile*>(gROOT->GetFile(folder->GetName()));
1474 // Get SDigits Tree header from file
1475 TString treeName("TreeS") ;
1477 treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
1480 cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl;
1484 //set address of the SDigits and SDigitizer
1485 TBranch * sdigitsBranch = 0;
1486 TBranch * sdigitizerBranch = 0;
1487 TBranch * branch = 0 ;
1488 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
1490 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1492 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
1493 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1494 emcalfound = kTRUE ;
1495 sdigitsBranch = branch ;
1498 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1499 sdigitizerfound = kTRUE ;
1500 sdigitizerBranch = branch ;
1503 if ( !emcalfound || !sdigitizerfound ) {
1505 cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
1506 << " not found" << endl ;
1510 if ( !folder->FindObject(fSDigitsTitle) )
1511 PostSDigits(fSDigitsTitle,folder->GetName()) ;
1512 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
1513 sdigitsBranch->GetEntry(0) ;
1515 TString sdname(fSDigitsTitle) ;
1517 sdname+=folder->GetName() ;
1518 if(!SDigitizer(sdname) )
1519 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
1520 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1521 sdigitizerBranch->GetEntry(0) ;
1525 // After SDigits have been read from all files, return to the first one
1528 folder = static_cast<TFolder*>(next());
1530 file = static_cast<TFile*>(gROOT->GetFile(folder->GetName()));
1535 //____________________________________________________________________________
1536 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
1537 { // Read the summable digits fron treeS()
1540 TString filename("mergefile") ;
1543 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
1544 if ( !emcalFolder ) {
1545 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1547 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
1548 //set address of the SDigits and SDigitizer
1549 TBranch * sdigitsBranch = 0;
1550 TBranch * sdigitizerBranch = 0;
1551 TBranch * branch = 0 ;
1552 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
1554 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1556 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
1557 if ( strcmp(branch->GetName(), "EMCAL")==0) {
1558 emcalfound = kTRUE ;
1559 sdigitsBranch = branch ;
1562 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
1563 sdigitizerfound = kTRUE ;
1564 sdigitizerBranch = branch ;
1567 if ( !emcalfound || !sdigitizerfound ) {
1569 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
1573 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
1574 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
1576 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
1577 sdigitsBranch->GetEntry(0) ;
1579 TString sdname(sdigitsBranch->GetTitle()) ;
1582 if(!SDigitizer(sdigitsBranch->GetTitle()) )
1583 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
1585 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1586 sdigitizerBranch->GetEntry(0) ;
1591 //____________________________________________________________________________
1592 void AliEMCALGetter::ReadPrimaries()
1594 // Reads specific branches of primaries
1596 fNPrimaries = gAlice->GetNtrack();
1598 // //Check, is it necessary to open new files
1599 // TArrayI* events = fDigitizer->GetCurrentEvents() ;
1600 // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
1602 // for(input = 0; input < filenames->GetEntriesFast(); input++){
1604 // TObjString * filename = (TObjString *) filenames->At(input) ;
1606 // //Test, if this file already open
1607 // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
1609 // file = new TFile( filename->GetString()) ;
1612 // // Get Kine Tree from file
1613 // // char treeName[20];
1614 // // sprintf(treeName,"TreeK%d",events->At(input));
1615 // // TTree * treeK = (TTree*)gDirectory->Get(treeName);
1617 // // treeK->SetBranchAddress("Particles", &fParticleBuffer);
1619 // // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
1621 // // // Create the particle stack
1622 // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
1623 // // // Build the pointer list
1624 // // if(fParticleMap) { <----
1625 // // fParticleMap->Clear();
1626 // // fParticleMap->Expand(treeK->GetEntries());
1628 // // fParticleMap = new TObjArray(treeK->GetEntries());
1630 // // From gAlice->Particle(i)
1633 // // if(!(*fParticleMap)[i]) {
1634 // // Int_t nentries = fParticles->GetEntries();
1636 // // // algorithmic way of getting entry index
1637 // // // (primary particles are filled after secondaries)
1639 // // if (i<fHeader.GetNprimary())
1640 // // entry = i+fHeader.GetNsecondary();
1642 // // entry = i-fHeader.GetNprimary();
1644 // // // only check the algorithmic way and give
1645 // // // the fatal error if it is wrong
1646 // // if (entry != fParticleFileMap[i]) {
1647 // // Fatal("Particle",
1648 // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
1649 // // entry, fParticleFileMap[i]);
1652 // // fTreeK->GetEntry(fParticleFileMap[i]);
1653 // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
1654 // // fParticleMap->AddAt((*fParticles)[nentries],i);
1656 // // return (TParticle *) (*fParticleMap)[i];
1663 // //scan over opened files and read corresponding TreeK##
1667 //____________________________________________________________________________
1668 void AliEMCALGetter::Event(const Int_t event, const char* opt)
1670 // Reads the content of all Tree's S, D and R
1672 if (event >= gAlice->TreeE()->GetEntries() ) {
1673 cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
1676 gAlice->GetEvent(event) ;
1678 if(strstr(opt,"H") )
1681 if(strstr(opt,"S") )
1684 if( strstr(opt,"D") )
1687 if( strstr(opt,"R") )
1690 // if( strstr(opt,"Q") )
1693 // if( strstr(opt,"P") || (strcmp(opt,"")==0) )
1694 // ReadPrimaries() ;
1698 //____________________________________________________________________________
1699 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
1701 // get the object named "what" from the folder
1702 // folders are named like //Folders
1704 if ( file.IsNull() )
1705 file = fHeaderFile ;
1707 TFolder * folder = 0 ;
1708 TObject * emcalO = 0 ;
1710 // if ( name.IsNull() ) {
1711 if ( what.CompareTo("Hits") == 0 ) {
1712 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
1714 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
1716 else if ( what.CompareTo("SDigits") == 0 ) {
1717 TString path = "EMCAL/" + file ;
1718 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
1721 name = fSDigitsTitle ;
1722 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1725 else if ( what.CompareTo("Digits") == 0 ){
1726 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
1729 name = fDigitsTitle ;
1730 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1733 else if ( what.CompareTo("TowerRecPoints") == 0 ) {
1734 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
1737 name = fRecPointsTitle ;
1738 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1741 else if ( what.CompareTo("PreShoRecPoints") == 0 ) {
1742 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
1745 name = fRecPointsTitle ;
1746 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1750 else if ( what.CompareTo("TrackSegments") == 0 ) {
1751 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
1754 name = fTrackSegmentsTitle ;
1755 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1758 else if ( what.CompareTo("RecParticles") == 0 ) {
1759 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1762 name = fRecParticlesTitle ;
1763 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1766 else if ( what.CompareTo("Alarms") == 0 ){
1768 emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ;
1770 folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1774 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1780 cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
1786 //____________________________________________________________________________
1787 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
1789 // get the TTask named "what" from the folder
1790 // folders are named like //Folders/Tasks/what/EMCAL/name
1792 TString search(what) ;
1793 if ( what.CompareTo("Clusterizer") == 0 )
1794 search = "Reconstructioner" ;
1795 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
1796 search = "Reconstructioner" ;
1797 else if ( what.CompareTo("PID") == 0 )
1798 search = "Reconstructioner" ;
1799 else if ( what.CompareTo("QATasks") == 0 )
1802 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
1805 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
1809 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1811 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
1815 TList * list = emcalT->GetListOfTasks() ;
1817 if (what.CompareTo("SDigitizer") == 0) {
1818 if ( name.IsNull() )
1819 name = fSDigitsTitle ;
1820 } else if (what.CompareTo("Digitizer") == 0){
1821 if ( name.IsNull() )
1822 name = fDigitsTitle ;
1823 } else if (what.CompareTo("Clusterizer") == 0){
1824 if ( name.IsNull() )
1825 name = fRecPointsTitle ;
1826 name.Append(":clu") ;
1828 // else if (what.CompareTo("TrackSegmentMaker") == 0){
1829 // if ( name.IsNull() )
1830 // name = fTrackSegmentsTitle ;
1831 // name.Append(":tsm") ;
1833 // else if (what.CompareTo("PID") == 0){
1834 // if ( name.IsNull() )
1835 // name = fRecParticlesTitle ;
1836 // name.Append(":pid") ;
1838 // else if (what.CompareTo("QATasks") == 0){
1839 // if ( name.IsNull() )
1845 while((task = static_cast<TTask *>(it.Next()) )){
1846 TString taskname(task->GetName()) ;
1847 if(taskname.BeginsWith(name))
1852 cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;