]>
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 ; | |
27 | ||
28 | // --- Standard library --- | |
29 | ||
30 | // --- AliRoot header files --- | |
31 | ||
32 | class AliPHOS ; | |
33 | class AliPHOSGeometry ; | |
34 | class AliPHOSHit ; | |
35 | class AliPHOSDigit ; | |
36 | class AliPHOSDigitizer ; | |
37 | class AliPHOSSDigitizer ; | |
38 | class AliPHOSEmcRecPoint ; | |
39 | class AliPHOSRecPoint ; | |
40 | class AliPHOSClusterizer ; | |
41 | class AliPHOSTrackSegment ; | |
42 | class AliPHOSTrackSegmentMaker ; | |
43 | class AliPHOSRecParticle ; | |
44 | class AliPHOSPID ; | |
45 | ||
46 | class AliPHOSGetter : public TObject { | |
47 | ||
48 | public: | |
49 | ||
50 | AliPHOSGetter(){ | |
51 | // ctor: this is a singleton, the ctor should never be called but cint needs it as public | |
52 | cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ; | |
53 | abort() ; | |
54 | } | |
55 | AliPHOSGetter(const AliPHOSGetter & obj) { | |
56 | // cpy ctor requested by Coding Convention | |
57 | // but not yet needed | |
58 | abort() ; | |
59 | } | |
60 | ||
61 | virtual ~AliPHOSGetter(){ | |
62 | // dtor | |
63 | } | |
64 | ||
65 | void Post(const char * file, const char * opt, const char * name = 0, const Int_t event=-1) const ; | |
66 | void Event(Int_t event) ; // reads event from file | |
67 | // Int_t EventNumber(){ return fEvent; } | |
68 | // Int_t MaxEvent() { return fMaxEvent;} | |
69 | static AliPHOSGetter * GetInstance(const char* headerFile, | |
70 | const char* branchTitle = "No Name" ) ; | |
71 | static AliPHOSGetter * GetInstance() ; | |
72 | const AliPHOS * PHOS() const ; | |
73 | const AliPHOSGeometry * PHOSGeometry() const ; | |
74 | ||
75 | // Alarms | |
76 | TFolder * Alarms(const char * name = 0) const { return (TFolder*)(ReturnO("Alarms", name)) ; } | |
77 | ||
78 | // Hits | |
79 | TClonesArray * Hits(const char * name = 0) const { return (TClonesArray*)(ReturnO("Hits", name)) ; } | |
80 | const AliPHOSHit * Hit(Int_t index) | |
81 | {if( Hits() ) return (AliPHOSHit*)(Hits()->At(index)); | |
82 | return 0 ;} | |
83 | const Int_t NHits() | |
84 | {if( Hits() ) return Hits()->GetEntriesFast(); | |
85 | return 0 ;} | |
86 | // SDigits | |
87 | TClonesArray * SDigits(const char * name = 0, const char * file=0) const { | |
88 | return (TClonesArray*)(ReturnO("SDigits", name, file)) ; } | |
89 | const AliPHOSDigit * SDigit(Int_t index) | |
90 | {if( SDigits() ) return (AliPHOSDigit*)(SDigits()->At(index)); | |
91 | return 0 ;} | |
92 | const Int_t NSDigits() | |
93 | {if( SDigits() ) return SDigits()->GetEntriesFast(); | |
94 | return 0 ;} | |
95 | AliPHOSSDigitizer * SDigitizer(const char * name =0) const { return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ; } | |
96 | // Digits | |
97 | TClonesArray * Digits(const char * name = 0) const { return (TClonesArray*)(ReturnO("Digits", name)) ; } | |
98 | const AliPHOSDigit * Digit(Int_t index) | |
99 | {if( Digits() ) return (AliPHOSDigit*)Digits()->At(index); | |
100 | return 0 ;} | |
101 | const Int_t NDigits() | |
102 | {if( Digits() ) return Digits()->GetEntriesFast(); | |
103 | return 0 ;} | |
104 | AliPHOSDigitizer * Digitizer(const char * name =0) const { return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; } | |
105 | // RecPoints | |
106 | TObjArray * EmcRecPoints(const char * name = 0, const char * file=0) const { | |
107 | return (TObjArray*)(ReturnO("EmcRecPoints", name, file)) ; } | |
108 | const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) | |
109 | { if(EmcRecPoints()) return (AliPHOSEmcRecPoint*)EmcRecPoints()->At(index); return 0 ;} | |
110 | const Int_t NEmcRecPoints() | |
111 | { if(EmcRecPoints()) return EmcRecPoints()->GetEntriesFast(); return 0 ;} | |
112 | TObjArray * CpvRecPoints(const char * name = 0, const char * file=0) const { | |
113 | return (TObjArray*)(ReturnO("CpvRecPoints", name, file)) ; } | |
114 | const AliPHOSRecPoint * CpvRecPoint(Int_t index) | |
115 | { if(CpvRecPoints()) return (AliPHOSRecPoint*)CpvRecPoints()->At(index); return 0 ;} | |
116 | const Int_t NCpvRecPoints() | |
117 | { if(CpvRecPoints()) return CpvRecPoints()->GetEntriesFast(); return 0 ;} | |
118 | AliPHOSClusterizer * Clusterizer (const char * name =0) const | |
119 | { return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ; } | |
120 | // TrackSegments | |
121 | TClonesArray * TrackSegments(const char * name = 0, const char * file=0) const { | |
122 | return (TClonesArray*)(ReturnO("TrackSegments", name, file)) ; } | |
123 | const AliPHOSTrackSegment * TrackSegment(Int_t index) | |
124 | { if(TrackSegments()) return (AliPHOSTrackSegment*)TrackSegments()->At(index); return 0 ;} | |
125 | const Int_t NTrackSegments() | |
126 | { if(TrackSegments()) return TrackSegments()->GetEntriesFast(); return 0 ;} | |
127 | AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const | |
128 | { return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; } | |
129 | // RecParticles | |
130 | TClonesArray * RecParticles(const char * name = 0, const char * file=0) const { | |
131 | return (TClonesArray*)(ReturnO("RecParticles", name, file)) ; } | |
132 | const AliPHOSRecParticle * RecParticle(Int_t index) | |
133 | { if(RecParticles()) return (AliPHOSRecParticle*)RecParticles()->At(index); return 0 ;} | |
134 | const Int_t NRecParticles() | |
135 | { if(RecParticles()) return RecParticles()->GetEntriesFast(); return 0 ;} | |
136 | AliPHOSPID * PID(const char * name =0) const | |
137 | { return (AliPHOSPID*)(ReturnT("PID", name)) ; } | |
138 | // Primaries | |
139 | const TParticle * Primary(Int_t index) const ; | |
140 | const Int_t NPrimaries()const { return fNPrimaries; } | |
141 | ||
142 | ||
143 | AliPHOSGetter & operator = (const AliPHOSGetter & ) { | |
144 | // assignement operator requested by coding convention | |
145 | // but not needed | |
146 | abort() ; | |
147 | return *this ; | |
148 | } | |
149 | ||
150 | private: | |
151 | ||
152 | AliPHOSGetter(const char* headerFile, const char* branchTitle =0) ; | |
153 | void CreateWhiteBoard() const ; | |
154 | const TObject * ReturnO(TString what, TString name=0, TString file=0) const ; | |
155 | const TTask * ReturnT(TString what,TString name=0) const ; | |
156 | void DefineBranchTitles(char* branch, char* branchTitle) ; | |
157 | void ReadTreeD() ; | |
158 | void ReadTreeH() ; | |
159 | void ReadTreeQA() ; | |
160 | void ReadTreeR() ; | |
161 | void ReadTreeS() ; | |
162 | void ReadPrimaries() ; | |
163 | ||
164 | private: | |
165 | ||
166 | TString fHeaderFile ; //! | |
167 | TString fTrackSegmentsTitle ;//! | |
168 | TString fRecPointsTitle ;//! | |
169 | TString fRecParticlesTitle ;//! | |
170 | TString fDigitsTitle ; //! | |
171 | TString fSDigitsTitle ; //! | |
172 | ||
173 | Int_t fNPrimaries ; //! # of primaries | |
174 | ||
175 | TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing | |
176 | ||
177 | static AliPHOSGetter * fgObjGetter ; // pointer to the unique instance of the singleton | |
178 | ||
179 | ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index | |
180 | ||
181 | }; | |
182 | ||
183 | #endif // AliPHOSGETTER_H |