added IsInEMC
[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 ;
b0bba0af 42class AliPHOSCpvRecPoint ;
4ae78bb1 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
b0bba0af 68 Bool_t PostGeometry( void ) const ;
69 Bool_t PostHits(void ) const ;
70 Bool_t PostSDigits( const char * name, const char * file = 0) const ;
71 Bool_t PostDigits( const char * name ) const ;
72 Bool_t PostRecPoints( const char * name ) const ;
73 Bool_t PostTrackSegments(const char * name) const ;
74 Bool_t PostRecParticles( const char * name) const ;
75
76 Bool_t PostClusterizer( const char * name) const ;
77 Bool_t PostClusterizer(AliPHOSClusterizer * clu) const ;
78 Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ;
79 Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
80 Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ;
81 Bool_t PostDigitizer ( const char * name) const ;
82 Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ;
83 Bool_t PostTrackSegmentMaker(const char * name ) const ;
84 Bool_t PostPID (AliPHOSPID * pid) const ;
85 Bool_t PostPID ( const char * name ) const ;
86 Bool_t PostQA ( const char * headerFile ) const ;
87
88
89 void Event(const Int_t event, const char * opt = "HSDRQ") ;
90 void Track(Int_t itrack) ;
91
92 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
93 void ReadTreeS(TTree * treeS,Int_t input) ;
94
95 Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
96 Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
4ae78bb1 97 static AliPHOSGetter * GetInstance(const char* headerFile,
b0bba0af 98 const char* branchTitle = "Default" ) ;
99 static AliPHOSGetter * GetInstance() ;
100
101 const AliPHOS * PHOS() const ;
102 const AliPHOSGeometry * PHOSGeometry() const ;
103 // Alarms
4ae78bb1 104 TFolder * Alarms(const char * name = 0) const { return (TFolder*)(ReturnO("Alarms", name)) ; }
105
eb9763ac 106 // QA Tasks
107 TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
108
4ae78bb1 109 // Hits
b0bba0af 110 TClonesArray * Hits(void) const { return (TClonesArray*)(ReturnO("Hits")) ; }
111
4ae78bb1 112 // SDigits
b0bba0af 113 TClonesArray * SDigits(const char * name = 0, const char * file=0) const
114 { return (TClonesArray*)(ReturnO("SDigits", name, file)) ; }
115
116 AliPHOSSDigitizer * SDigitizer(const char * name =0) const
117 { return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ; }
118
4ae78bb1 119 // Digits
b0bba0af 120 TClonesArray * Digits(const char * name = 0) const
121 { return (TClonesArray*)(ReturnO("Digits", name)) ; }
122 AliPHOSDigitizer * Digitizer(const char * name =0) const
123 { return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; }
124
4ae78bb1 125 // RecPoints
b0bba0af 126 TObjArray * EmcRecPoints(const char * name = 0) const {
127 return (TObjArray*)(ReturnO("EmcRecPoints", name)) ; }
128 TObjArray * CpvRecPoints(const char * name = 0) const {
129 return (TObjArray*)(ReturnO("CpvRecPoints", name)) ; }
130
4ae78bb1 131 AliPHOSClusterizer * Clusterizer (const char * name =0) const
b0bba0af 132 { return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ; }
133
4ae78bb1 134 // TrackSegments
b0bba0af 135 TClonesArray * TrackSegments(const char * name = 0) const
136 { return (TClonesArray*)(ReturnO("TrackSegments", name)) ; }
4ae78bb1 137 AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const
b0bba0af 138 { return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
139
4ae78bb1 140 // RecParticles
b0bba0af 141 TClonesArray * RecParticles(const char * name = 0) const
142 { return (TClonesArray*)(ReturnO("RecParticles", name)) ; }
143 AliPHOSPID * PID(const char * name =0) const
144 { return (AliPHOSPID*)(ReturnT("PID", name)) ; }
145
4ae78bb1 146 // Primaries
147 const TParticle * Primary(Int_t index) const ;
148 const Int_t NPrimaries()const { return fNPrimaries; }
149
b0bba0af 150 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
4ae78bb1 151
152 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
b0bba0af 153 // assignement operator requested by coding convention, but not needed
4ae78bb1 154 abort() ;
155 return *this ;
156 }
157
158 private:
159
b0bba0af 160 AliPHOSGetter(const char* headerFile, const char* branchTitle ="Default") ;
4ae78bb1 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() ;
b0bba0af 168 void ReadTreeS(Int_t event) ;
169 void ReadTreeQA() ;
4ae78bb1 170 void ReadPrimaries() ;
171
b0bba0af 172 TClonesArray ** HitsRef(void) const ;
173 TClonesArray ** SDigitsRef(const char * name, const char * file = 0 ) const;
174 TClonesArray ** DigitsRef (const char * name) const ;
175 TObjArray ** EmcRecPointsRef (const char * name) const ;
176 TObjArray ** CpvRecPointsRef (const char * name) const ;
177 TClonesArray ** TrackSegmentsRef(const char * name) const ;
178 TClonesArray ** RecParticlesRef (const char * name) const ;
179
180 AliPHOSSDigitizer ** SDigitizerRef (const char * name) const ;
181 AliPHOSDigitizer ** DigitizerRef (const char * name) const ;
182 AliPHOSClusterizer ** ClusterizerRef(const char * name) const ;
183 AliPHOSTrackSegmentMaker ** TSMakerRef (const char * name) const ;
184 AliPHOSPID ** PIDRef (const char * name) const ;
185
4ae78bb1 186 private:
187
b0bba0af 188 TString fHeaderFile ; //! File in which gAlice lives
189 TString fBranchTitle ; //!
190 TString fTrackSegmentsTitle ;//!
191 TString fRecPointsTitle ; //!
192 TString fRecParticlesTitle ; //!
193 TString fDigitsTitle ; //!
194 TString fSDigitsTitle ; //!
4ae78bb1 195
b0bba0af 196 Int_t fDebug ; // Debug level
518b8b75 197
b0bba0af 198 Int_t fNPrimaries ; //! # of primaries
4ae78bb1 199
b0bba0af 200 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
4ae78bb1 201
b0bba0af 202 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
4ae78bb1 203
204 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
205
206};
207
208#endif // AliPHOSGETTER_H