]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSIndexToObject.h
corrected a bug in the root geometry: several TNode were created with the same name
[u/mrichter/AliRoot.git] / PHOS / AliPHOSIndexToObject.h
CommitLineData
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"
c1e1befc 20#include <stdlib.h>
21
3e3852a0 22class TString ;
23class TParticle ;
83974468 24
25// --- Standard library ---
26
83974468 27// --- AliRoot header files ---
28
49e4eefd 29class AliPHOS ;
30class AliPHOSGeometry ;
3e3852a0 31class AliPHOSDigit ;
32class AliPHOSDigitizer ;
6633daf0 33class AliPHOSSDigitizer ;
3e3852a0 34class AliPHOSEmcRecPoint ;
35class AliPHOSRecPoint ;
36class AliPHOSClusterizer ;
37class AliPHOSTrackSegment ;
38class AliPHOSTrackSegmentMaker ;
39class AliPHOSRecParticle ;
40class AliPHOSPID ;
83974468 41
42class AliPHOSIndexToObject : public TObject {
6633daf0 43
44 public:
45
88714635 46 AliPHOSIndexToObject(){
3e3852a0 47 // ctor: this is a singleton, the ctor should never be called but cint needs it as public
48 abort() ;
88714635 49 }
6c370def 50 AliPHOSIndexToObject(const AliPHOSIndexToObject & obj) {
51 // cpy ctor requested by Coding Convention
52 // but not yet needed
3e3852a0 53 abort() ;
6c370def 54 }
6633daf0 55
88714635 56 virtual ~AliPHOSIndexToObject(){
57 // dtor
58 }
6633daf0 59
3e3852a0 60 void GetEvent(Int_t event) ; // reads event from file
61 Int_t GetEventNumber(){ return fEvent; }
62 Int_t GetMaxEvent() { return fMaxEvent;}
49e4eefd 63 AliPHOSGeometry * GetPHOSGeometry() const ;
64 AliPHOS * GetPHOS() const ;
65 static AliPHOSIndexToObject * GetInstance(const char* headerFile,const char* branch = "PHOSRP",
6633daf0 66 const char* branchTitle =0 ) ;
83974468 67 static AliPHOSIndexToObject * GetInstance() ;
68
6633daf0 69 AliPHOSDigit * GimeSDigit(Int_t index)
70 {if(fSDigits) return (AliPHOSDigit*)fSDigits->At(index);
71 return 0 ;}
72 Int_t GimeNSDigits()
73 {if(fSDigits) return fSDigits->GetEntriesFast();
74 return 0 ;}
c63634d9 75 TClonesArray * GimeDigits(){return fDigits ;}
3e3852a0 76 AliPHOSDigit * GimeDigit(Int_t index)
77 {if(fDigits) return (AliPHOSDigit*)fDigits->At(index);
6633daf0 78 return 0 ;}
4b41854d 79 Int_t GimeNDigits()
80 {if(fDigits) return fDigits->GetEntriesFast();
6633daf0 81 return 0 ;}
baef0810 82 TParticle * GimePrimary(Int_t index) const ;
6633daf0 83 Int_t GimeNPrimaries()const { return fNPrimaries; }
3e3852a0 84 AliPHOSRecParticle * GimeRecParticle(Int_t index)
85 { if(fRecParticles) return (AliPHOSRecParticle*)fRecParticles->At(index);
6633daf0 86 return 0 ;}
4b41854d 87 Int_t GimeNRecParticles()
88 { if(fRecParticles) return fRecParticles->GetEntriesFast();
6633daf0 89 return 0 ;}
3e3852a0 90 AliPHOSEmcRecPoint * GimeEmcRecPoint(Int_t index)
91 { if(fEmcRecPoints) return (AliPHOSEmcRecPoint*)fEmcRecPoints->At(index);
6633daf0 92 return 0 ;}
4b41854d 93 Int_t GimeNEmcRecPoints()
94 { if(fEmcRecPoints) return fEmcRecPoints->GetEntriesFast();
6633daf0 95 return 0 ;}
3e3852a0 96 AliPHOSRecPoint * GimeCpvRecPoint(Int_t index)
97 { if(fCpvRecPoints) return (AliPHOSRecPoint*)fCpvRecPoints->At(index);
6633daf0 98 return 0 ;}
4b41854d 99 Int_t GimeNCpvRecPoints()
100 { if(fCpvRecPoints) return fCpvRecPoints->GetEntriesFast();
6633daf0 101 return 0 ;}
3e3852a0 102 AliPHOSTrackSegment * GimeTrackSegment(Int_t index)
103 { if(fTS) return (AliPHOSTrackSegment*)fTS->At(index);
6633daf0 104 return 0 ;}
4b41854d 105 Int_t GimeNTrackSegments()
106 { if(fTS) return fTS->GetEntriesFast();
6633daf0 107 return 0 ;}
108 AliPHOSSDigitizer* GimeSDigitizer()
109 { return fSDigitizer; }
3e3852a0 110 AliPHOSDigitizer* GimeDigitizer()
111 { return fDigitizer; }
112 AliPHOSClusterizer* GimeClusterizer()
113 { return fClusterizer; }
114 AliPHOSTrackSegmentMaker* GimeTSMaker()
115 { return fTSMaker; }
116 AliPHOSPID * GimePID()
117 { return fPID; }
83974468 118
2f04ed65 119 AliPHOSIndexToObject & operator = (const AliPHOSIndexToObject & ) {
6c370def 120 // assignement operator requested by coding convention
121 // but not needed
3e3852a0 122 abort() ;
6c370def 123 return *this ;
124 }
6633daf0 125
83974468 126 private:
127
6633daf0 128 AliPHOSIndexToObject(const char* headerFile,const char* branch = "RecParticles",
129 const char* branchTitle =0) ;
130 void DefineBranchTitles(const char* branch,const char* branchTitle) ;
131 void ReadTreeR() ;
132 void ReadTreeD() ;
133 void ReadTreeS() ;
134 void ReadPrimaries() ;
3e3852a0 135
136 private:
137
6633daf0 138 TString fHeaderFile ; //!
139 TString fRPTitle ; //!
140 TString fTSTitle ; //!
141 TString fRecPointsTitle ;//!
142 TString fDigitsTitle ; //!
143 TString fSDigitsTitle ; //!
3e3852a0 144
6633daf0 145 Int_t fEvent ;
3e3852a0 146 Int_t fMaxEvent ; //! Number of events in currect headers file
6633daf0 147 Int_t fNPrimaries ; //! # of primaries
148
149 TClonesArray * fSDigits ; //! list of Sdigits
3e3852a0 150 TClonesArray * fDigits ; //! list of digits
151 TObjArray * fEmcRecPoints ; //! emc rec points
152 TObjArray * fCpvRecPoints ; //! CPV/PPSD rec points
153 TClonesArray * fTS ; //! TrackSegments
154 TClonesArray * fRecParticles ; //! RecParticles
155 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
83974468 156
6633daf0 157 AliPHOSSDigitizer * fSDigitizer ; //!
158 AliPHOSDigitizer * fDigitizer ; //!
159 AliPHOSClusterizer* fClusterizer ; //!
160 AliPHOSTrackSegmentMaker * fTSMaker ; //!
161 AliPHOSPID * fPID ; //!
83974468 162
88714635 163 static AliPHOSIndexToObject * fgObjGetter ; // pointer to the unique instance of the singleton
83974468 164
165 ClassDef(AliPHOSIndexToObject,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
166
167};
168
169#endif // AliPHOSINDEXTOOBJECT_H