]>
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 | ||
eb9763ac | 79 | // QA Tasks |
80 | TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; } | |
81 | ||
4ae78bb1 | 82 | // Hits |
83 | TClonesArray * Hits(const char * name = 0) const { return (TClonesArray*)(ReturnO("Hits", name)) ; } | |
84 | const AliPHOSHit * Hit(Int_t index) | |
85 | {if( Hits() ) return (AliPHOSHit*)(Hits()->At(index)); | |
86 | return 0 ;} | |
87 | const Int_t NHits() | |
88 | {if( Hits() ) return Hits()->GetEntriesFast(); | |
89 | return 0 ;} | |
90 | // SDigits | |
91 | TClonesArray * SDigits(const char * name = 0, const char * file=0) const { | |
92 | return (TClonesArray*)(ReturnO("SDigits", name, file)) ; } | |
93 | const AliPHOSDigit * SDigit(Int_t index) | |
94 | {if( SDigits() ) return (AliPHOSDigit*)(SDigits()->At(index)); | |
95 | return 0 ;} | |
96 | const Int_t NSDigits() | |
97 | {if( SDigits() ) return SDigits()->GetEntriesFast(); | |
98 | return 0 ;} | |
99 | AliPHOSSDigitizer * SDigitizer(const char * name =0) const { return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ; } | |
100 | // Digits | |
101 | TClonesArray * Digits(const char * name = 0) const { return (TClonesArray*)(ReturnO("Digits", name)) ; } | |
102 | const AliPHOSDigit * Digit(Int_t index) | |
103 | {if( Digits() ) return (AliPHOSDigit*)Digits()->At(index); | |
104 | return 0 ;} | |
105 | const Int_t NDigits() | |
106 | {if( Digits() ) return Digits()->GetEntriesFast(); | |
107 | return 0 ;} | |
108 | AliPHOSDigitizer * Digitizer(const char * name =0) const { return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; } | |
109 | // RecPoints | |
110 | TObjArray * EmcRecPoints(const char * name = 0, const char * file=0) const { | |
111 | return (TObjArray*)(ReturnO("EmcRecPoints", name, file)) ; } | |
112 | const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) | |
113 | { if(EmcRecPoints()) return (AliPHOSEmcRecPoint*)EmcRecPoints()->At(index); return 0 ;} | |
114 | const Int_t NEmcRecPoints() | |
115 | { if(EmcRecPoints()) return EmcRecPoints()->GetEntriesFast(); return 0 ;} | |
116 | TObjArray * CpvRecPoints(const char * name = 0, const char * file=0) const { | |
117 | return (TObjArray*)(ReturnO("CpvRecPoints", name, file)) ; } | |
118 | const AliPHOSRecPoint * CpvRecPoint(Int_t index) | |
119 | { if(CpvRecPoints()) return (AliPHOSRecPoint*)CpvRecPoints()->At(index); return 0 ;} | |
120 | const Int_t NCpvRecPoints() | |
121 | { if(CpvRecPoints()) return CpvRecPoints()->GetEntriesFast(); return 0 ;} | |
122 | AliPHOSClusterizer * Clusterizer (const char * name =0) const | |
123 | { return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ; } | |
124 | // TrackSegments | |
125 | TClonesArray * TrackSegments(const char * name = 0, const char * file=0) const { | |
126 | return (TClonesArray*)(ReturnO("TrackSegments", name, file)) ; } | |
127 | const AliPHOSTrackSegment * TrackSegment(Int_t index) | |
128 | { if(TrackSegments()) return (AliPHOSTrackSegment*)TrackSegments()->At(index); return 0 ;} | |
129 | const Int_t NTrackSegments() | |
130 | { if(TrackSegments()) return TrackSegments()->GetEntriesFast(); return 0 ;} | |
131 | AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const | |
132 | { return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; } | |
133 | // RecParticles | |
134 | TClonesArray * RecParticles(const char * name = 0, const char * file=0) const { | |
135 | return (TClonesArray*)(ReturnO("RecParticles", name, file)) ; } | |
136 | const AliPHOSRecParticle * RecParticle(Int_t index) | |
137 | { if(RecParticles()) return (AliPHOSRecParticle*)RecParticles()->At(index); return 0 ;} | |
138 | const Int_t NRecParticles() | |
139 | { if(RecParticles()) return RecParticles()->GetEntriesFast(); return 0 ;} | |
140 | AliPHOSPID * PID(const char * name =0) const | |
141 | { return (AliPHOSPID*)(ReturnT("PID", name)) ; } | |
142 | // Primaries | |
143 | const TParticle * Primary(Int_t index) const ; | |
144 | const Int_t NPrimaries()const { return fNPrimaries; } | |
145 | ||
146 | ||
147 | AliPHOSGetter & operator = (const AliPHOSGetter & ) { | |
148 | // assignement operator requested by coding convention | |
149 | // but not needed | |
150 | abort() ; | |
151 | return *this ; | |
152 | } | |
153 | ||
154 | private: | |
155 | ||
156 | AliPHOSGetter(const char* headerFile, const char* branchTitle =0) ; | |
157 | void CreateWhiteBoard() const ; | |
158 | const TObject * ReturnO(TString what, TString name=0, TString file=0) const ; | |
159 | const TTask * ReturnT(TString what,TString name=0) const ; | |
160 | void DefineBranchTitles(char* branch, char* branchTitle) ; | |
161 | void ReadTreeD() ; | |
162 | void ReadTreeH() ; | |
163 | void ReadTreeQA() ; | |
164 | void ReadTreeR() ; | |
165 | void ReadTreeS() ; | |
166 | void ReadPrimaries() ; | |
167 | ||
168 | private: | |
169 | ||
170 | TString fHeaderFile ; //! | |
171 | TString fTrackSegmentsTitle ;//! | |
172 | TString fRecPointsTitle ;//! | |
173 | TString fRecParticlesTitle ;//! | |
174 | TString fDigitsTitle ; //! | |
175 | TString fSDigitsTitle ; //! | |
176 | ||
177 | Int_t fNPrimaries ; //! # of primaries | |
178 | ||
179 | TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing | |
180 | ||
181 | static AliPHOSGetter * fgObjGetter ; // pointer to the unique instance of the singleton | |
182 | ||
183 | ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index | |
184 | ||
185 | }; | |
186 | ||
187 | #endif // AliPHOSGETTER_H |