1 #ifndef ALIPHOSGETTER_H
2 #define ALIPHOSGETTER_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.
14 // The objects are retrived from folders.
15 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
19 // --- ROOT system ---
20 #include "TClonesArray.h"
29 // --- Standard library ---
31 // --- AliRoot header files ---
34 class AliPHOSGeometry ;
37 class AliPHOSDigitizer ;
38 class AliPHOSSDigitizer ;
39 class AliPHOSEmcRecPoint ;
40 class AliPHOSRecPoint ;
41 class AliPHOSClusterizer ;
42 class AliPHOSTrackSegment ;
43 class AliPHOSTrackSegmentMaker ;
44 class AliPHOSRecParticle ;
47 class AliPHOSGetter : public TObject {
52 // ctor: this is a singleton, the ctor should never be called but cint needs it as public
53 cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
56 AliPHOSGetter(const AliPHOSGetter & obj) {
57 // cpy ctor requested by Coding Convention
62 virtual ~AliPHOSGetter(){
66 void Post(const char * file, const char * opt, const char * name = 0, const Int_t event=-1) const ;
67 void Event(Int_t event) ; // reads event from file
68 // Int_t EventNumber(){ return fEvent; }
69 // Int_t MaxEvent() { return fMaxEvent;}
70 static AliPHOSGetter * GetInstance(const char* headerFile,
71 const char* branchTitle = "No Name" ) ;
72 static AliPHOSGetter * GetInstance() ;
73 const AliPHOS * PHOS() const ;
74 const AliPHOSGeometry * PHOSGeometry() const ;
77 TFolder * Alarms(const char * name = 0) const { return (TFolder*)(ReturnO("Alarms", name)) ; }
80 TClonesArray * Hits(const char * name = 0) const { return (TClonesArray*)(ReturnO("Hits", name)) ; }
81 const AliPHOSHit * Hit(Int_t index)
82 {if( Hits() ) return (AliPHOSHit*)(Hits()->At(index));
85 {if( Hits() ) return Hits()->GetEntriesFast();
88 TClonesArray * SDigits(const char * name = 0, const char * file=0) const {
89 return (TClonesArray*)(ReturnO("SDigits", name, file)) ; }
90 const AliPHOSDigit * SDigit(Int_t index)
91 {if( SDigits() ) return (AliPHOSDigit*)(SDigits()->At(index));
93 const Int_t NSDigits()
94 {if( SDigits() ) return SDigits()->GetEntriesFast();
96 AliPHOSSDigitizer * SDigitizer(const char * name =0) const { return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ; }
98 TClonesArray * Digits(const char * name = 0) const { return (TClonesArray*)(ReturnO("Digits", name)) ; }
99 const AliPHOSDigit * Digit(Int_t index)
100 {if( Digits() ) return (AliPHOSDigit*)Digits()->At(index);
102 const Int_t NDigits()
103 {if( Digits() ) return Digits()->GetEntriesFast();
105 AliPHOSDigitizer * Digitizer(const char * name =0) const { return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; }
107 TObjArray * EmcRecPoints(const char * name = 0, const char * file=0) const {
108 return (TObjArray*)(ReturnO("EmcRecPoints", name, file)) ; }
109 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index)
110 { if(EmcRecPoints()) return (AliPHOSEmcRecPoint*)EmcRecPoints()->At(index); return 0 ;}
111 const Int_t NEmcRecPoints()
112 { if(EmcRecPoints()) return EmcRecPoints()->GetEntriesFast(); return 0 ;}
113 TObjArray * CpvRecPoints(const char * name = 0, const char * file=0) const {
114 return (TObjArray*)(ReturnO("CpvRecPoints", name, file)) ; }
115 const AliPHOSRecPoint * CpvRecPoint(Int_t index)
116 { if(CpvRecPoints()) return (AliPHOSRecPoint*)CpvRecPoints()->At(index); return 0 ;}
117 const Int_t NCpvRecPoints()
118 { if(CpvRecPoints()) return CpvRecPoints()->GetEntriesFast(); return 0 ;}
119 AliPHOSClusterizer * Clusterizer (const char * name =0) const
120 { return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ; }
122 TClonesArray * TrackSegments(const char * name = 0, const char * file=0) const {
123 return (TClonesArray*)(ReturnO("TrackSegments", name, file)) ; }
124 const AliPHOSTrackSegment * TrackSegment(Int_t index)
125 { if(TrackSegments()) return (AliPHOSTrackSegment*)TrackSegments()->At(index); return 0 ;}
126 const Int_t NTrackSegments()
127 { if(TrackSegments()) return TrackSegments()->GetEntriesFast(); return 0 ;}
128 AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const
129 { return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
131 TClonesArray * RecParticles(const char * name = 0, const char * file=0) const {
132 return (TClonesArray*)(ReturnO("RecParticles", name, file)) ; }
133 const AliPHOSRecParticle * RecParticle(Int_t index)
134 { if(RecParticles()) return (AliPHOSRecParticle*)RecParticles()->At(index); return 0 ;}
135 const Int_t NRecParticles()
136 { if(RecParticles()) return RecParticles()->GetEntriesFast(); return 0 ;}
137 AliPHOSPID * PID(const char * name =0) const
138 { return (AliPHOSPID*)(ReturnT("PID", name)) ; }
140 const TParticle * Primary(Int_t index) const ;
141 const Int_t NPrimaries()const { return fNPrimaries; }
144 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
145 // assignement operator requested by coding convention
153 AliPHOSGetter(const char* headerFile, const char* branchTitle =0) ;
154 void CreateWhiteBoard() const ;
155 const TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
156 const TTask * ReturnT(TString what,TString name=0) const ;
157 void DefineBranchTitles(char* branch, char* branchTitle) ;
163 void ReadPrimaries() ;
167 TString fHeaderFile ; //!
168 TString fTrackSegmentsTitle ;//!
169 TString fRecPointsTitle ;//!
170 TString fRecParticlesTitle ;//!
171 TString fDigitsTitle ; //!
172 TString fSDigitsTitle ; //!
174 Int_t fNPrimaries ; //! # of primaries
176 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
178 static AliPHOSGetter * fgObjGetter ; // pointer to the unique instance of the singleton
180 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
184 #endif // AliPHOSGETTER_H