]>
Commit | Line | Data |
---|---|---|
83974468 | 1 | #ifndef ALIPHOSINDEXTOOBJECT_H |
2 | #define ALIPHOSINDEXTOOBJECT_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 | //_________________________________________________________________________ | |
3e3852a0 | 9 | // A singleton that returns objects from their indexes. |
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 | //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) | |
15 | // | |
83974468 | 16 | |
17 | ||
18 | // --- ROOT system --- | |
3e3852a0 | 19 | #include "TClonesArray.h" |
20 | class TString ; | |
21 | class TParticle ; | |
83974468 | 22 | |
23 | // --- Standard library --- | |
24 | ||
83974468 | 25 | // --- AliRoot header files --- |
26 | ||
3e3852a0 | 27 | class AliPHOSDigit ; |
28 | class AliPHOSDigitizer ; | |
29 | class AliPHOSEmcRecPoint ; | |
30 | class AliPHOSRecPoint ; | |
31 | class AliPHOSClusterizer ; | |
32 | class AliPHOSTrackSegment ; | |
33 | class AliPHOSTrackSegmentMaker ; | |
34 | class AliPHOSRecParticle ; | |
35 | class AliPHOSPID ; | |
83974468 | 36 | |
37 | class AliPHOSIndexToObject : public TObject { | |
38 | ||
39 | public: | |
40 | ||
88714635 | 41 | AliPHOSIndexToObject(){ |
3e3852a0 | 42 | // ctor: this is a singleton, the ctor should never be called but cint needs it as public |
43 | abort() ; | |
88714635 | 44 | } |
6c370def | 45 | AliPHOSIndexToObject(const AliPHOSIndexToObject & obj) { |
46 | // cpy ctor requested by Coding Convention | |
47 | // but not yet needed | |
3e3852a0 | 48 | abort() ; |
6c370def | 49 | } |
50 | ||
88714635 | 51 | virtual ~AliPHOSIndexToObject(){ |
52 | // dtor | |
53 | } | |
83974468 | 54 | |
3e3852a0 | 55 | void GetEvent(Int_t event) ; // reads event from file |
56 | Int_t GetEventNumber(){ return fEvent; } | |
57 | Int_t GetMaxEvent() { return fMaxEvent;} | |
58 | ||
59 | static AliPHOSIndexToObject * GetInstance(char* headerFile,char* branch = "PHOSRP", | |
60 | char* branchTitle =0 ) ; | |
83974468 | 61 | static AliPHOSIndexToObject * GetInstance() ; |
62 | ||
3e3852a0 | 63 | AliPHOSDigit * GimeDigit(Int_t index) |
64 | {if(fDigits) return (AliPHOSDigit*)fDigits->At(index); | |
65 | else return 0 ;} | |
4b41854d | 66 | Int_t GimeNDigits() |
67 | {if(fDigits) return fDigits->GetEntriesFast(); | |
68 | else return 0 ;} | |
3e3852a0 | 69 | TParticle * GimePrimary(Int_t index) ; |
70 | AliPHOSRecParticle * GimeRecParticle(Int_t index) | |
71 | { if(fRecParticles) return (AliPHOSRecParticle*)fRecParticles->At(index); | |
72 | else return 0 ;} | |
4b41854d | 73 | Int_t GimeNRecParticles() |
74 | { if(fRecParticles) return fRecParticles->GetEntriesFast(); | |
75 | else return 0 ;} | |
3e3852a0 | 76 | AliPHOSEmcRecPoint * GimeEmcRecPoint(Int_t index) |
77 | { if(fEmcRecPoints) return (AliPHOSEmcRecPoint*)fEmcRecPoints->At(index); | |
78 | else return 0 ;} | |
4b41854d | 79 | Int_t GimeNEmcRecPoints() |
80 | { if(fEmcRecPoints) return fEmcRecPoints->GetEntriesFast(); | |
81 | else return 0 ;} | |
3e3852a0 | 82 | AliPHOSRecPoint * GimeCpvRecPoint(Int_t index) |
83 | { if(fCpvRecPoints) return (AliPHOSRecPoint*)fCpvRecPoints->At(index); | |
84 | else return 0 ;} | |
4b41854d | 85 | Int_t GimeNCpvRecPoints() |
86 | { if(fCpvRecPoints) return fCpvRecPoints->GetEntriesFast(); | |
87 | else return 0 ;} | |
3e3852a0 | 88 | AliPHOSTrackSegment * GimeTrackSegment(Int_t index) |
89 | { if(fTS) return (AliPHOSTrackSegment*)fTS->At(index); | |
90 | else return 0 ;} | |
4b41854d | 91 | Int_t GimeNTrackSegments() |
92 | { if(fTS) return fTS->GetEntriesFast(); | |
93 | else return 0 ;} | |
3e3852a0 | 94 | AliPHOSDigitizer* GimeDigitizer() |
95 | { return fDigitizer; } | |
96 | AliPHOSClusterizer* GimeClusterizer() | |
97 | { return fClusterizer; } | |
98 | AliPHOSTrackSegmentMaker* GimeTSMaker() | |
99 | { return fTSMaker; } | |
100 | AliPHOSPID * GimePID() | |
101 | { return fPID; } | |
83974468 | 102 | |
2f04ed65 | 103 | AliPHOSIndexToObject & operator = (const AliPHOSIndexToObject & ) { |
6c370def | 104 | // assignement operator requested by coding convention |
105 | // but not needed | |
3e3852a0 | 106 | abort() ; |
6c370def | 107 | return *this ; |
108 | } | |
109 | ||
83974468 | 110 | private: |
111 | ||
3e3852a0 | 112 | AliPHOSIndexToObject(char* headerFile,char* branch = "RecParticles", |
113 | char* branchTitle =0) ; | |
114 | Bool_t ReadRecParticles(char * branchTitle) ; | |
115 | Bool_t ReadTS(char * branchTitle) ; | |
116 | Bool_t ReadRecPoints(char * branchTitle) ; | |
117 | Bool_t ReadDigits(char * branchTitle) ; | |
118 | Bool_t ReadPrimaries() ; | |
119 | ||
120 | ||
121 | private: | |
122 | ||
123 | TString fHeaderFile ; | |
124 | ||
125 | Int_t fEvent ; //! Current event | |
126 | Int_t fMaxEvent ; //! Number of events in currect headers file | |
127 | ||
128 | TClonesArray * fDigits ; //! list of digits | |
129 | TObjArray * fEmcRecPoints ; //! emc rec points | |
130 | TObjArray * fCpvRecPoints ; //! CPV/PPSD rec points | |
131 | TClonesArray * fTS ; //! TrackSegments | |
132 | TClonesArray * fRecParticles ; //! RecParticles | |
133 | TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing | |
83974468 | 134 | |
3e3852a0 | 135 | AliPHOSDigitizer * fDigitizer ; |
136 | AliPHOSClusterizer* fClusterizer ; | |
137 | AliPHOSTrackSegmentMaker * fTSMaker ; | |
138 | AliPHOSPID * fPID ; | |
83974468 | 139 | |
88714635 | 140 | static AliPHOSIndexToObject * fgObjGetter ; // pointer to the unique instance of the singleton |
83974468 | 141 | |
142 | ClassDef(AliPHOSIndexToObject,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index | |
143 | ||
144 | }; | |
145 | ||
146 | #endif // AliPHOSINDEXTOOBJECT_H |