]>
Commit | Line | Data |
---|---|---|
4ae78bb1 | 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 */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
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 | // | |
14 | // The objects are retrived from folders. | |
15 | //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) | |
16 | // | |
17 | ||
18 | ||
19 | // --- ROOT system --- | |
20 | #include "TClonesArray.h" | |
21 | #include <stdlib.h> | |
22 | #include <iostream.h> | |
23 | ||
24 | class TString ; | |
25 | class TParticle ; | |
26 | class TTask ; | |
ef5b46d2 | 27 | class TFolder ; |
4ae78bb1 | 28 | |
29 | // --- Standard library --- | |
30 | ||
31 | // --- AliRoot header files --- | |
32 | ||
33 | class AliPHOS ; | |
34 | class AliPHOSGeometry ; | |
35 | class AliPHOSHit ; | |
36 | class AliPHOSDigit ; | |
37 | class AliPHOSDigitizer ; | |
38 | class AliPHOSSDigitizer ; | |
39 | class AliPHOSEmcRecPoint ; | |
40 | class AliPHOSRecPoint ; | |
41 | class AliPHOSClusterizer ; | |
42 | class AliPHOSTrackSegment ; | |
43 | class AliPHOSTrackSegmentMaker ; | |
44 | class AliPHOSRecParticle ; | |
45 | class AliPHOSPID ; | |
46 | ||
47 | class AliPHOSGetter : public TObject { | |
48 | ||
49 | public: | |
50 | ||
51 | AliPHOSGetter(){ | |
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 ; | |
54 | abort() ; | |
55 | } | |
56 | AliPHOSGetter(const AliPHOSGetter & obj) { | |
57 | // cpy ctor requested by Coding Convention | |
58 | // but not yet needed | |
59 | abort() ; | |
60 | } | |
61 | ||
62 | virtual ~AliPHOSGetter(){ | |
63 | // dtor | |
64 | } | |
65 | ||
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 ; | |
75 | ||
76 | // Alarms | |
77 | TFolder * Alarms(const char * name = 0) const { return (TFolder*)(ReturnO("Alarms", name)) ; } | |
78 | ||
79 | // Hits | |
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)); | |
83 | return 0 ;} | |
84 | const Int_t NHits() | |
85 | {if( Hits() ) return Hits()->GetEntriesFast(); | |
86 | return 0 ;} | |
87 | // SDigits | |
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)); | |
92 | return 0 ;} | |
93 | const Int_t NSDigits() | |
94 | {if( SDigits() ) return SDigits()->GetEntriesFast(); | |
95 | return 0 ;} | |
96 | AliPHOSSDigitizer * SDigitizer(const char * name =0) const { return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ; } | |
97 | // Digits | |
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); | |
101 | return 0 ;} | |
102 | const Int_t NDigits() | |
103 | {if( Digits() ) return Digits()->GetEntriesFast(); | |
104 | return 0 ;} | |
105 | AliPHOSDigitizer * Digitizer(const char * name =0) const { return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; } | |
106 | // RecPoints | |
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)) ; } | |
121 | // TrackSegments | |
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)) ; } | |
130 | // RecParticles | |
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)) ; } | |
139 | // Primaries | |
140 | const TParticle * Primary(Int_t index) const ; | |
141 | const Int_t NPrimaries()const { return fNPrimaries; } | |
142 | ||
143 | ||
144 | AliPHOSGetter & operator = (const AliPHOSGetter & ) { | |
145 | // assignement operator requested by coding convention | |
146 | // but not needed | |
147 | abort() ; | |
148 | return *this ; | |
149 | } | |
150 | ||
151 | private: | |
152 | ||
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) ; | |
158 | void ReadTreeD() ; | |
159 | void ReadTreeH() ; | |
160 | void ReadTreeQA() ; | |
161 | void ReadTreeR() ; | |
162 | void ReadTreeS() ; | |
163 | void ReadPrimaries() ; | |
164 | ||
165 | private: | |
166 | ||
167 | TString fHeaderFile ; //! | |
168 | TString fTrackSegmentsTitle ;//! | |
169 | TString fRecPointsTitle ;//! | |
170 | TString fRecParticlesTitle ;//! | |
171 | TString fDigitsTitle ; //! | |
172 | TString fSDigitsTitle ; //! | |
173 | ||
174 | Int_t fNPrimaries ; //! # of primaries | |
175 | ||
176 | TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing | |
177 | ||
178 | static AliPHOSGetter * fgObjGetter ; // pointer to the unique instance of the singleton | |
179 | ||
180 | ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index | |
181 | ||
182 | }; | |
183 | ||
184 | #endif // AliPHOSGETTER_H |