]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSGetter.h
Cosmetic changes, and a new function AliL3Hough::ProcessPatchIter.
[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"
7a9d98f9 21#include "TFolder.h"
22#include "TTree.h"
68853e3a 23#include "TFile.h"
4ae78bb1 24class TString ;
25class TParticle ;
26class TTask ;
27
28// --- Standard library ---
f404725b 29#include <stdlib.h>
931e9fdb 30#include <iostream.h>
4ae78bb1 31
32// --- AliRoot header files ---
33
7a9d98f9 34#include "AliRun.h"
35#include "AliPHOS.h"
cb34a1fa 36#include "AliPHOSHit.h"
37#include "AliPHOSDigit.h"
38#include "AliPHOSEmcRecPoint.h"
39#include "AliPHOSCpvRecPoint.h"
40#include "AliPHOSTrackSegment.h"
41#include "AliPHOSRecParticle.h"
4ae78bb1 42class AliPHOSGeometry ;
4ae78bb1 43class AliPHOSDigitizer ;
44class AliPHOSSDigitizer ;
4ae78bb1 45class AliPHOSClusterizer ;
4ae78bb1 46class AliPHOSTrackSegmentMaker ;
4ae78bb1 47class AliPHOSPID ;
48
49class AliPHOSGetter : public TObject {
50
51 public:
52
cb34a1fa 53 AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public
4ae78bb1 54 cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
55 abort() ;
56 }
57 AliPHOSGetter(const AliPHOSGetter & obj) {
58 // cpy ctor requested by Coding Convention
59 // but not yet needed
60 abort() ;
61 }
62
d071065d 63 virtual ~AliPHOSGetter() ;
4ae78bb1 64
65549808 65 void CloseFile() ;
0c87da39 66 const TFolder * Folder(const TString what) const ;
6ad0e528 67 void ListBranches(Int_t event=0) const ;
68 void NewBranch(TString name, Int_t event = 0) ;
c6987a88 69 Bool_t NewFile(TString name) ;
dca3a7c4 70 const Bool_t HasFailed() const { return fFailed ; }
cb34a1fa 71 Bool_t PostPrimaries(void ) const ;
b0bba0af 72 Bool_t PostHits(void ) const ;
73 Bool_t PostSDigits( const char * name, const char * file = 0) const ;
74 Bool_t PostDigits( const char * name ) const ;
75 Bool_t PostRecPoints( const char * name ) const ;
76 Bool_t PostTrackSegments(const char * name) const ;
77 Bool_t PostRecParticles( const char * name) const ;
78
79 Bool_t PostClusterizer( const char * name) const ;
80 Bool_t PostClusterizer(AliPHOSClusterizer * clu) const ;
81 Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ;
82 Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
83 Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ;
84 Bool_t PostDigitizer ( const char * name) const ;
85 Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ;
86 Bool_t PostTrackSegmentMaker(const char * name ) const ;
87 Bool_t PostPID (AliPHOSPID * pid) const ;
7a9d98f9 88 Bool_t PostPID (const char * name ) const ;
89 Bool_t PostQA (void) const ;
b0bba0af 90
91
9fbf3755 92 void Event(const Int_t event, const char * opt = "HSDRP") ;
b0bba0af 93 void Track(Int_t itrack) ;
94
95 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
96 void ReadTreeS(TTree * treeS,Int_t input) ;
97
98 Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
99 Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
4ae78bb1 100 static AliPHOSGetter * GetInstance(const char* headerFile,
b0bba0af 101 const char* branchTitle = "Default" ) ;
102 static AliPHOSGetter * GetInstance() ;
103
7a9d98f9 104 const AliPHOS * PHOS() ;
105 const AliPHOSGeometry * PHOSGeometry() ;
b0bba0af 106 // Alarms
7a9d98f9 107 TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; }
108 TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; }
4ae78bb1 109
eb9763ac 110 // QA Tasks
111 TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
112
cb34a1fa 113 // Primaries
114 TClonesArray * Primaries(void) const { return (TClonesArray*)(ReturnO("Primaries")) ; }
9bd3caba 115
4ae78bb1 116 // Hits
9bd3caba 117 TTree * TreeH(TString filename="") ;
cb34a1fa 118 const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; }
9bd3caba 119 const AliPHOSHit * Hit(Int_t index) { return static_cast<const AliPHOSHit*>(Hits()->At(index) );}
cb34a1fa 120
4ae78bb1 121 // SDigits
9bd3caba 122 TTree * TreeS(TString filename="") ;
cb34a1fa 123 TClonesArray * SDigits(const char * name = 0, const char * file=0) {
124 return static_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ;
125 }
126 const AliPHOSDigit * SDigit(Int_t index) { return static_cast<const AliPHOSDigit*>(SDigits()->At(index)) ;}
127
128 AliPHOSSDigitizer * SDigitizer(const char * name =0) const {
129 return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ;
130 }
131
4ae78bb1 132 // Digits
9bd3caba 133 TTree * TreeD(TString filename="") ;
cb34a1fa 134 TClonesArray * Digits(const char * name = 0)const {
135 return static_cast<TClonesArray*>(ReturnO("Digits", name)) ;
136 }
137 const AliPHOSDigit * Digit(Int_t index) { return static_cast<const AliPHOSDigit *>(Digits()->At(index)) ;}
138 AliPHOSDigitizer * Digitizer(const char * name =0) const {
139 return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ;
140 }
141
4ae78bb1 142 // RecPoints
65c0665e 143 TObjArray * EmcRecPoints(const char * name = 0) {
cb34a1fa 144 return static_cast<TObjArray*>(ReturnO("EmcRecPoints", name)) ;
145 }
146 TObjArray * CpvRecPoints(const char * name = 0) {
147 return static_cast<TObjArray*>(ReturnO("CpvRecPoints", name)) ;
148 }
149 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) {
150 return static_cast<const AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;
151 }
152 const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) {
153 return static_cast<const AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;
154 }
155
156 AliPHOSClusterizer * Clusterizer (const char * name =0) const {
157 return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ;
158 }
159
4ae78bb1 160 // TrackSegments
cb34a1fa 161 TClonesArray * TrackSegments(const char * name = 0) {
162 return static_cast<TClonesArray*>(ReturnO("TrackSegments", name)) ;
163 }
164 const AliPHOSTrackSegment * TrackSegment(Int_t index) {
165 return static_cast<const AliPHOSTrackSegment*>(TrackSegments()->At(index)) ;
166 }
167 AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const {
168 return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ;
169 }
170
4ae78bb1 171 // RecParticles
cb34a1fa 172 TClonesArray * RecParticles(const char * name = 0) {
173 return static_cast<TClonesArray*>(ReturnO("RecParticles", name)) ;
174 }
175 const AliPHOSRecParticle * RecParticle(Int_t index) {
176 return static_cast<const AliPHOSRecParticle*>(RecParticles()->At(index)) ;
177 }
178 AliPHOSPID * PID(const char * name =0) const {
179 return (AliPHOSPID*)(ReturnT("PID", name)) ;
180 }
181
4ae78bb1 182 // Primaries
9bd3caba 183 TTree * TreeK(TString filename="") ;
184 const TParticle * Primary(Int_t index) ;
4ae78bb1 185 const Int_t NPrimaries()const { return fNPrimaries; }
cb34a1fa 186 const TParticle * Secondary(TParticle * p, Int_t index=1) const ;
187
65549808 188 void RemoveTask(TString opt, TString name) const ;
189 void RemoveObjects(TString opt, TString name) const ;
190 void RemoveSDigits() const ;
b0bba0af 191 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
cb34a1fa 192
4ae78bb1 193 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
b0bba0af 194 // assignement operator requested by coding convention, but not needed
4ae78bb1 195 abort() ;
196 return *this ;
197 }
198
7a9d98f9 199 TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ; }
5bf7ace9 200
201 void SetRecParticlesTitle(const TString title) { fRecParticlesTitle = title ; }
cb34a1fa 202
203private:
204
b0bba0af 205 AliPHOSGetter(const char* headerFile, const char* branchTitle ="Default") ;
cb34a1fa 206 TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
4ae78bb1 207 const TTask * ReturnT(TString what,TString name=0) const ;
208 void DefineBranchTitles(char* branch, char* branchTitle) ;
ab3ecbea 209 Int_t ReadTreeD() ;
210 Int_t ReadTreeH() ;
5bf7ace9 211 Int_t ReadTreeR(Bool_t any=kFALSE) ;
ab3ecbea 212 Int_t ReadTreeS(Int_t event) ;
b0bba0af 213 void ReadTreeQA() ;
4ae78bb1 214 void ReadPrimaries() ;
215
65c0665e 216 TObject** PrimariesRef(void) const ;
217 TObject** HitsRef(void) const ;
218 TObject** SDigitsRef(const char * name, const char * file = 0 ) const;
219 TObject** DigitsRef (const char * name) const ;
220 TObject** EmcRecPointsRef (const char * name) const ;
221 TObject** CpvRecPointsRef (const char * name) const ;
222 TObject** TrackSegmentsRef(const char * name) const ;
223 TObject** RecParticlesRef (const char * name) const ;
224 TObject** AlarmsRef (void) const ;
225
226 TObject** SDigitizerRef (const char * name) const ;
227 TObject** DigitizerRef (const char * name) const ;
228 TObject** ClusterizerRef(const char * name) const ;
229 TObject** TSMakerRef (const char * name) const ;
230 TObject** PIDRef (const char * name) const ;
b0bba0af 231
4ae78bb1 232 private:
233
59b46416 234 static TFile * fFile; //!
b0bba0af 235 TString fHeaderFile ; //! File in which gAlice lives
236 TString fBranchTitle ; //!
237 TString fTrackSegmentsTitle ;//!
238 TString fRecPointsTitle ; //!
239 TString fRecParticlesTitle ; //!
59b46416 240 TString fDigitsTitle ; //! TDirectory tempo(gDirectory) ;
241
b0bba0af 242 TString fSDigitsTitle ; //!
4ae78bb1 243
dca3a7c4 244 Bool_t fFailed ; //! set if file not opend or galice not found
b0bba0af 245 Int_t fDebug ; // Debug level
518b8b75 246
9bd3caba 247 AliRun * fAlice ; //! needed to read TreeK if in an other file than fHeaderFile
b0bba0af 248 Int_t fNPrimaries ; //! # of primaries
4ae78bb1 249
b0bba0af 250 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
4ae78bb1 251
7a9d98f9 252 TFolder * fModuleFolder ; //!Folder that contains the modules
cb34a1fa 253 TFolder * fPrimariesFolder ; //!Folder that contains the Primary Particles
7a9d98f9 254 TFolder * fHitsFolder ; //!Folder that contains the Hits
255 TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
256 TFolder * fDigitsFolder ; //!Folder that contains the Digits
257 TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles)
258 TFolder * fQAFolder ; //!Folder that contains the QA objects
259 TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
9bd3caba 260
b0bba0af 261 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
4ae78bb1 262
263 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
264
265};
266
267#endif // AliPHOSGETTER_H