1 #ifndef ALIPHOSLOADER_H
2 #define ALIPHOSLOADER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 /* History of cvs commits:
11 * Revision 1.12 2006/08/25 16:00:53 kharlov
12 * Compliance with Effective C++AliPHOSHit.cxx
14 * Revision 1.11 2006/08/01 12:15:03 cvetan
15 * Adding a constructor from TFolder. Needed by AliReconstruction plugin scheme
17 * Revision 1.10 2005/05/28 14:19:04 schutz
18 * Compilation warnings fixed by T.P.
22 //_________________________________________________________________________
23 // A singleton that returns various objects
24 // Should be used on the analysis stage to avoid confusing between different
25 // branches of reconstruction tree: e.g. reading RecPoints and TS made from
26 // another set of RecPoints.
28 // The objects are retrived from folders.
29 //-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
33 // --- ROOT system ---
36 #include <TClonesArray.h>
39 // --- Standard library ---
41 // --- AliRoot header files ---
43 #include "AliLoader.h"
44 #include "AliRunLoader.h"
45 #include "AliPHOSClusterizer.h"
46 #include "AliPHOSTrackSegmentMaker.h"
47 #include "AliPHOSPID.h"
51 class AliPHOSEmcRecPoint ;
52 class AliPHOSCpvRecPoint ;
53 class AliPHOSTrackSegment ;
54 class AliPHOSRecParticle ;
55 class AliPHOSSDigitizer ;
56 class AliPHOSDigitizer ;
58 class AliPHOSLoader : public AliLoader {
63 AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername);
64 AliPHOSLoader(const Char_t *detname,TFolder *topfolder);
66 virtual ~AliPHOSLoader() ;
68 Int_t GetEvent();//extends the method on PHOS RecPart posting
69 Int_t SetEvent();//extends the method on PHOS RecPart posting
71 Bool_t BranchExists(const TString& recName);
72 Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree
73 Int_t LoadSDigits(Option_t* opt="");
74 Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree
75 Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree
76 Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree
77 Int_t LoadRecParticles(Option_t* opt="");
79 Int_t PostHits()const; //Posts the
80 Int_t PostSDigits()const;
81 Int_t PostDigits()const;
82 Int_t PostRecPoints()const;
83 Int_t PostTracks()const;
84 Int_t PostRecParticles()const;
86 void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean
88 void CleanHits()const;
89 void CleanSDigits()const;
90 void CleanDigits()const;
91 void CleanRecPoints()const;
92 void CleanTracks()const;
93 void CleanRecParticles();
96 /*******************************************************************/
97 /*******************************************************************/
98 /*******************************************************************/
100 TObject** HitsRef(){return GetDetectorDataRef(Hits());}
101 TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());}
102 TObject** DigitsRef(){return GetDetectorDataRef(Digits());}
103 TObject** EmcRecPointsRef(){return GetDetectorDataRef(EmcRecPoints());}
104 TObject** CpvRecPointsRef(){return GetDetectorDataRef(CpvRecPoints());}
105 TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());}
106 TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());}
107 TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());}
108 void Track(Int_t itrack) ;
110 static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername);
112 //Method to be used when digitizing under AliDigitizationInput, who opens all files etc.
113 Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();}
114 Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();}
116 /* const AliPHOS * PHOS(); */
118 // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); }
119 TObjArray * Alarms() {return 0x0;}
121 /*********************************************/
122 /************ TClonesArrays ***********/
123 /*********************************************/
125 TClonesArray* Hits(void);
126 const AliPHOSHit* Hit(Int_t index);
127 void MakeHitsArray();
128 /**** S D i g i t s ****/
129 TClonesArray* SDigits();
130 const AliPHOSDigit* SDigit(Int_t index);
131 void MakeSDigitsArray();
132 /**** D i g i t s ****/
133 TClonesArray* Digits();
134 const AliPHOSDigit * Digit(Int_t index);
135 void MakeDigitsArray();
136 /**** R e c P o i n t s ****/
137 TObjArray * EmcRecPoints();
138 TObjArray * CpvRecPoints();
139 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) ;
140 const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) ;
141 void MakeRecPointsArray();
142 /**** T r a c k S e g m e n t s ****/
143 TClonesArray * TrackSegments();
144 const AliPHOSTrackSegment * TrackSegment(Int_t index);
145 void MakeTrackSegmentsArray();
146 /**** R e c P a r t ic l e s ****/
147 TClonesArray * RecParticles() ;
148 const AliPHOSRecParticle * RecParticle(Int_t index);
149 void MakeRecParticlesArray();
151 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
152 void SetBranchTitle(const TString& btitle);
154 Int_t GetDebug() const {return fDebug; }
155 TString GetBranchTitle() const {return fBranchTitle;}
158 TString fBranchTitle; //Title of the branch
162 // assignement operator requested by coding convention, but not needed
163 AliPHOSLoader(const AliPHOSLoader &); //Not implemented
164 AliPHOSLoader & operator = (const AliPHOSLoader & ); //Not implemented
169 Int_t ReadRecPoints();
171 Int_t ReadRecParticles();
173 Int_t fDebug ; // Debug level
174 TClonesArray *fTmpHits; //! Temporary array of hits per track
176 static const TString fgkHitsName;//Name for TClonesArray with hits from one event
177 static const TString fgkSDigitsName;//Name for TClonesArray
178 static const TString fgkDigitsName;//Name for TClonesArray
179 static const TString fgkEmcRecPointsName;//Name for TClonesArray
180 static const TString fgkCpvRecPointsName;//Name for TClonesArray
181 static const TString fgkTracksName;//Name for TClonesArray
182 static const TString fgkRecParticlesName;//Name for TClonesArray
184 static const TString fgkEmcRecPointsBranchName;//Name for branch
185 static const TString fgkCpvRecPointsBranchName;//Name for branch
186 static const TString fgkTrackSegmentsBranchName;//Name for branch
187 static const TString fgkRecParticlesBranchName;//Name for branch
190 ClassDef(AliPHOSLoader,4) // Algorithm class that provides methods to retrieve objects from a list knowing the index
194 /******************************************************************************/
195 /**************** I N L I N E S ****************************************/
196 /******************************************************************************/
198 inline TClonesArray* AliPHOSLoader::Hits()
200 return (TClonesArray*)GetDetectorData(fgkHitsName);
202 /******************************************************************************/
204 inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index)
206 const TClonesArray* tcarr = Hits();
208 return (const AliPHOSHit*) tcarr->At(index);
211 /******************************************************************************/
213 inline TClonesArray* AliPHOSLoader::SDigits()
215 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
217 /******************************************************************************/
219 inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index)
221 const TClonesArray* tcarr = SDigits();
223 return (const AliPHOSDigit*) tcarr->At(index);
226 /******************************************************************************/
228 inline TClonesArray* AliPHOSLoader::Digits()
230 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
232 /******************************************************************************/
234 inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index)
236 const TClonesArray* tcarr = Digits();
238 return (const AliPHOSDigit*) tcarr->At(index);
241 /******************************************************************************/
243 inline TObjArray * AliPHOSLoader::EmcRecPoints()
245 return dynamic_cast<TObjArray*>(GetDetectorData(fgkEmcRecPointsName));
247 /******************************************************************************/
249 inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index)
251 TObjArray* tcarr = EmcRecPoints();
253 return (const AliPHOSEmcRecPoint*) tcarr->At(index);
256 /******************************************************************************/
258 inline TObjArray * AliPHOSLoader::CpvRecPoints()
260 return dynamic_cast<TObjArray*>(GetDetectorData(fgkCpvRecPointsName));
262 /******************************************************************************/
264 inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index)
266 TObjArray* tcarr = CpvRecPoints();
268 return (const AliPHOSCpvRecPoint*) tcarr->At(index);
271 /******************************************************************************/
273 inline TClonesArray * AliPHOSLoader::TrackSegments()
275 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
277 /******************************************************************************/
279 inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index)
281 const TClonesArray* tcarr = TrackSegments();
283 return (const AliPHOSTrackSegment*) tcarr->At(index);
286 /******************************************************************************/
288 inline TClonesArray * AliPHOSLoader::RecParticles()
290 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName));
292 /******************************************************************************/
294 inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index)
296 TClonesArray* tcarr = RecParticles();
298 return (const AliPHOSRecParticle*) tcarr->At(index);
302 #endif // AliPHOSLOADER_H