1 #ifndef ALIEMCALGETTER_H
2 #define ALIEMCALGETTER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 //_________________________________________________________________________
9 // A singleton that returns various objects
10 // Should be used on the analysis stage to avoid confusing between different
11 // branches of reconstruction tree: e.g. reading RecPoints and TS made from
12 // another set of RecPoints.
13 // At this stage the Getter class handles only Hits, Digits, and SDigits.
14 // The objects are retrived from folders.
15 //*-- Author: Sahal Yacoob (LBL)
16 // based on : AliPHOSGetter
19 // --- ROOT system ---
20 #include "TClonesArray.h"
27 // --- Standard library ---
31 // --- AliRoot header files ---
34 #include "AliEMCALv1.h"
35 class AliEMCALGeometry ;
38 class AliEMCALDigitizer ;
39 class AliEMCALSDigitizer ;
41 class AliEMCALGetter : public TObject {
46 // ctor: this is a singleton, the ctor should never be called but cint needs it as public
47 cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
50 AliEMCALGetter(const AliEMCALGetter & obj) {
51 // cpy ctor requested by Coding Convention
56 virtual ~AliEMCALGetter() ;
58 Bool_t PostHits(void ) const ;
59 Bool_t PostSDigits( const char * name, const char * file = 0) const ;
60 Bool_t PostDigits( const char * name ) const ;
62 Bool_t PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ;
63 Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
64 Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ;
65 Bool_t PostDigitizer ( const char * name) const ;
68 void Event(const Int_t event, const char * opt = "HSD") ;
69 void Track(Int_t itrack) ;
71 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
72 void ReadTreeS(TTree * treeS,Int_t input) ;
74 Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
75 Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
76 static AliEMCALGetter * GetInstance(const char* headerFile,
77 const char* branchTitle = "Default" ) ;
78 static AliEMCALGetter * GetInstance() ;
80 const AliEMCALv0 * EMCAL() ;
81 const AliEMCALGeometry * EMCALGeometry() ;
84 TClonesArray * Hits(void) const { return (TClonesArray*)(ReturnO("Hits")) ; }
87 TClonesArray * SDigits(const char * name = 0, const char * file=0) const
88 { return (TClonesArray*)(ReturnO("SDigits", name, file)) ; }
90 AliEMCALSDigitizer * SDigitizer(const char * name =0) const
91 { return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ; }
94 TClonesArray * Digits(const char * name = 0) const
95 { return (TClonesArray*)(ReturnO("Digits", name)) ; }
96 AliEMCALDigitizer * Digitizer(const char * name =0) const
97 { return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ; }
100 const TParticle * Primary(Int_t index) const ;
101 const Int_t NPrimaries()const { return fNPrimaries; }
104 AliEMCALGetter & operator = (const AliEMCALGetter & ) {
105 // assignement operator requested by coding convention, but not needed
110 TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; }
114 AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default") ;
115 void CreateWhiteBoard() const ;
116 const TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
117 const TTask * ReturnT(TString what,TString name=0) const ;
118 void DefineBranchTitles(char* branch, char* branchTitle) ;
121 void ReadTreeS(Int_t event) ;
122 void ReadPrimaries() ;
124 void * HitsRef(void) const ;
125 void * SDigitsRef(const char * name, const char * file = 0 ) const;
126 void * DigitsRef (const char * name) const ;
128 void * SDigitizerRef (const char * name) const ;
129 void * DigitizerRef (const char * name) const ;
133 TString fHeaderFile ; //! File in which gAlice lives
134 TString fBranchTitle ; //!
135 TString fDigitsTitle ; //!
136 TString fSDigitsTitle ; //!
138 Int_t fDebug ; // Debug level
140 Int_t fNPrimaries ; //! # of primaries
142 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
144 TFolder * fHitsFolder ; //!Folder that contains the Hits
145 TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
146 TFolder * fDigitsFolder ; //!Folder that contains the Digits
147 TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
148 TFolder * fModuleFolder ; //!
149 static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
151 ClassDef(AliEMCALGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
155 #endif // AliEMCALGETTER_H