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