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")) ;
107 if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
110 TFile * file = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
112 if(file == 0){ //if file was not opened yet, read gAlice
113 if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
114 file = TFile::Open(fHeaderFile.Data(),rw) ;
116 file = new TFile(fHeaderFile.Data(),rw) ;
118 if (!file->IsOpen()) {
119 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
124 gAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
129 cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
135 cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ;
136 AliConfig * conf = AliConfig::Instance() ;
137 conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
138 conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
143 //____________________________________________________________________________
144 AliEMCALGetter::~AliEMCALGetter(){
147 fPrimaries->Delete() ;
153 //____________________________________________________________________________
154 void AliEMCALGetter::CreateWhiteBoard() const
159 //____________________________________________________________________________
160 AliEMCALGetter * AliEMCALGetter::GetInstance()
162 // Returns the pointer of the unique instance already defined
164 AliEMCALGetter * rv = 0 ;
168 cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
173 //____________________________________________________________________________
174 AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
175 const char* branchTitle, const Option_t * rw)
177 // Creates and returns the pointer of the unique instance
178 // Must be called only when the environment has changed
181 if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
182 (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
185 fgObjGetter->~AliEMCALGetter() ; // delete it already exists another version
187 fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
189 // Posts a few item to the white board (folders)
190 // fgObjGetter->CreateWhiteBoard() ;
196 //____________________________________________________________________________
197 const AliEMCALv1 * AliEMCALGetter::EMCAL()
199 // returns the EMCAL object
200 AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ;
203 cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
207 //____________________________________________________________________________
208 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
210 AliEMCALGeometry * rv = 0 ;
212 rv = EMCAL()->GetGeometry() ;
216 //____________________________________________________________________________
217 Bool_t AliEMCALGetter::PostHits(void) const
218 { //------- Hits ----------------------
220 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
222 TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
223 if ( !emcalFolder ) {
225 cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
226 cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
228 emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
230 TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
231 hits->SetName("Hits") ;
232 emcalFolder->Add(hits) ;
237 //____________________________________________________________________________
238 TObject ** AliEMCALGetter::HitsRef(void) const
239 { //------- Hits ----------------------
242 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
243 if ( !fHitsFolder ) {
244 cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
248 TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
249 if ( !emcalFolder ) {
250 cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
254 TObject * h = emcalFolder->FindObject("Hits") ;
256 cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
260 return emcalFolder->GetListOfFolders()->GetObjectRef(h) ;
263 //____________________________________________________________________________
264 Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
265 { //---------- SDigits -------------------------
268 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
269 // because you can have sdigits from several hit files for mixing
271 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
272 if ( !emcalFolder ) {
274 cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
275 cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
277 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
279 TString subdir(headerFile) ;
280 subdir.ReplaceAll("/", "_") ;
281 TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
282 if ( !emcalSubFolder )
283 emcalSubFolder = emcalFolder->AddFolder(subdir, "");
285 TObject * sd = emcalSubFolder->FindObject(name);
288 cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
289 << " already exists!" << endl ;
291 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
292 sdigits->SetName(name) ;
293 emcalSubFolder->Add(sdigits) ;
298 //____________________________________________________________________________
299 TObject ** AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
300 { //------- SDigits ----------------------
302 // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
304 if ( !fSDigitsFolder ) {
305 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
309 TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
310 if ( !emcalFolder ) {
311 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
315 TFolder * emcalSubFolder = 0 ;
317 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
319 emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
321 if(!emcalSubFolder) {
322 cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
326 TObject * dis = emcalSubFolder->FindObject(name) ;
330 return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
334 //____________________________________________________________________________
335 Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
336 { //---------- SDigitizer -------------------------
338 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
341 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
344 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
347 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
350 cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
351 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
353 emcal = new TTask("EMCAL", "") ;
356 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
359 cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
360 emcal->GetListOfTasks()->Remove(emcalsd) ;
362 emcal->Add(sdigitizer) ;
367 //____________________________________________________________________________
368 TObject ** AliEMCALGetter::SDigitizerRef(const char * name) const
371 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
373 cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
377 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
379 cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
383 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
385 return emcal->GetListOfTasks()->GetObjectRef(task) ;
389 //____________________________________________________________________________
390 Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
391 { //---------- SDigitizer -------------------------
393 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
396 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
398 cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
402 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
405 cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
406 cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
408 emcal = new TTask("EMCAL", "") ;
412 TString sdname(name) ;
415 sdname.ReplaceAll("/","_") ;
416 AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
418 emcalsd = new AliEMCALSDigitizer() ;
419 //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
420 emcalsd->SetName(sdname) ;
421 emcalsd->SetTitle(file) ;
422 emcal->Add(emcalsd) ;
428 //____________________________________________________________________________
429 Bool_t AliEMCALGetter::PostDigits(const char * name) const
430 { //---------- Digits -------------------------
432 // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
434 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
436 if ( !emcalFolder ) {
438 cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
439 cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
441 emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
444 TObject* dig = emcalFolder->FindObject( name ) ;
446 TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
447 digits->SetName(name) ;
448 emcalFolder->Add(digits) ;
453 //____________________________________________________________________________
454 TObject ** AliEMCALGetter::DigitsRef(const char * name) const
455 { //------- Digits ----------------------
457 // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
459 if ( !fDigitsFolder ) {
460 cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
464 TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
465 if ( !emcalFolder ) {
466 cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
470 TObject * d = emcalFolder->FindObject(name) ;
474 return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
478 //____________________________________________________________________________
479 Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
480 { //---------- Digitizer -------------------------
482 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
485 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
488 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
491 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
492 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
494 emcal = new TTask("EMCAL", "") ;
498 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
501 emcal->GetListOfTasks()->Remove(emcald) ;
503 emcal->Add(digitizer) ;
507 //____________________________________________________________________________
508 Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
509 { //---------- Digitizer -------------------------
511 // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
513 TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
515 cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
519 TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
522 cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
523 cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
525 emcal = new TTask("EMCAL", "") ;
529 AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
531 emcald = new AliEMCALDigitizer() ;
532 emcald->SetName(fDigitsTitle) ;
533 emcald->SetTitle(fHeaderFile) ;
539 //____________________________________________________________________________
540 TObject ** AliEMCALGetter::DigitizerRef(const char * name) const
542 TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
544 cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
548 TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
550 cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
554 TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
556 return emcal->GetListOfTasks()->GetObjectRef(task) ;
560 //____________________________________________________________________________
561 Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
562 { // -------------- RecPoints -------------------------------------------
564 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
565 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
567 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
569 if ( !emcalFolder ) {
571 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
572 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
574 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
578 TFolder * emcalRPoTowerFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TowerRecPoints")) ;
579 if ( !emcalRPoTowerFolder ) {
581 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
582 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints not found!" << endl;
584 emcalRPoTowerFolder = emcalFolder->AddFolder("TowerRecPoints", "Tower RecPoints from EMCAL") ;
587 TObject * erp = emcalFolder->FindObject( name ) ;
589 TObjArray * towerrp = new TObjArray(100) ;
590 towerrp->SetName(name) ;
591 emcalRPoTowerFolder->Add(towerrp) ;
594 // Pre Shower RecPoints
595 TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ;
596 if ( !emcalRPoPreShoFolder ) {
598 cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl;
599 cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
601 emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ;
604 TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
606 TObjArray * preshorp = new TObjArray(100) ;
607 preshorp->SetName(name) ;
608 emcalRPoPreShoFolder->Add(preshorp) ;
613 //____________________________________________________________________________
614 TObject ** AliEMCALGetter::TowerRecPointsRef(const char * name) const
615 { // -------------- RecPoints -------------------------------------------
617 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
619 if ( !fRecoFolder ) {
620 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
624 TFolder * towerFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
625 if ( !towerFolder ) {
626 cerr << "ERROR: AliEMCALGetter::TowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/TowerRecPoints/ not found!" << endl;
631 TObject * trp = towerFolder->FindObject(name ) ;
635 return towerFolder->GetListOfFolders()->GetObjectRef(trp) ;
639 //____________________________________________________________________________
640 TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const
641 { // -------------- RecPoints -------------------------------------------
643 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
645 if ( !fRecoFolder ) {
646 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
650 TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
651 if ( !preshoFolder ) {
652 cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
656 TObject * prp = preshoFolder->FindObject(name ) ;
660 return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
664 //____________________________________________________________________________
665 Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const
666 { // ------------------ AliEMCALClusterizer ------------------------
668 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
670 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
673 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
677 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
680 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
681 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
683 emcal = new TTask("EMCAL", "") ;
687 AliEMCALClusterizerv1 * emcalcl = dynamic_cast<AliEMCALClusterizerv1*>(emcal->GetListOfTasks()->FindObject(clu->GetName())) ;
690 cout << "INFO: AliEMCALGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
692 emcal->GetListOfTasks()->Remove(emcalcl) ;
698 //____________________________________________________________________________
699 TObject ** AliEMCALGetter::ClusterizerRef(const char * name) const
700 { // ------------------ AliEMCALClusterizer ------------------------
702 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
705 cerr << "ERROR: AliEMCALGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
709 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
711 cerr <<"WARNING: AliEMCALGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
715 TList * l = emcal->GetListOfTasks() ;
719 TString cluname(name) ;
721 while((task = static_cast<TTask *>(it.Next()) )){
722 TString taskname(task->GetName()) ;
723 if(taskname.BeginsWith(cluname)){
730 return l->GetObjectRef(clu) ;
735 //____________________________________________________________________________
736 Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
737 { // ------------------ AliEMCALClusterizer ------------------------
739 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
741 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
744 cerr << "ERROR: AliEMCALGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl;
748 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
751 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
752 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
754 emcal = new TTask("EMCAL", "") ;
758 AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
761 emcalcl->SetName(clun) ;
762 emcal->Add(emcalcl) ;
767 //____________________________________________________________________________
768 /*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
769 { // ---------------TrackSegments -----------------------------------
771 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
773 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
775 if ( !emcalFolder ) {
777 cout << "WARNING: AliEMCALGetter::Post TS -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
778 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL" << endl;
780 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
783 TFolder * emcalTSFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("TrackSegments")) ;
784 if ( !emcalTSFolder ) {
786 cout << "WARNING: AliEMCALGetter::Post TS -> Folder//" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
787 cout << "INFO: AliEMCALGetter::Post TS -> Adding Folder //" << fRecoFolder << "/EMCAL/TrackSegments/" << endl;
789 emcalTSFolder = emcalFolder->AddFolder("TrackSegments", "TrackSegments from EMCAL") ;
792 TObject * tss = emcalTSFolder->FindObject( name ) ;
794 TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
796 emcalTSFolder->Add(ts) ;
801 //____________________________________________________________________________
802 TObject ** AliEMCALGetter::TrackSegmentsRef(const char * name) const
803 { // ---------------TrackSegments -----------------------------------
805 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
807 if ( !fRecoFolder ) {
808 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
812 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
813 if ( !emcalFolder ) {
814 cerr << "ERROR: AliEMCALGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/EMCAL/TrackSegments/ not found!" << endl;
818 TObject * tss = emcalFolder->FindObject(name) ;
822 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
825 //____________________________________________________________________________
826 Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
827 { //------------Track Segment Maker ------------------------------
829 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
831 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
834 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
838 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
841 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
842 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
844 emcal = new TTask("EMCAL", "") ;
848 AliEMCALTrackSegmentMaker * emcalts =
849 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
852 emcal->GetListOfTasks()->Remove(emcalts) ;
854 emcal->Add(tsmaker) ;
858 //____________________________________________________________________________
859 Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
860 { //------------Track Segment Maker ------------------------------
862 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
865 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
868 cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
872 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
875 cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
876 cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
878 emcal = new TTask("EMCAL", "") ;
882 AliEMCALTrackSegmentMaker * emcalts =
883 dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ;
885 emcalts = new AliEMCALTrackSegmentMakerv1() ;
888 emcalts->SetName(tsn) ;
889 emcal->Add(emcalts) ;
895 //____________________________________________________________________________
896 TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
897 { //------------Track Segment Maker ------------------------------
899 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
902 cerr << "ERROR: AliEMCALGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
906 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
908 cerr <<"WARNING: AliEMCALGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
912 TList * l = emcal->GetListOfTasks() ;
916 TString tsmname(name) ;
918 while((task = static_cast<TTask *>(it.Next()) )){
919 TString taskname(task->GetName()) ;
920 if(taskname.BeginsWith(tsmname)){
927 return l->GetObjectRef(tsm) ;
933 //____________________________________________________________________________
934 Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
935 { // -------------------- RecParticles ------------------------
937 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
939 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
941 if ( !emcalFolder ) {
943 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/ not found!" << endl;
944 cout << "INFO: AliEMCALGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/EMCAL/" << endl;
946 emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
949 TFolder * emcalRPaFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("RecParticles")) ;
950 if ( !emcalRPaFolder ) {
952 cout << "WARNING: AliEMCALGetter::Post RPa -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
953 cout << "INFO: AliEMCALGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/EMCAL/RecParticles/" << endl;
955 emcalRPaFolder = emcalFolder->AddFolder("RecParticles", "RecParticles from EMCAL") ;
958 TObject * rps = emcalRPaFolder->FindObject( name ) ;
960 TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
962 emcalRPaFolder->Add(rp) ;
967 //____________________________________________________________________________
968 TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
969 { // ---------------TrackSegments -----------------------------------
971 // the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
973 if ( !fRecoFolder ) {
974 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
978 TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
979 if ( !emcalFolder ) {
980 cerr << "ERROR: AliEMCALGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/EMCAL/RecParticles/ not found!" << endl;
984 TObject * tss = emcalFolder->FindObject(name ) ;
988 return emcalFolder->GetListOfFolders()->GetObjectRef(tss) ;
991 //____________________________________________________________________________
992 Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
993 { // ------------AliEMCAL PID -----------------------------
995 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
998 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1002 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1005 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1006 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1008 emcal = new TTask("EMCAL", "") ;
1012 AliEMCALPID * emcalpid = dynamic_cast<AliEMCALPID*>(emcal->GetListOfTasks()->FindObject(pid->GetName())) ;
1015 cout << "INFO: AliEMCALGetter::Post Per -> Task " << pid->GetName()
1016 << " already exists" << endl ;
1017 emcal->GetListOfTasks()->Remove(emcalpid) ;
1024 //____________________________________________________________________________
1025 Bool_t AliEMCALGetter::PostPID(const char * name) const
1027 // the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
1029 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1032 cerr << "ERROR: AliEMCALGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1036 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1039 cout <<"WARNING: AliEMCALGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
1040 cout <<"INFO: AliEMCALGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/EMCAL" << endl;
1042 emcal = new TTask("EMCAL", "") ;
1046 TList * l = emcal->GetListOfTasks() ;
1048 TString pidname(name) ;
1051 while((task = static_cast<TTask *>(it.Next()) )){
1052 TString taskname(task->GetName()) ;
1053 if(taskname.BeginsWith(pidname))
1057 AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
1059 emcalpid->SetName(pidname) ;
1060 emcal->Add(emcalpid) ;
1065 //____________________________________________________________________________
1066 TObject ** AliEMCALGetter::PIDRef(const char * name) const
1067 { //------------PID ------------------------------
1069 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
1072 cerr << "ERROR: AliEMCALGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
1076 TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1078 cerr <<"WARNING: AliEMCALGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerEMCAL not found!" << endl;
1082 TList * l = emcal->GetListOfTasks() ;
1086 TString pidname(name) ;
1088 while((task = static_cast<TTask *>(it.Next()) )){
1089 TString taskname(task->GetName()) ;
1090 if(taskname.BeginsWith(pidname)){
1097 return l->GetObjectRef(pid) ;
1103 //____________________________________________________________________________
1104 Bool_t AliEMCALGetter::PostQA(void) const
1105 { // ------------------ QA ---------------------------------
1107 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
1109 TFolder * emcalFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("EMCAL")) ;
1110 if ( !emcalFolder ) {
1112 cout << "WARNING: AliEMCALGetter::Post Q -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1113 cout << "INFO: AliEMCALGetter::Post Q -> Adding Folder //" << fQAFolder << "/EMCAL/" << endl;
1115 emcalFolder = fQAFolder->AddFolder("EMCAL", "QA from EMCAL") ;
1121 //____________________________________________________________________________
1122 TObject ** AliEMCALGetter::AlarmsRef(void) const
1123 { //------- Alarms ----------------------
1126 // the hierarchy is //Folders/Run/Conditions/QA/EMCAL
1128 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl;
1132 TFolder * emcalFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1133 if ( !emcalFolder ) {
1134 cerr << "ERROR: AliEMCALGetter::Post QRef -> Folder //" << fQAFolder << "/EMCAL/ not found!" << endl;
1138 return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
1141 //____________________________________________________________________________
1142 const TParticle * AliEMCALGetter::Primary(Int_t index) const
1144 // Return primary particle numbered by <index>
1149 Int_t primaryIndex = index % 10000000 ;
1150 Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ;
1152 if ( primaryList > 0 ) {
1154 cout << " Getter does not support currently Mixing of primary " << endl ;
1155 cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
1160 return gAlice->Particle(primaryIndex) ;
1164 //____________________________________________________________________________
1165 void AliEMCALGetter::ReadTreeD()
1167 // Read the digit tree gAlice->TreeD()
1168 if(gAlice->TreeD()== 0){
1169 cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ;
1173 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
1175 TBranch * branch = 0 ;
1176 TBranch * digitsbranch = 0 ;
1177 TBranch * digitizerbranch = 0 ;
1178 Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
1180 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
1181 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1182 digitsbranch = branch ;
1183 emcalfound = kTRUE ;
1185 else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
1186 digitizerbranch = branch ;
1187 digitizerfound = kTRUE ;
1191 if ( !emcalfound || !digitizerfound ) {
1193 cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
1194 << fDigitsTitle << endl ;
1199 if(!Digits(fDigitsTitle) )
1200 PostDigits(fDigitsTitle);
1201 digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
1202 digitsbranch->GetEntry(0) ;
1205 // read the Digitizer
1206 if(!Digitizer(fDigitsTitle))
1207 PostDigitizer(fDigitsTitle) ;
1208 digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
1209 digitizerbranch->GetEntry(0) ;
1214 //____________________________________________________________________________
1215 void AliEMCALGetter::ReadTreeH()
1217 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1219 if(gAlice->TreeH()== 0){
1220 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1224 TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
1225 if ( !hitsbranch ) {
1227 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1233 if (hitsbranch->GetEntries() > 1 ) {
1234 TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
1235 TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
1236 hitsbranch->SetAddress(&tempo) ;
1239 for (i = 0 ; i < hitsbranch->GetEntries() ; i++) {
1240 hitsbranch->GetEntry(i) ;
1242 for ( j = 0 ; j < tempo->GetEntries() ; j++) {
1243 const AliEMCALHit * hit = static_cast<const AliEMCALHit *>(tempo->At(j)) ;
1244 new((*hits)[index]) AliEMCALHit( *hit ) ;
1251 hitsbranch->SetAddress(HitsRef()) ;
1252 hitsbranch->GetEntry(0) ;
1256 //____________________________________________________________________________
1257 void AliEMCALGetter::Track(Int_t itrack)
1259 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
1261 if(gAlice->TreeH()== 0){
1262 cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
1266 TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
1267 if ( !hitsbranch ) {
1269 cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
1274 hitsbranch->SetAddress(HitsRef()) ;
1275 hitsbranch->GetEntry(itrack) ;
1279 //____________________________________________________________________________
1280 // void AliEMCALGetter::ReadTreeQA()
1282 // Read the digit tree gAlice->TreeQA()
1283 // so far only EMCAL knows about this Tree
1285 // if(EMCAL()->TreeQA()== 0){
1286 // cerr << "ERROR: AliEMCALGetter::ReadTreeQA: can not read TreeQA " << endl ;
1290 // TBranch * qabranch = EMCAL()->TreeQA()->GetBranch("EMCAL") ;
1293 // cout << "WARNING: AliEMCALGetter::ReadTreeQA -> Cannot find QA Alarms for EMCAL" << endl ;
1300 // qabranch->SetAddress(AlarmsRef()) ;
1302 // qabranch->GetEntry(0) ;
1304 // PostQA("EMCAL") ;
1305 // TFolder * alarmsF = Alarms() ;
1306 // alarmsF->Clear() ;
1307 // qabranch->SetAddress(&alarmsF) ;
1308 // qabranch->GetEntry(0) ;
1312 //____________________________________________________________________________
1313 void AliEMCALGetter::ReadTreeR()
1315 // Read the reconstrunction tree gAlice->TreeR()
1317 if(gAlice->TreeR()== 0){
1318 cerr << "ERROR: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ;
1323 TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
1325 TBranch * branch = 0 ;
1326 TBranch * towerbranch = 0 ;
1327 TBranch * preshobranch = 0 ;
1328 TBranch * clusterizerbranch = 0 ;
1329 Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ;
1331 while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) )
1332 if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
1333 if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
1334 towerbranch = branch ;
1335 emcaltowerrpfound = kTRUE ;
1337 else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
1338 preshobranch = branch ;
1339 emcalpreshorpfound = kTRUE ;
1341 else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
1342 clusterizerbranch = branch ;
1343 clusterizerfound = kTRUE ;
1347 if ( !emcaltowerrpfound ) {
1349 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title "
1350 << fRecPointsTitle << endl ;
1353 if ( !emcalpreshorpfound ) {
1355 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title "
1356 << fRecPointsTitle << endl ;
1359 if ( !clusterizerfound ) {
1361 cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title "
1362 << fRecPointsTitle << endl ;
1366 // Read and Post the RecPoints
1367 if(!TowerRecPoints(fRecPointsTitle) )
1368 PostRecPoints(fRecPointsTitle) ;
1369 towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
1370 towerbranch->GetEntry(0) ;
1372 preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ;
1373 preshobranch->GetEntry(0) ;
1375 if(!Clusterizer(fRecPointsTitle) )
1376 PostClusterizer(fRecPointsTitle) ;
1377 clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
1378 clusterizerbranch->GetEntry(0) ;
1381 //------------------- TrackSegments ---------------------
1383 // TBranch * tsbranch = 0 ;
1384 // TBranch * tsmakerbranch = 0 ;
1385 // Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
1387 // while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) )
1388 // if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
1389 // if ( strcmp(branch->GetName(), "EMCALTS")==0){
1390 // tsbranch = branch ;
1391 // emcaltsfound = kTRUE ;
1393 // else if(strcmp(branch->GetName(), "AliEMCALTrackSegmentMaker")==0) {
1394 // tsmakerbranch = branch ;
1395 // tsmakerfound = kTRUE ;
1399 // if ( !emcaltsfound || !tsmakerfound ) {
1401 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
1402 // << fTrackSegmentsTitle << endl ;
1406 // // Read and Post the TrackSegments
1407 // if(!TrackSegments(fTrackSegmentsTitle))
1408 // PostTrackSegments(fTrackSegmentsTitle) ;
1409 // tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
1410 // tsbranch->GetEntry(0) ;
1412 // // Read and Post the TrackSegment Maker
1413 // if(!TrackSegmentMaker(fTrackSegmentsTitle))
1414 // PostTrackSegmentMaker(fTrackSegmentsTitle) ;
1415 // tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
1416 // tsmakerbranch->GetEntry(0) ;
1419 // //------------ RecParticles ----------------------------
1421 // TBranch * rpabranch = 0 ;
1422 // TBranch * pidbranch = 0 ;
1423 // Bool_t emcalrpafound = kFALSE, pidfound = kFALSE ;
1425 // while ( (branch = static_cast<TBranch*>(next())) && (!emcalrpafound || !pidfound) )
1426 // if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
1427 // if ( strcmp(branch->GetName(), "EMCALRP")==0) {
1428 // rpabranch = branch ;
1429 // emcalrpafound = kTRUE ;
1431 // else if (strcmp(branch->GetName(), "AliEMCALPID")==0) {
1432 // pidbranch = branch ;
1433 // pidfound = kTRUE ;
1437 // if ( !emcalrpafound || !pidfound ) {
1439 // cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
1440 // << fRecParticlesTitle << endl ;
1444 // // Read and Post the RecParticles
1445 // if(!RecParticles(fRecParticlesTitle))
1446 // PostRecParticles(fRecParticlesTitle) ;
1447 // rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
1448 // rpabranch->GetEntry(0) ;
1450 // // Read and Post the PID
1451 // if(!PID(fRecParticlesTitle))
1452 // PostPID(fRecParticlesTitle) ;
1453 // pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
1454 // pidbranch->GetEntry(0) ;
1459 //____________________________________________________________________________
1460 void AliEMCALGetter::ReadTreeS(Int_t event)
1462 // Read the summable digits tree gAlice->TreeS()
1464 // loop over all opened files and read their SDigits to the White Board
1465 TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
1467 emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1468 TCollection * folderslist = emcalF->GetListOfFolders() ;
1470 //Add current file to list if it is not there yet
1472 TString subdir(fHeaderFile) ;
1473 subdir.ReplaceAll("/","_") ;
1475 if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){
1476 emcalF->AddFolder(subdir, "");
1479 TIter next(folderslist) ;
1480 TFolder * folder = 0 ;
1483 while ( (folder = static_cast<TFolder*>(next())) ) {
1484 TString fileName(folder->GetName()) ;
1485 fileName.ReplaceAll("_","/") ;
1486 if(fHeaderFile.CompareTo(fileName) == 0 )
1487 treeS=gAlice->TreeS() ;
1489 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1492 // Get SDigits Tree header from file
1493 TString treeName("TreeS") ;
1495 treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
1498 cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl;
1502 //set address of the SDigits and SDigitizer
1503 TBranch * sdigitsBranch = 0;
1504 TBranch * sdigitizerBranch = 0;
1505 TBranch * branch = 0 ;
1506 TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
1508 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1510 while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
1511 if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1512 emcalfound = kTRUE ;
1513 sdigitsBranch = branch ;
1516 else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
1517 sdigitizerfound = kTRUE ;
1518 sdigitizerBranch = branch ;
1521 if ( !emcalfound || !sdigitizerfound ) {
1523 cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
1524 << " not found" << endl ;
1528 if ( !folder->FindObject(fSDigitsTitle) )
1529 PostSDigits(fSDigitsTitle,folder->GetName()) ;
1530 sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
1531 sdigitsBranch->GetEntry(0) ;
1533 TString sdname(fSDigitsTitle) ;
1535 sdname+=folder->GetName() ;
1536 if(!SDigitizer(sdname) )
1537 PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
1538 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1539 sdigitizerBranch->GetEntry(0) ;
1543 // After SDigits have been read from all files, return to the first one
1546 folder = static_cast<TFolder*>(next());
1548 TString fileName(folder->GetName()) ;
1549 fileName.ReplaceAll("_","/") ;
1550 file = static_cast<TFile*>(gROOT->GetFile(fileName));
1555 //____________________________________________________________________________
1556 void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
1557 { // Read the summable digits fron treeS()
1560 TString filename("mergefile") ;
1563 TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
1564 if ( !emcalFolder ) {
1565 emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
1567 TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
1568 //set address of the SDigits and SDigitizer
1569 TBranch * sdigitsBranch = 0;
1570 TBranch * sdigitizerBranch = 0;
1571 TBranch * branch = 0 ;
1572 TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
1574 Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
1576 while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
1577 if ( strcmp(branch->GetName(), "EMCAL")==0) {
1578 emcalfound = kTRUE ;
1579 sdigitsBranch = branch ;
1582 else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
1583 sdigitizerfound = kTRUE ;
1584 sdigitizerBranch = branch ;
1587 if ( !emcalfound || !sdigitizerfound ) {
1589 cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
1593 if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
1594 PostSDigits(sdigitsBranch->GetTitle(),filename) ;
1596 sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
1597 sdigitsBranch->GetEntry(0) ;
1599 TString sdname(sdigitsBranch->GetTitle()) ;
1602 if(!SDigitizer(sdigitsBranch->GetTitle()) )
1603 PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
1605 sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
1606 sdigitizerBranch->GetEntry(0) ;
1611 //____________________________________________________________________________
1612 void AliEMCALGetter::ReadPrimaries()
1614 // Reads specific branches of primaries
1616 fNPrimaries = gAlice->GetNtrack();
1618 // //Check, is it necessary to open new files
1619 // TArrayI* events = fDigitizer->GetCurrentEvents() ;
1620 // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
1622 // for(input = 0; input < filenames->GetEntriesFast(); input++){
1624 // TObjString * filename = (TObjString *) filenames->At(input) ;
1626 // //Test, if this file already open
1627 // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
1629 // file = new TFile( filename->GetString()) ;
1632 // // Get Kine Tree from file
1633 // // char treeName[20];
1634 // // sprintf(treeName,"TreeK%d",events->At(input));
1635 // // TTree * treeK = (TTree*)gDirectory->Get(treeName);
1637 // // treeK->SetBranchAddress("Particles", &fParticleBuffer);
1639 // // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
1641 // // // Create the particle stack
1642 // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
1643 // // // Build the pointer list
1644 // // if(fParticleMap) { <----
1645 // // fParticleMap->Clear();
1646 // // fParticleMap->Expand(treeK->GetEntries());
1648 // // fParticleMap = new TObjArray(treeK->GetEntries());
1650 // // From gAlice->Particle(i)
1653 // // if(!(*fParticleMap)[i]) {
1654 // // Int_t nentries = fParticles->GetEntries();
1656 // // // algorithmic way of getting entry index
1657 // // // (primary particles are filled after secondaries)
1659 // // if (i<fHeader.GetNprimary())
1660 // // entry = i+fHeader.GetNsecondary();
1662 // // entry = i-fHeader.GetNprimary();
1664 // // // only check the algorithmic way and give
1665 // // // the fatal error if it is wrong
1666 // // if (entry != fParticleFileMap[i]) {
1667 // // Fatal("Particle",
1668 // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
1669 // // entry, fParticleFileMap[i]);
1672 // // fTreeK->GetEntry(fParticleFileMap[i]);
1673 // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
1674 // // fParticleMap->AddAt((*fParticles)[nentries],i);
1676 // // return (TParticle *) (*fParticleMap)[i];
1683 // //scan over opened files and read corresponding TreeK##
1687 //____________________________________________________________________________
1688 void AliEMCALGetter::Event(const Int_t event, const char* opt)
1690 // Reads the content of all Tree's S, D and R
1692 if (event >= gAlice->TreeE()->GetEntries() ) {
1693 cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
1696 gAlice->GetEvent(event) ;
1698 if(strstr(opt,"H") )
1701 if(strstr(opt,"S") )
1704 if( strstr(opt,"D") )
1707 if( strstr(opt,"R") )
1710 // if( strstr(opt,"Q") )
1713 // if( strstr(opt,"P") || (strcmp(opt,"")==0) )
1714 // ReadPrimaries() ;
1718 //____________________________________________________________________________
1719 TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
1721 // get the object named "what" from the folder
1722 // folders are named like //Folders
1724 if ( file.IsNull() )
1725 file = fHeaderFile ;
1727 TFolder * folder = 0 ;
1728 TObject * emcalO = 0 ;
1730 // if ( name.IsNull() ) {
1731 if ( what.CompareTo("Hits") == 0 ) {
1732 folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
1734 emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
1736 else if ( what.CompareTo("SDigits") == 0 ) {
1737 file.ReplaceAll("/","_") ;
1738 TString path = "EMCAL/" + file ;
1739 folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
1742 name = fSDigitsTitle ;
1743 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1746 else if ( what.CompareTo("Digits") == 0 ){
1747 folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
1750 name = fDigitsTitle ;
1751 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1754 else if ( what.CompareTo("TowerRecPoints") == 0 ) {
1755 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
1758 name = fRecPointsTitle ;
1759 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1762 else if ( what.CompareTo("PreShoRecPoints") == 0 ) {
1763 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
1766 name = fRecPointsTitle ;
1767 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1771 else if ( what.CompareTo("TrackSegments") == 0 ) {
1772 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
1775 name = fTrackSegmentsTitle ;
1776 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1779 else if ( what.CompareTo("RecParticles") == 0 ) {
1780 folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
1783 name = fRecParticlesTitle ;
1784 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1787 else if ( what.CompareTo("Alarms") == 0 ){
1789 emcalO = dynamic_cast<TObject *>(fQAFolder->FindObject("EMCAL")) ;
1791 folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("EMCAL")) ;
1795 emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
1801 cerr << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
1807 //____________________________________________________________________________
1808 const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
1810 // get the TTask named "what" from the folder
1811 // folders are named like //Folders/Tasks/what/EMCAL/name
1813 TString search(what) ;
1814 if ( what.CompareTo("Clusterizer") == 0 )
1815 search = "Reconstructioner" ;
1816 else if ( what.CompareTo("TrackSegmentMaker") == 0 )
1817 search = "Reconstructioner" ;
1818 else if ( what.CompareTo("PID") == 0 )
1819 search = "Reconstructioner" ;
1820 else if ( what.CompareTo("QATasks") == 0 )
1823 TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
1826 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
1830 TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
1832 cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
1836 TList * list = emcalT->GetListOfTasks() ;
1838 if (what.CompareTo("SDigitizer") == 0) {
1839 if ( name.IsNull() )
1840 name = fSDigitsTitle ;
1841 } else if (what.CompareTo("Digitizer") == 0){
1842 if ( name.IsNull() )
1843 name = fDigitsTitle ;
1844 } else if (what.CompareTo("Clusterizer") == 0){
1845 if ( name.IsNull() )
1846 name = fRecPointsTitle ;
1847 name.Append(":clu") ;
1849 // else if (what.CompareTo("TrackSegmentMaker") == 0){
1850 // if ( name.IsNull() )
1851 // name = fTrackSegmentsTitle ;
1852 // name.Append(":tsm") ;
1854 // else if (what.CompareTo("PID") == 0){
1855 // if ( name.IsNull() )
1856 // name = fRecParticlesTitle ;
1857 // name.Append(":pid") ;
1859 // else if (what.CompareTo("QATasks") == 0){
1860 // if ( name.IsNull() )
1866 while((task = static_cast<TTask *>(it.Next()) )){
1867 TString taskname(task->GetName()) ;
1868 if(taskname.BeginsWith(name)){
1873 cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;