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