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 ---
34 #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();
95 //up to now it is only here -> no definition about global/incremental tracking/PID
97 // Int_t WriteRecParticles(Option_t* opt="");//writes the reconstructed particles
98 // Int_t WritePID(Option_t* opt="");//writes the task for PID to file
99 // Bool_t PostPID (AliPHOSPID * pid) const {return kTRUE;}
101 /*******************************************************************/
102 /*******************************************************************/
103 /*******************************************************************/
105 TObject** HitsRef(){return GetDetectorDataRef(Hits());}
106 TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());}
107 TObject** DigitsRef(){return GetDetectorDataRef(Digits());}
108 TObject** EmcRecPointsRef(){return GetDetectorDataRef(EmcRecPoints());}
109 TObject** CpvRecPointsRef(){return GetDetectorDataRef(CpvRecPoints());}
110 TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());}
111 TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());}
112 TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());}
113 void Track(Int_t itrack) ;
115 static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername);
117 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
118 Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();}
119 Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();}
121 /* const AliPHOS * PHOS(); */
123 // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); }
124 TObjArray * Alarms() {return 0x0;}
126 /*********************************************/
127 /************ TClonesArrays ***********/
128 /*********************************************/
130 TClonesArray* Hits(void);
131 const AliPHOSHit* Hit(Int_t index);
132 void MakeHitsArray();
133 /**** S D i g i t s ****/
134 TClonesArray* SDigits();
135 const AliPHOSDigit* SDigit(Int_t index);
136 void MakeSDigitsArray();
137 /**** D i g i t s ****/
138 TClonesArray* Digits();
139 const AliPHOSDigit * Digit(Int_t index);
140 void MakeDigitsArray();
141 /**** R e c P o i n t s ****/
142 TObjArray * EmcRecPoints();
143 TObjArray * CpvRecPoints();
144 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) ;
145 const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) ;
146 void MakeRecPointsArray();
147 /**** T r a c k S e g m e n t s ****/
148 TClonesArray * TrackSegments();
149 const AliPHOSTrackSegment * TrackSegment(Int_t index);
150 void MakeTrackSegmentsArray();
151 /**** R e c P a r t ic l e s ****/
152 TClonesArray * RecParticles() ;
153 const AliPHOSRecParticle * RecParticle(Int_t index);
154 void MakeRecParticlesArray();
156 /*********************************************/
157 /************ T A S K S **************/
158 /*********************************************/
160 // AliPHOSSDigitizer* PHOSSDigitizer(TString name = AliConfig::GetDefaultEventFolderName());
161 //AliPHOSDigitizer* PHOSDigitizer() { return dynamic_cast<AliPHOSDigitizer*>(Digitizer()) ;}
163 AliPHOSPID * PID () const {return dynamic_cast<AliPHOSPID*>(PIDTask()) ;}
164 Int_t LoadPID(Option_t * opt="") const {return LoadPIDTask(opt);}
165 Int_t WritePID(Option_t * opt="") const {return WritePIDTask(opt);}
168 AliPHOSTrackSegmentMaker * TrackSegmentMaker () const { return dynamic_cast<AliPHOSTrackSegmentMaker *>(Tracker()) ;}
169 Int_t LoadTrackSegmentMaker(Option_t * opt="") const {return LoadTracker(opt);}
170 Int_t WriteTrackSegmentMaker(Option_t * opt="") const {return WriteTracker(opt);}
173 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
174 void SetBranchTitle(const TString& btitle);
176 Int_t GetDebug() const {return fDebug; }
177 TString GetBranchTitle() const {return fBranchTitle;}
180 TString fBranchTitle; //Title of the branch
184 // assignement operator requested by coding convention, but not needed
185 AliPHOSLoader(const AliPHOSLoader &); //Not implemented
186 AliPHOSLoader & operator = (const AliPHOSLoader & ); //Not implemented
191 Int_t ReadRecPoints();
193 Int_t ReadRecParticles();
195 Int_t fDebug ; // Debug level
196 TClonesArray *fTmpHits; //! Temporary array of hits per track
198 static const TString fgkHitsName;//Name for TClonesArray with hits from one event
199 static const TString fgkSDigitsName;//Name for TClonesArray
200 static const TString fgkDigitsName;//Name for TClonesArray
201 static const TString fgkEmcRecPointsName;//Name for TClonesArray
202 static const TString fgkCpvRecPointsName;//Name for TClonesArray
203 static const TString fgkTracksName;//Name for TClonesArray
204 static const TString fgkRecParticlesName;//Name for TClonesArray
206 static const TString fgkEmcRecPointsBranchName;//Name for branch
207 static const TString fgkCpvRecPointsBranchName;//Name for branch
208 static const TString fgkTrackSegmentsBranchName;//Name for branch
209 static const TString fgkRecParticlesBranchName;//Name for branch
212 ClassDef(AliPHOSLoader,4) // Algorithm class that provides methods to retrieve objects from a list knowing the index
216 /******************************************************************************/
217 /**************** I N L I N E S ****************************************/
218 /******************************************************************************/
220 inline TClonesArray* AliPHOSLoader::Hits()
222 return (TClonesArray*)GetDetectorData(fgkHitsName);
224 /******************************************************************************/
226 inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index)
228 const TClonesArray* tcarr = Hits();
230 return (const AliPHOSHit*) tcarr->At(index);
233 /******************************************************************************/
235 inline TClonesArray* AliPHOSLoader::SDigits()
237 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
239 /******************************************************************************/
241 inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index)
243 const TClonesArray* tcarr = SDigits();
245 return (const AliPHOSDigit*) tcarr->At(index);
248 /******************************************************************************/
250 inline TClonesArray* AliPHOSLoader::Digits()
252 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
254 /******************************************************************************/
256 inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index)
258 const TClonesArray* tcarr = Digits();
260 return (const AliPHOSDigit*) tcarr->At(index);
263 /******************************************************************************/
265 inline TObjArray * AliPHOSLoader::EmcRecPoints()
267 return dynamic_cast<TObjArray*>(GetDetectorData(fgkEmcRecPointsName));
269 /******************************************************************************/
271 inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index)
273 TObjArray* tcarr = EmcRecPoints();
275 return (const AliPHOSEmcRecPoint*) tcarr->At(index);
278 /******************************************************************************/
280 inline TObjArray * AliPHOSLoader::CpvRecPoints()
282 return dynamic_cast<TObjArray*>(GetDetectorData(fgkCpvRecPointsName));
284 /******************************************************************************/
286 inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index)
288 TObjArray* tcarr = CpvRecPoints();
290 return (const AliPHOSCpvRecPoint*) tcarr->At(index);
293 /******************************************************************************/
295 inline TClonesArray * AliPHOSLoader::TrackSegments()
297 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
299 /******************************************************************************/
301 inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index)
303 const TClonesArray* tcarr = TrackSegments();
305 return (const AliPHOSTrackSegment*) tcarr->At(index);
308 /******************************************************************************/
310 inline TClonesArray * AliPHOSLoader::RecParticles()
312 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName));
314 /******************************************************************************/
316 inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index)
318 TClonesArray* tcarr = RecParticles();
320 return (const AliPHOSRecParticle*) tcarr->At(index);
324 #endif // AliPHOSLOADER_H