]>
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 ;} | |
66 | TParticle * GimePrimary(Int_t index) ; | |
67 | AliPHOSRecParticle * GimeRecParticle(Int_t index) | |
68 | { if(fRecParticles) return (AliPHOSRecParticle*)fRecParticles->At(index); | |
69 | else return 0 ;} | |
70 | AliPHOSEmcRecPoint * GimeEmcRecPoint(Int_t index) | |
71 | { if(fEmcRecPoints) return (AliPHOSEmcRecPoint*)fEmcRecPoints->At(index); | |
72 | else return 0 ;} | |
73 | AliPHOSRecPoint * GimeCpvRecPoint(Int_t index) | |
74 | { if(fCpvRecPoints) return (AliPHOSRecPoint*)fCpvRecPoints->At(index); | |
75 | else return 0 ;} | |
76 | AliPHOSTrackSegment * GimeTrackSegment(Int_t index) | |
77 | { if(fTS) return (AliPHOSTrackSegment*)fTS->At(index); | |
78 | else return 0 ;} | |
79 | AliPHOSDigitizer* GimeDigitizer() | |
80 | { return fDigitizer; } | |
81 | AliPHOSClusterizer* GimeClusterizer() | |
82 | { return fClusterizer; } | |
83 | AliPHOSTrackSegmentMaker* GimeTSMaker() | |
84 | { return fTSMaker; } | |
85 | AliPHOSPID * GimePID() | |
86 | { return fPID; } | |
83974468 | 87 | |
2f04ed65 | 88 | AliPHOSIndexToObject & operator = (const AliPHOSIndexToObject & ) { |
6c370def | 89 | // assignement operator requested by coding convention |
90 | // but not needed | |
3e3852a0 | 91 | abort() ; |
6c370def | 92 | return *this ; |
93 | } | |
94 | ||
83974468 | 95 | private: |
96 | ||
3e3852a0 | 97 | AliPHOSIndexToObject(char* headerFile,char* branch = "RecParticles", |
98 | char* branchTitle =0) ; | |
99 | Bool_t ReadRecParticles(char * branchTitle) ; | |
100 | Bool_t ReadTS(char * branchTitle) ; | |
101 | Bool_t ReadRecPoints(char * branchTitle) ; | |
102 | Bool_t ReadDigits(char * branchTitle) ; | |
103 | Bool_t ReadPrimaries() ; | |
104 | ||
105 | ||
106 | private: | |
107 | ||
108 | TString fHeaderFile ; | |
109 | ||
110 | Int_t fEvent ; //! Current event | |
111 | Int_t fMaxEvent ; //! Number of events in currect headers file | |
112 | ||
113 | TClonesArray * fDigits ; //! list of digits | |
114 | TObjArray * fEmcRecPoints ; //! emc rec points | |
115 | TObjArray * fCpvRecPoints ; //! CPV/PPSD rec points | |
116 | TClonesArray * fTS ; //! TrackSegments | |
117 | TClonesArray * fRecParticles ; //! RecParticles | |
118 | TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing | |
83974468 | 119 | |
3e3852a0 | 120 | AliPHOSDigitizer * fDigitizer ; |
121 | AliPHOSClusterizer* fClusterizer ; | |
122 | AliPHOSTrackSegmentMaker * fTSMaker ; | |
123 | AliPHOSPID * fPID ; | |
83974468 | 124 | |
88714635 | 125 | static AliPHOSIndexToObject * fgObjGetter ; // pointer to the unique instance of the singleton |
83974468 | 126 | |
127 | ClassDef(AliPHOSIndexToObject,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index | |
128 | ||
129 | }; | |
130 | ||
131 | #endif // AliPHOSINDEXTOOBJECT_H |