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(){
144 fPrimaries->Delete() ;
150 //____________________________________________________________________________
151 void AliEMCALGetter::CreateWhiteBoard() const
156 //____________________________________________________________________________
157 AliEMCALGetter * AliEMCALGetter::GetInstance()
159 // Returns the pointer of the unique instance already defined
161 AliEMCALGetter * rv = 0 ;
165 cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
170 //____________________________________________________________________________
171 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
172 const char* branchTitle, const Option_t * rw)
174 // Creates and returns the pointer of the unique instance
175 // Must be called only when the environment has changed
178 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
179 (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
182 fgObjGetter->~AliEMCALGetter() ; // delete it already exists another version
184 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
186 // Posts a few item to the white board (folders)
187 // fgObjGetter->CreateWhiteBoard() ;
193 //____________________________________________________________________________
194 const AliEMCALv1 * AliEMCALGetter::EMCAL()
196 // returns the EMCAL object
197 AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ;
200 cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
204 //____________________________________________________________________________
205 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
207 AliEMCALGeometry * rv = 0 ;
209 rv = EMCAL()->GetGeometry() ;
213 //____________________________________________________________________________
214 Bool_t AliEMCALGetter::PostHits(void) const
215 { //------- Hits ----------------------
217 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
219 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
220 if ( !emcalFolder ) {
222 cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
223 cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
225 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
227 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
228 hits->SetName("Hits") ;
229 emcalFolder->Add(hits) ;
234 //____________________________________________________________________________
235 TObject ** AliEMCALGetter::HitsRef(void) const
236 { //------- Hits ----------------------
239 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
240 if ( !fHitsFolder ) {
241 cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
245 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
246 if ( !emcalFolder ) {
247 cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
251 TObject * h = emcalFolder->FindObject("Hits") ;
253 cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
257 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
260 //____________________________________________________________________________
261 Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
262 { //---------- SDigits -------------------------
265 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
266 // because you can have sdigits from several hit files for mixing
268 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
269 if ( !emcalFolder ) {
271 cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
272 cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
274 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
276 TString subdir(headerFile) ;
277 subdir.ReplaceAll("/", "_") ;
278 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
279 if ( !emcalSubFolder )
280 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
282 TObject * sd = emcalSubFolder->FindObject(name);
285 cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
286 << " already exists!" << endl ;
288 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
289 sdigits->SetName(name) ;
290 emcalSubFolder->Add(sdigits) ;
295 //____________________________________________________________________________
296 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
297 { //------- SDigits ----------------------
299 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
301 if ( !fSDigitsFolder ) {
302 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
306 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
307 if ( !emcalFolder ) {
308 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
312 TFolder * emcalSubFolder = 0 ;
314 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
316 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
318 if(!emcalSubFolder) {
319 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
323 TObject * dis = emcalSubFolder->FindObject(name) ;
327 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
331 //____________________________________________________________________________
332 Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
333 { //---------- SDigitizer -------------------------
335 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
338 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
341 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
344 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
347 cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
348 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
350 emcal = new TTask("EMCAL", "") ;
353 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
356 cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
357 emcal->GetListOfTasks()->Remove(emcalsd) ;
359 emcal->Add(sdigitizer) ;
364 //____________________________________________________________________________
365 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
368 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
370 cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
374 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
376 cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
380 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
382 return emcal->GetListOfTasks()->GetObjectRef(task) ;
386 //____________________________________________________________________________
387 Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
388 { //---------- SDigitizer -------------------------
390 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
393 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
395 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
399 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
402 cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
403 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
405 emcal = new TTask("EMCAL", "") ;
409 TString sdname(name) ;
412 sdname.ReplaceAll("/","_") ;
413 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
415 emcalsd = new AliEMCALSDigitizer() ;
416 //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
417 emcalsd->SetName(sdname) ;
418 emcalsd->SetTitle(file) ;
419 emcal->Add(emcalsd) ;
425 //____________________________________________________________________________
426 Bool_t AliEMCALGetter::PostDigits(const char * name) const
427 { //---------- Digits -------------------------
429 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
431 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
433 if ( !emcalFolder ) {
435 cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
436 cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
438 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
441 TObject* dig = emcalFolder->FindObject( name ) ;
443 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
444 digits->SetName(name) ;
445 emcalFolder->Add(digits) ;
450 //____________________________________________________________________________
451 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
452 { //------- Digits ----------------------
454 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
456 if ( !fDigitsFolder ) {
457 cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
461 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
462 if ( !emcalFolder ) {
463 cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
467 TObject * d = emcalFolder->FindObject(name) ;
471 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
475 //____________________________________________________________________________
476 Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
477 { //---------- Digitizer -------------------------
479 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
482 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
485 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
488 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
489 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
491 emcal = new TTask("EMCAL", "") ;
495 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
498 emcal->GetListOfTasks()->Remove(emcald) ;
500 emcal->Add(digitizer) ;
504 //____________________________________________________________________________
505 Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
506 { //---------- Digitizer -------------------------
508 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
510 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
512 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
516 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
519 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
520 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
522 emcal = new TTask("EMCAL", "") ;
526 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
528 emcald = new AliEMCALDigitizer() ;
529 emcald->SetName(fDigitsTitle) ;
530 emcald->SetTitle(fHeaderFile) ;
536 //____________________________________________________________________________
537 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
539 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
541 cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
545 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
547 cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
551 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
553 return emcal->GetListOfTasks()->GetObjectRef(task) ;
557 //____________________________________________________________________________
558 Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
559 { // -------------- RecPoints -------------------------------------------
561 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
562 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
564 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
566 if ( !emcalFolder ) {
568 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
569 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
571 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
575 TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ;
576 if ( !emcalRPoTowerFolder ) {
578 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
579 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl;
581 emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ;
584 TObject * erp = emcalFolder->FindObject( name ) ;
586 TObjArray * towerrp = new TObjArray(100) ;
587 towerrp->SetName(name) ;
588 emcalRPoTowerFolder->Add(towerrp) ;
591 // Pre Shower RecPoints
592 TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ;
593 if ( !emcalRPoPreShoFolder ) {
595 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl;
596 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
598 emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ;
601 TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
603 TObjArray * preshorp = new TObjArray(100) ;
604 preshorp->SetName(name) ;
605 emcalRPoPreShoFolder->Add(preshorp) ;
610 //____________________________________________________________________________
611 TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const
612 { // -------------- RecPoints -------------------------------------------
614 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
616 if ( !fRecoFolder ) {
617 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
621 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
622 if ( !towerFolder ) {
623 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
628 TObject * trp = towerFolder->FindObject(name ) ;
632 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
636 //____________________________________________________________________________
637 TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const
638 { // -------------- RecPoints -------------------------------------------
640 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
642 if ( !fRecoFolder ) {
643 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
647 TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
648 if ( !preshoFolder ) {
649 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
653 TObject * prp = preshoFolder->FindObject(name ) ;
657 return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
661 //____________________________________________________________________________
662 Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const
663 { // ------------------ AliEMCALClusterizer ------------------------
665 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
667 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
670 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
674 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
677 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
678 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
680 emcal = new TTask("EMCAL", "") ;
684 AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
687 cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
689 emcal->GetListOfTasks()->Remove(emcalcl) ;
695 //____________________________________________________________________________
696 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
697 { // ------------------ AliEMCALClusterizer ------------------------
699 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
702 cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
706 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
708 cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
712 TList * l = emcal->GetListOfTasks() ;
716 TString cluname(name) ;
718 while((task = static_cast<TTask *>(it.Next()) )){
719 TString taskname(task->GetName()) ;
720 if(taskname.BeginsWith(cluname)){
727 return l->GetObjectRef(clu) ;
732 //____________________________________________________________________________
733 Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
734 { // ------------------ AliEMCALClusterizer ------------------------
736 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
738 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
741 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl;
745 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
748 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
749 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
751 emcal = new TTask("EMCAL", "") ;
755 AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
758 emcalcl->SetName(clun) ;
759 emcal->Add(emcalcl) ;
764 //____________________________________________________________________________
765 /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
766 { // ---------------TrackSegments -----------------------------------
768 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
770 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
772 if ( !emcalFolder ) {
774 cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
775 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl;
777 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
780 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
781 if ( !emcalTSFolder ) {
783 cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
784 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl;
786 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
789 TObject * tss = emcalTSFolder->FindObject( name ) ;
791 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
793 emcalTSFolder->Add(ts) ;
798 //____________________________________________________________________________
799 TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
800 { // ---------------TrackSegments -----------------------------------
802 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
804 if ( !fRecoFolder ) {
805 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
809 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
810 if ( !emcalFolder ) {
811 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
815 TObject * tss = emcalFolder->FindObject(name) ;
819 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
822 //____________________________________________________________________________
823 Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
824 { //------------Track Segment Maker ------------------------------
826 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
828 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
831 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
835 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
838 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
839 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
841 emcal = new TTask("EMCAL", "") ;
845 AliEMCALTrackSegmentMaker * emcalts =
846 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
849 emcal->GetListOfTasks()->Remove(emcalts) ;
851 emcal->Add(tsmaker) ;
855 //____________________________________________________________________________
856 Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
857 { //------------Track Segment Maker ------------------------------
859 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
862 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
865 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
869 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
872 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
873 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
875 emcal = new TTask("EMCAL", "") ;
879 AliEMCALTrackSegmentMaker * emcalts =
880 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ;
882 emcalts = new AliEMCALTrackSegmentMakerv1() ;
885 emcalts->SetName(tsn) ;
886 emcal->Add(emcalts) ;
892 //____________________________________________________________________________
893 TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
894 { //------------Track Segment Maker ------------------------------
896 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
899 cerr << "ERROR: AliEMCALGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
903 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
905 cerr <<"WARNING: AliEMCALGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
909 TList * l = emcal->GetListOfTasks() ;
913 TString tsmname(name) ;
915 while((task = static_cast<TTask *>(it.Next()) )){
916 TString taskname(task->GetName()) ;
917 if(taskname.BeginsWith(tsmname)){
924 return l->GetObjectRef(tsm) ;
930 //____________________________________________________________________________
931 Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
932 { // -------------------- RecParticles ------------------------
934 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
936 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
938 if ( !emcalFolder ) {
940 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
941 cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
943 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
946 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
947 if ( !emcalRPaFolder ) {
949 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
950 cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl;
952 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
955 TObject * rps = emcalRPaFolder->FindObject( name ) ;
957 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
959 emcalRPaFolder->Add(rp) ;
964 //____________________________________________________________________________
965 TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
966 { // ---------------TrackSegments -----------------------------------
968 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
970 if ( !fRecoFolder ) {
971 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
975 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
976 if ( !emcalFolder ) {
977 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
981 TObject * tss = emcalFolder->FindObject(name ) ;
985 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
988 //____________________________________________________________________________
989 Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
990 { // ------------AliEMCAL PID -----------------------------
992 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
995 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
999 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1002 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1003 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1005 emcal = new TTask("EMCAL", "") ;
1009 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1012 cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName()
1013 << " already exists" << endl ;
1014 emcal->GetListOfTasks()->Remove(emcalpid) ;
1021 //____________________________________________________________________________
1022 Bool_t AliEMCALGetter::PostPID(const char * name) const
1024 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1026 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1029 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1033 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1036 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1037 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1039 emcal = new TTask("EMCAL", "") ;
1043 TList * l = emcal->GetListOfTasks() ;
1045 TString pidname(name) ;
1048 while((task = static_cast<TTask *>(it.Next()) )){
1049 TString taskname(task->GetName()) ;
1050 if(taskname.BeginsWith(pidname))
1054 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1056 emcalpid->SetName(pidname) ;
1057 emcal->Add(emcalpid) ;
1062 //____________________________________________________________________________
1063 TObject ** AliEMCALGetter::PIDRef(const char * name) const
1064 { //------------PID ------------------------------
1066 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1069 cerr << "ERROR: AliEMCALGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1073 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1075 cerr <<"WARNING: AliEMCALGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
1079 TList * l = emcal->GetListOfTasks() ;
1083 TString pidname(name) ;
1085 while((task = static_cast<TTask *>(it.Next()) )){
1086 TString taskname(task->GetName()) ;
1087 if(taskname.BeginsWith(pidname)){
1094 return l->GetObjectRef(pid) ;
1100 //____________________________________________________________________________
1101 Bool_t AliEMCALGetter::PostQA(void) const
1102 { // ------------------ QA ---------------------------------
1104 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
1106 TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ;
1107 if ( !emcalFolder ) {
1109 cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1110 cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl;
1112 emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ;
1118 //____________________________________________________________________________
1119 TObject ** AliEMCALGetter::AlarmsRef(void) const
1120 { //------- Alarms ----------------------
1123 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL
1125 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl;
1129 TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1130 if ( !emcalFolder ) {
1131 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1135 return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
1138 //____________________________________________________________________________
1139 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1141 // Return primary particle numbered by <index>
1146 Int_t primaryIndex = index % 10000000 ;
1147 Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ;
1149 if ( primaryList > 0 ) {
1151 cout << " Getter does not support currently Mixing of primary " << endl ;
1152 cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
1157 return gAlice->Particle(primaryIndex) ;
1161 //____________________________________________________________________________
1162 void AliEMCALGetter::ReadTreeD()
1164 // Read the digit tree gAlice->TreeD()
1165 if(gAlice->TreeD()== 0){
1166 cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ;
1170 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
1172 TBranch * branch = 0 ;
1173 TBranch * digitsbranch = 0 ;
1174 TBranch * digitizerbranch = 0 ;
1175 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1177 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1178 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1179 digitsbranch = branch ;
1180 emcalfound = kTRUE ;
1182 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1183 digitizerbranch = branch ;
1184 digitizerfound = kTRUE ;
1188 if ( !emcalfound || !digitizerfound ) {
1190 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
1191 << fDigitsTitle << endl ;
1196 if(!Digits(fDigitsTitle) )
1197 PostDigits(fDigitsTitle);
1198 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1199 digitsbranch->GetEntry(0) ;
1202 // read the Digitizer
1203 if(!Digitizer(fDigitsTitle))
1204 PostDigitizer(fDigitsTitle) ;
1205 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1206 digitizerbranch->GetEntry(0) ;
1211 //____________________________________________________________________________
1212 void AliEMCALGetter::ReadTreeH()
1214 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1216 if(gAlice->TreeH()== 0){
1217 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1221 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1222 if ( !hitsbranch ) {
1224 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1230 if (hitsbranch->GetEntries() > 1 ) {
1231 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1232 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1233 hitsbranch->SetAddress(&tempo) ;
1236 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1237 hitsbranch->GetEntry(i) ;
1239 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1240 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1241 new((*hits)[index]) AliEMCALHit( *hit ) ;
1248 hitsbranch->SetAddress(HitsRef()) ;
1249 hitsbranch->GetEntry(0) ;
1253 //____________________________________________________________________________
1254 void AliEMCALGetter::Track(Int_t itrack)
1256 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1258 if(gAlice->TreeH()== 0){
1259 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1263 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1264 if ( !hitsbranch ) {
1266 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1271 hitsbranch->SetAddress(HitsRef()) ;
1272 hitsbranch->GetEntry(itrack) ;
1276 //____________________________________________________________________________
1277 // void AliEMCALGetter::ReadTreeQA()
1279 // Read the digit tree gAlice->TreeQA()
1280 // so far only EMCAL knows about this Tree
1282 // if(EMCAL()->TreeQA()== 0){
1283 // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ;
1287 // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ;
1290 // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ;
1297 // qabranch->SetAddress(AlarmsRef()) ;
1299 // qabranch->GetEntry(0) ;
1301 // PostQA("EMCAL") ;
1302 // TFolder * alarmsF = Alarms() ;
1303 // alarmsF->Clear() ;
1304 // qabranch->SetAddress(&alarmsF) ;
1305 // qabranch->GetEntry(0) ;
1309 //____________________________________________________________________________
1310 void AliEMCALGetter::ReadTreeR()
1312 // Read the reconstrunction tree gAlice->TreeR()
1314 if(gAlice->TreeR()== 0){
1315 cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ;
1320 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
1322 TBranch * branch = 0 ;
1323 TBranch * towerbranch = 0 ;
1324 TBranch * preshobranch = 0 ;
1325 TBranch * clusterizerbranch = 0 ;
1326 Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ;
1328 while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) )
1329 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
1330 if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
1331 towerbranch = branch ;
1332 emcaltowerrpfound = kTRUE ;
1334 else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
1335 preshobranch = branch ;
1336 emcalpreshorpfound = kTRUE ;
1338 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1339 clusterizerbranch = branch ;
1340 clusterizerfound = kTRUE ;
1344 if ( !emcaltowerrpfound ) {
1346 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title "
1347 << fRecPointsTitle << endl ;
1350 if ( !emcalpreshorpfound ) {
1352 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title "
1353 << fRecPointsTitle << endl ;
1356 if ( !clusterizerfound ) {
1358 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title "
1359 << fRecPointsTitle << endl ;
1363 // Read and Post the RecPoints
1364 if(!TowerRecPoints(fRecPointsTitle) )
1365 PostRecPoints(fRecPointsTitle) ;
1366 towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
1367 towerbranch->GetEntry(0) ;
1369 preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ;
1370 preshobranch->GetEntry(0) ;
1372 if(!Clusterizer(fRecPointsTitle) )
1373 PostClusterizer(fRecPointsTitle) ;
1374 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1375 clusterizerbranch->GetEntry(0) ;
1378 //------------------- TrackSegments ---------------------
1380 // TBranch * tsbranch = 0 ;
1381 // TBranch * tsmakerbranch = 0 ;
1382 // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1384 // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) )
1385 // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
1386 // if ( strcmp(branch->GetName(), "EMCALTS")==0){
1387 // tsbranch = branch ;
1388 // emcaltsfound = kTRUE ;
1390 // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1391 // tsmakerbranch = branch ;
1392 // tsmakerfound = kTRUE ;
1396 // if ( !emcaltsfound || !tsmakerfound ) {
1398 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
1399 // << fTrackSegmentsTitle << endl ;
1403 // // Read and Post the TrackSegments
1404 // if(!TrackSegments(fTrackSegmentsTitle))
1405 // PostTrackSegments(fTrackSegmentsTitle) ;
1406 // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1407 // tsbranch->GetEntry(0) ;
1409 // // Read and Post the TrackSegment Maker
1410 // if(!TrackSegmentMaker(fTrackSegmentsTitle))
1411 // PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1412 // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
1413 // tsmakerbranch->GetEntry(0) ;
1416 // //------------ RecParticles ----------------------------
1418 // TBranch * rpabranch = 0 ;
1419 // TBranch * pidbranch = 0 ;
1420 // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
1422 // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
1423 // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1424 // if ( strcmp(branch->GetName(), "EMCALRP")==0) {
1425 // rpabranch = branch ;
1426 // emcalrpafound = kTRUE ;
1428 // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
1429 // pidbranch = branch ;
1430 // pidfound = kTRUE ;
1434 // if ( !emcalrpafound || !pidfound ) {
1436 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
1437 // << fRecParticlesTitle << endl ;
1441 // // Read and Post the RecParticles
1442 // if(!RecParticles(fRecParticlesTitle))
1443 // PostRecParticles(fRecParticlesTitle) ;
1444 // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1445 // rpabranch->GetEntry(0) ;
1447 // // Read and Post the PID
1448 // if(!PID(fRecParticlesTitle))
1449 // PostPID(fRecParticlesTitle) ;
1450 // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
1451 // pidbranch->GetEntry(0) ;
1456 //____________________________________________________________________________
1457 void AliEMCALGetter::ReadTreeS(Int_t event)
1459 // Read the summable digits tree gAlice->TreeS()
1461 // loop over all opened files and read their SDigits to the White Board
1462 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
1464 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1465 TCollection * folderslist = emcalF->GetListOfFolders() ;
1467 //Add current file to list if it is not there yet
1469 TString subdir(fHeaderFile) ;
1470 subdir.ReplaceAll("/","_") ;
1472 if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){
1473 emcalF->AddFolder(subdir, "");
1476 TIter next(folderslist) ;
1477 TFolder * folder = 0 ;
1480 while ( (folder = static_cast<TFolder*>(next())) ) {
1481 TString fileName(folder->GetName()) ;
1482 fileName.ReplaceAll("_","/") ;
1483 if(fHeaderFile.CompareTo(fileName) == 0 )
1484 treeS=gAlice->TreeS() ;
1486 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1489 // Get SDigits Tree header from file
1490 TString treeName("TreeS") ;
1492 treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
1495 cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl;
1499 //set address of the SDigits and SDigitizer
1500 TBranch * sdigitsBranch = 0;
1501 TBranch * sdigitizerBranch = 0;
1502 TBranch * branch = 0 ;
1503 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
1505 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1507 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
1508 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1509 emcalfound = kTRUE ;
1510 sdigitsBranch = branch ;
1513 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1514 sdigitizerfound = kTRUE ;
1515 sdigitizerBranch = branch ;
1518 if ( !emcalfound || !sdigitizerfound ) {
1520 cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
1521 << " not found" << endl ;
1525 if ( !folder->FindObject(fSDigitsTitle) )
1526 PostSDigits(fSDigitsTitle,folder->GetName()) ;
1527 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
1528 sdigitsBranch->GetEntry(0) ;
1530 TString sdname(fSDigitsTitle) ;
1532 sdname+=folder->GetName() ;
1533 if(!SDigitizer(sdname) )
1534 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
1535 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1536 sdigitizerBranch->GetEntry(0) ;
1540 // After SDigits have been read from all files, return to the first one
1543 folder = static_cast<TFolder*>(next());
1545 TString fileName(folder->GetName()) ;
1546 fileName.ReplaceAll("_","/") ;
1547 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1552 //____________________________________________________________________________
1553 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
1554 { // Read the summable digits fron treeS()
1557 TString filename("mergefile") ;
1560 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
1561 if ( !emcalFolder ) {
1562 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1564 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
1565 //set address of the SDigits and SDigitizer
1566 TBranch * sdigitsBranch = 0;
1567 TBranch * sdigitizerBranch = 0;
1568 TBranch * branch = 0 ;
1569 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
1571 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1573 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
1574 if ( strcmp(branch->GetName(), "EMCAL")==0) {
1575 emcalfound = kTRUE ;
1576 sdigitsBranch = branch ;
1579 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
1580 sdigitizerfound = kTRUE ;
1581 sdigitizerBranch = branch ;
1584 if ( !emcalfound || !sdigitizerfound ) {
1586 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
1590 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
1591 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
1593 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
1594 sdigitsBranch->GetEntry(0) ;
1596 TString sdname(sdigitsBranch->GetTitle()) ;
1599 if(!SDigitizer(sdigitsBranch->GetTitle()) )
1600 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
1602 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1603 sdigitizerBranch->GetEntry(0) ;
1608 //____________________________________________________________________________
1609 void AliEMCALGetter::ReadPrimaries()
1611 // Reads specific branches of primaries
1613 fNPrimaries = gAlice->GetNtrack();
1615 // //Check, is it necessary to open new files
1616 // TArrayI* events = fDigitizer->GetCurrentEvents() ;
1617 // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
1619 // for(input = 0; input < filenames->GetEntriesFast(); input++){
1621 // TObjString * filename = (TObjString *) filenames->At(input) ;
1623 // //Test, if this file already open
1624 // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
1626 // file = new TFile( filename->GetString()) ;
1629 // // Get Kine Tree from file
1630 // // char treeName[20];
1631 // // sprintf(treeName,"TreeK%d",events->At(input));
1632 // // TTree * treeK = (TTree*)gDirectory->Get(treeName);
1634 // // treeK->SetBranchAddress("Particles", &fParticleBuffer);
1636 // // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
1638 // // // Create the particle stack
1639 // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
1640 // // // Build the pointer list
1641 // // if(fParticleMap) { <----
1642 // // fParticleMap->Clear();
1643 // // fParticleMap->Expand(treeK->GetEntries());
1645 // // fParticleMap = new TObjArray(treeK->GetEntries());
1647 // // From gAlice->Particle(i)
1650 // // if(!(*fParticleMap)[i]) {
1651 // // Int_t nentries = fParticles->GetEntries();
1653 // // // algorithmic way of getting entry index
1654 // // // (primary particles are filled after secondaries)
1656 // // if (i<fHeader.GetNprimary())
1657 // // entry = i+fHeader.GetNsecondary();
1659 // // entry = i-fHeader.GetNprimary();
1661 // // // only check the algorithmic way and give
1662 // // // the fatal error if it is wrong
1663 // // if (entry != fParticleFileMap[i]) {
1664 // // Fatal("Particle",
1665 // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
1666 // // entry, fParticleFileMap[i]);
1669 // // fTreeK->GetEntry(fParticleFileMap[i]);
1670 // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
1671 // // fParticleMap->AddAt((*fParticles)[nentries],i);
1673 // // return (TParticle *) (*fParticleMap)[i];
1680 // //scan over opened files and read corresponding TreeK##
1684 //____________________________________________________________________________
1685 void AliEMCALGetter::Event(const Int_t event, const char* opt)
1687 // Reads the content of all Tree's S, D and R
1689 if (event >= gAlice->TreeE()->GetEntries() ) {
1690 cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
1693 gAlice->GetEvent(event) ;
1695 if(strstr(opt,"H") )
1698 if(strstr(opt,"S") )
1701 if( strstr(opt,"D") )
1704 if( strstr(opt,"R") )
1707 // if( strstr(opt,"Q") )
1710 // if( strstr(opt,"P") || (strcmp(opt,"")==0) )
1711 // ReadPrimaries() ;
1715 //____________________________________________________________________________
1716 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
1718 // get the object named "what" from the folder
1719 // folders are named like //Folders
1721 if ( file.IsNull() )
1722 file = fHeaderFile ;
1724 TFolder * folder = 0 ;
1725 TObject * emcalO = 0 ;
1727 // if ( name.IsNull() ) {
1728 if ( what.CompareTo("Hits") == 0 ) {
1729 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
1731 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
1733 else if ( what.CompareTo("SDigits") == 0 ) {
1734 file.ReplaceAll("/","_") ;
1735 TString path = "EMCAL/" + file ;
1736 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
1739 name = fSDigitsTitle ;
1740 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1743 else if ( what.CompareTo("Digits") == 0 ){
1744 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
1747 name = fDigitsTitle ;
1748 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1751 else if ( what.CompareTo("TowerRecPoints") == 0 ) {
1752 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
1755 name = fRecPointsTitle ;
1756 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1759 else if ( what.CompareTo("PreShoRecPoints") == 0 ) {
1760 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
1763 name = fRecPointsTitle ;
1764 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1768 else if ( what.CompareTo("TrackSegments") == 0 ) {
1769 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
1772 name = fTrackSegmentsTitle ;
1773 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1776 else if ( what.CompareTo("RecParticles") == 0 ) {
1777 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1780 name = fRecParticlesTitle ;
1781 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1784 else if ( what.CompareTo("Alarms") == 0 ){
1786 emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ;
1788 folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1792 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1798 cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
1804 //____________________________________________________________________________
1805 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
1807 // get the TTask named "what" from the folder
1808 // folders are named like //Folders/Tasks/what/EMCAL/name
1810 TString search(what) ;
1811 if ( what.CompareTo("Clusterizer") == 0 )
1812 search = "Reconstructioner" ;
1813 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
1814 search = "Reconstructioner" ;
1815 else if ( what.CompareTo("PID") == 0 )
1816 search = "Reconstructioner" ;
1817 else if ( what.CompareTo("QATasks") == 0 )
1820 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
1823 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
1827 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1829 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
1833 TList * list = emcalT->GetListOfTasks() ;
1835 if (what.CompareTo("SDigitizer") == 0) {
1836 if ( name.IsNull() )
1837 name = fSDigitsTitle ;
1838 } else if (what.CompareTo("Digitizer") == 0){
1839 if ( name.IsNull() )
1840 name = fDigitsTitle ;
1841 } else if (what.CompareTo("Clusterizer") == 0){
1842 if ( name.IsNull() )
1843 name = fRecPointsTitle ;
1844 name.Append(":clu") ;
1846 // else if (what.CompareTo("TrackSegmentMaker") == 0){
1847 // if ( name.IsNull() )
1848 // name = fTrackSegmentsTitle ;
1849 // name.Append(":tsm") ;
1851 // else if (what.CompareTo("PID") == 0){
1852 // if ( name.IsNull() )
1853 // name = fRecParticlesTitle ;
1854 // name.Append(":pid") ;
1856 // else if (what.CompareTo("QATasks") == 0){
1857 // if ( name.IsNull() )
1863 while((task = static_cast<TTask *>(it.Next()) )){
1864 TString taskname(task->GetName()) ;
1865 if(taskname.BeginsWith(name)){
1870 cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;