Two Particle Function -> One Pair; FourPart -> TwoPair
[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"
4ae78bb1 23class TString ;
24class TParticle ;
25class TTask ;
26
27// --- Standard library ---
f404725b 28#include <stdlib.h>
931e9fdb 29#include <iostream.h>
4ae78bb1 30
31// --- AliRoot header files ---
32
7a9d98f9 33#include "AliRun.h"
34#include "AliPHOS.h"
4ae78bb1 35class AliPHOSGeometry ;
36class AliPHOSHit ;
37class AliPHOSDigit ;
38class AliPHOSDigitizer ;
39class AliPHOSSDigitizer ;
40class AliPHOSEmcRecPoint ;
b0bba0af 41class AliPHOSCpvRecPoint ;
4ae78bb1 42class AliPHOSClusterizer ;
43class AliPHOSTrackSegment ;
44class AliPHOSTrackSegmentMaker ;
45class AliPHOSRecParticle ;
46class AliPHOSPID ;
47
48class AliPHOSGetter : public TObject {
49
50 public:
51
52 AliPHOSGetter(){
53 // ctor: this is a singleton, the ctor should never be called but cint needs it as public
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
b0bba0af 65 Bool_t PostHits(void ) const ;
66 Bool_t PostSDigits( const char * name, const char * file = 0) const ;
67 Bool_t PostDigits( const char * name ) const ;
68 Bool_t PostRecPoints( const char * name ) const ;
69 Bool_t PostTrackSegments(const char * name) const ;
70 Bool_t PostRecParticles( const char * name) const ;
71
72 Bool_t PostClusterizer( const char * name) const ;
73 Bool_t PostClusterizer(AliPHOSClusterizer * clu) const ;
74 Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ;
75 Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
76 Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ;
77 Bool_t PostDigitizer ( const char * name) const ;
78 Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ;
79 Bool_t PostTrackSegmentMaker(const char * name ) const ;
80 Bool_t PostPID (AliPHOSPID * pid) const ;
7a9d98f9 81 Bool_t PostPID (const char * name ) const ;
82 Bool_t PostQA (void) const ;
b0bba0af 83
84
85 void Event(const Int_t event, const char * opt = "HSDRQ") ;
86 void Track(Int_t itrack) ;
87
88 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
89 void ReadTreeS(TTree * treeS,Int_t input) ;
90
91 Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
92 Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
4ae78bb1 93 static AliPHOSGetter * GetInstance(const char* headerFile,
b0bba0af 94 const char* branchTitle = "Default" ) ;
95 static AliPHOSGetter * GetInstance() ;
96
7a9d98f9 97 const AliPHOS * PHOS() ;
98 const AliPHOSGeometry * PHOSGeometry() ;
b0bba0af 99 // Alarms
7a9d98f9 100 TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; }
101 TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; }
4ae78bb1 102
eb9763ac 103 // QA Tasks
104 TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
105
4ae78bb1 106 // Hits
b0bba0af 107 TClonesArray * Hits(void) const { return (TClonesArray*)(ReturnO("Hits")) ; }
108
4ae78bb1 109 // SDigits
b0bba0af 110 TClonesArray * SDigits(const char * name = 0, const char * file=0) const
111 { return (TClonesArray*)(ReturnO("SDigits", name, file)) ; }
112
113 AliPHOSSDigitizer * SDigitizer(const char * name =0) const
114 { return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ; }
115
4ae78bb1 116 // Digits
b0bba0af 117 TClonesArray * Digits(const char * name = 0) const
118 { return (TClonesArray*)(ReturnO("Digits", name)) ; }
119 AliPHOSDigitizer * Digitizer(const char * name =0) const
120 { return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; }
121
4ae78bb1 122 // RecPoints
b0bba0af 123 TObjArray * EmcRecPoints(const char * name = 0) const {
124 return (TObjArray*)(ReturnO("EmcRecPoints", name)) ; }
125 TObjArray * CpvRecPoints(const char * name = 0) const {
126 return (TObjArray*)(ReturnO("CpvRecPoints", name)) ; }
127
4ae78bb1 128 AliPHOSClusterizer * Clusterizer (const char * name =0) const
b0bba0af 129 { return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ; }
130
4ae78bb1 131 // TrackSegments
b0bba0af 132 TClonesArray * TrackSegments(const char * name = 0) const
133 { return (TClonesArray*)(ReturnO("TrackSegments", name)) ; }
4ae78bb1 134 AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const
b0bba0af 135 { return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
136
4ae78bb1 137 // RecParticles
b0bba0af 138 TClonesArray * RecParticles(const char * name = 0) const
139 { return (TClonesArray*)(ReturnO("RecParticles", name)) ; }
140 AliPHOSPID * PID(const char * name =0) const
141 { return (AliPHOSPID*)(ReturnT("PID", name)) ; }
142
4ae78bb1 143 // Primaries
144 const TParticle * Primary(Int_t index) const ;
145 const Int_t NPrimaries()const { return fNPrimaries; }
146
b0bba0af 147 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
4ae78bb1 148
149 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
b0bba0af 150 // assignement operator requested by coding convention, but not needed
4ae78bb1 151 abort() ;
152 return *this ;
153 }
154
7a9d98f9 155 TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ; }
156
4ae78bb1 157 private:
158
b0bba0af 159 AliPHOSGetter(const char* headerFile, const char* branchTitle ="Default") ;
4ae78bb1 160 void CreateWhiteBoard() const ;
161 const TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
162 const TTask * ReturnT(TString what,TString name=0) const ;
163 void DefineBranchTitles(char* branch, char* branchTitle) ;
164 void ReadTreeD() ;
165 void ReadTreeH() ;
4ae78bb1 166 void ReadTreeR() ;
b0bba0af 167 void ReadTreeS(Int_t event) ;
168 void ReadTreeQA() ;
4ae78bb1 169 void ReadPrimaries() ;
170
7a9d98f9 171 void * HitsRef(void) const ;
172 void * SDigitsRef(const char * name, const char * file = 0 ) const;
173 void * DigitsRef (const char * name) const ;
174 void * EmcRecPointsRef (const char * name) const ;
175 void * CpvRecPointsRef (const char * name) const ;
176 void * TrackSegmentsRef(const char * name) const ;
177 void * RecParticlesRef (const char * name) const ;
178 void * AlarmsRef (void) const ;
179
180 void * SDigitizerRef (const char * name) const ;
181 void * DigitizerRef (const char * name) const ;
182 void * ClusterizerRef(const char * name) const ;
183 void * TSMakerRef (const char * name) const ;
184 void * PIDRef (const char * name) const ;
b0bba0af 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
7a9d98f9 202 TFolder * fModuleFolder ; //!Folder that contains the modules
203 TFolder * fHitsFolder ; //!Folder that contains the Hits
204 TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
205 TFolder * fDigitsFolder ; //!Folder that contains the Digits
206 TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles)
207 TFolder * fQAFolder ; //!Folder that contains the QA objects
208 TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
209
b0bba0af 210 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
4ae78bb1 211
212 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
213
214};
215
216#endif // AliPHOSGETTER_H