]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALGetter.h
Added Starting track location to hit class and related changes to modules.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGetter.h
CommitLineData
ffa6d63b 1#ifndef ALIEMCALGETTER_H
2#define ALIEMCALGETTER_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.
d75bea67 13//
ffa6d63b 14// The objects are retrived from folders.
d75bea67 15//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
16//
ffa6d63b 17
18
19// --- ROOT system ---
20#include "TClonesArray.h"
21#include "TFolder.h"
22#include "TTree.h"
68853e3a 23#include "TFile.h"
ffa6d63b 24class TString ;
25class TParticle ;
26class TTask ;
27
28// --- Standard library ---
29#include <stdlib.h>
30#include <iostream.h>
31
32// --- AliRoot header files ---
33
34#include "AliRun.h"
35#include "AliEMCALv1.h"
472319e5 36#include "AliEMCALHit.h"
37#include "AliEMCALDigit.h"
38#include "AliEMCALDigitizer.h"
39#include "AliEMCALSDigitizer.h"
f07cab21 40#include "AliEMCALTowerRecPoint.h"
ffa6d63b 41class AliEMCALGeometry ;
ea4de7a2 42class AliEMCALClusterizerv1 ;
d75bea67 43//class AliEMCALTrackSegment ;
44//class AliEMCALTrackSegmentMaker ;
45//class AliEMCALRecParticle ;
46//class AliEMCALPID ;
ffa6d63b 47
48class AliEMCALGetter : public TObject {
49
50 public:
51
52 AliEMCALGetter(){
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 AliEMCALGetter(const AliEMCALGetter & obj) {
58 // cpy ctor requested by Coding Convention
59 // but not yet needed
60 abort() ;
61 }
62
63 virtual ~AliEMCALGetter() ;
64
65549808 65 void CloseFile() ;
28b243ad 66 const Bool_t HasFailed(void) const {return fFailed ;}
ffa6d63b 67 Bool_t PostHits(void ) const ;
68 Bool_t PostSDigits( const char * name, const char * file = 0) const ;
69 Bool_t PostDigits( const char * name ) const ;
f07cab21 70 Bool_t PostRecPoints( const char * name ) const ;
d75bea67 71 //Bool_t PostTrackSegments(const char * name) const ;
72 //Bool_t PostRecParticles( const char * name) const ;
ffa6d63b 73
f07cab21 74 Bool_t PostClusterizer( const char * name) const ;
ea4de7a2 75 Bool_t PostClusterizer(AliEMCALClusterizerv1 * clu) const ;
f07cab21 76 Bool_t PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ;
ffa6d63b 77 Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
78 Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ;
79 Bool_t PostDigitizer ( const char * name) const ;
d75bea67 80 //Bool_t PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsm) const ;
81 //Bool_t PostTrackSegmentMaker(const char * name ) const ;
82 //Bool_t PostPID (AliEMCALPID * pid) const ;
83 //Bool_t PostPID (const char * name ) const ;
84 //Bool_t PostQA (void) const ;
ffa6d63b 85
86
f07cab21 87 void Event(const Int_t event, const char * opt = "HSDR") ;
ffa6d63b 88 void Track(Int_t itrack) ;
89
90 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
91 void ReadTreeS(TTree * treeS,Int_t input) ;
92
93 Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
94 Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
95 static AliEMCALGetter * GetInstance(const char* headerFile,
472319e5 96 const char* branchTitle = "Default", const Option_t * rw="" ) ;
ffa6d63b 97 static AliEMCALGetter * GetInstance() ;
98
d75bea67 99 const AliEMCALv1 * EMCAL() ;
f07cab21 100 AliEMCALGeometry * EMCALGeometry() ;
d75bea67 101 // Alarms
102 //TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; }
103 //TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; }
104
105 // QA Tasks
106 //TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
ffa6d63b 107
472319e5 108 // Primaries
109 TClonesArray * Primaries(void) const { return (TClonesArray*)(ReturnO("Primaries")) ; }
110
111
ffa6d63b 112 // Hits
472319e5 113 const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; }
114 const AliEMCALHit * Hit(Int_t index) { return static_cast<const AliEMCALHit*>(Hits()->At(index) );}
115
ffa6d63b 116 // SDigits
472319e5 117 TClonesArray * SDigits(const char * name = 0, const char * file=0) {
118 return static_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ;
119 }
120 const AliEMCALDigit * SDigit(Int_t index) { return static_cast<const AliEMCALDigit*>(SDigits()->At(index)) ;}
121
122 AliEMCALSDigitizer * SDigitizer(const char * name =0) const {
123 return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ;
124 }
125
ffa6d63b 126 // Digits
472319e5 127 TClonesArray * Digits(const char * name = 0)const {
128 return static_cast<TClonesArray*>(ReturnO("Digits", name)) ;
129 }
130 const AliEMCALDigit * Digit(Int_t index) { return static_cast<const AliEMCALDigit *>(Digits()->At(index)) ;}
131 AliEMCALDigitizer * Digitizer(const char * name =0) const {
132 return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ;
133 }
ffa6d63b 134
f07cab21 135 // RecPoints
136 TObjArray * TowerRecPoints(const char * name = 0) const {
137 return (TObjArray*)(ReturnO("TowerRecPoints", name)) ; }
138 TObjArray * PreShowerRecPoints(const char * name = 0) const {
139 return (TObjArray*)(ReturnO("PreShoRecPoints", name)) ; }
140 const AliEMCALTowerRecPoint * TowerRecPoint(Int_t index) {
141 return static_cast<const AliEMCALTowerRecPoint *>(TowerRecPoints()->At(index)) ;}
142 const AliEMCALTowerRecPoint * PreShowerRecPoint(Int_t index) {
143 return static_cast<const AliEMCALTowerRecPoint *>(PreShowerRecPoints()->At(index)) ;}
d75bea67 144
ea4de7a2 145 AliEMCALClusterizerv1 * Clusterizer (const char * name =0) const {
146 return (AliEMCALClusterizerv1*)(ReturnT("Clusterizer", name)) ; }
d75bea67 147
148 // TrackSegments
149 //TClonesArray * TrackSegments(const char * name = 0) const
150 // { return (TClonesArray*)(ReturnO("TrackSegments", name)) ; }
151 //AliEMCALTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const
152 // { return (AliEMCALTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
153
154 // RecParticles
155 //TClonesArray * RecParticles(const char * name = 0) const
156 // { return (TClonesArray*)(ReturnO("RecParticles", name)) ; }
157 //AliEMCALPID * PID(const char * name =0) const
158 // { return (AliEMCALPID*)(ReturnT("PID", name)) ; }
159
ffa6d63b 160 // Primaries
161 const TParticle * Primary(Int_t index) const ;
162 const Int_t NPrimaries()const { return fNPrimaries; }
163
65549808 164 void RemoveTask(TString opt, TString name) const ;
165 void RemoveObjects(TString opt, TString name) const ;
166 void RemoveSDigits() const ;
167 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
ffa6d63b 168
169 AliEMCALGetter & operator = (const AliEMCALGetter & ) {
170 // assignement operator requested by coding convention, but not needed
171 abort() ;
172 return *this ;
173 }
174
175 TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; }
176
177 private:
178
472319e5 179 AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default", const Option_t * rw ="") ;
ffa6d63b 180 void CreateWhiteBoard() const ;
472319e5 181 TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
ffa6d63b 182 const TTask * ReturnT(TString what,TString name=0) const ;
183 void DefineBranchTitles(char* branch, char* branchTitle) ;
184 void ReadTreeD() ;
185 void ReadTreeH() ;
f07cab21 186 void ReadTreeR() ;
ffa6d63b 187 void ReadTreeS(Int_t event) ;
d75bea67 188 //void ReadTreeQA() ;
ffa6d63b 189 void ReadPrimaries() ;
190
472319e5 191 TObject ** HitsRef(void) const ;
192 TObject ** SDigitsRef(const char * name, const char * file = 0 ) const;
193 TObject ** DigitsRef (const char * name) const ;
f07cab21 194 TObject ** TowerRecPointsRef (const char * name) const ;
195 TObject ** PreShoRecPointsRef (const char * name) const ;
472319e5 196 //TObject ** TrackSegmentsRef(const char * name) const ;
197 //TObject ** RecParticlesRef (const char * name) const ;
198 //TObject ** AlarmsRef (void) const ;
199
200 TObject ** SDigitizerRef (const char * name) const ;
201 TObject ** DigitizerRef (const char * name) const ;
f07cab21 202 TObject ** ClusterizerRef(const char * name) const ;
472319e5 203 //TObject ** TSMakerRef (const char * name) const ;
204 //TObject ** PIDRef (const char * name) const ;
ffa6d63b 205
206 private:
207
52ea052c 208 static TFile * fFile ; //!
ffa6d63b 209 TString fHeaderFile ; //! File in which gAlice lives
210 TString fBranchTitle ; //!
d75bea67 211 //TString fTrackSegmentsTitle ;//!
f07cab21 212 TString fRecPointsTitle ; //!
d75bea67 213 //TString fRecParticlesTitle ; //!
ffa6d63b 214 TString fDigitsTitle ; //!
215 TString fSDigitsTitle ; //!
216
28b243ad 217 Bool_t fFailed ; //! true if file is not opened and/or galice not found
ffa6d63b 218 Int_t fDebug ; // Debug level
219
220 Int_t fNPrimaries ; //! # of primaries
221
222 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
223
d75bea67 224 TFolder * fModuleFolder ; //!Folder that contains the modules
ffa6d63b 225 TFolder * fHitsFolder ; //!Folder that contains the Hits
226 TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
227 TFolder * fDigitsFolder ; //!Folder that contains the Digits
f07cab21 228 TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles)
d75bea67 229 //TFolder * fQAFolder ; //!Folder that contains the QA objects
ffa6d63b 230 TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
d75bea67 231
ffa6d63b 232 static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
233
234 ClassDef(AliEMCALGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
235
236};
237
238#endif // AliEMCALGETTER_H