1 #ifndef AliFMDSPECTRADISPLAY_H
2 #define AliFMDSPECTRADISPLAY_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
6 * See cxx source for full Copyright notice
8 /** @file AliFMDDisplay.h
9 @author Christian Holm Christensen <cholm@nbi.dk>
10 @date Mon Mar 27 12:39:09 2006
11 @brief FMD Event display
13 //___________________________________________________________________
15 // The classes defined here, are utility classes for reading in data
16 // for the FMD. They are put in a seperate library to not polute the
17 // normal libraries. The classes are intended to be used as base
18 // classes for customized class that do some sort of analysis on the
19 // various types of data produced by the FMD.
21 #include "AliFMDPattern.h"
23 #include <TGListTree.h>
24 #include <TObjArray.h>
26 #include <RQ_OBJECT.h>
32 class AliFMDSpectraDisplayTop;
33 class AliFMDSpectraDisplayDetector;
34 class AliFMDSpectraDisplayRing;
35 class AliFMDSpectraDisplaySector;
36 class AliFMDSpectraDisplayStrip;
38 //__________________________________________________________________
40 * Base class for elements in the tree.
43 class AliFMDSpectraDisplayElement : public TNamed
51 virtual ~AliFMDSpectraDisplayElement() {}
55 * @param option Draw option
59 virtual void Show(Option_t* option, Double_t l, Double_t h);
61 * Get the top of the tree
65 virtual AliFMDSpectraDisplayTop& GetTop() = 0;
67 * Make histograms for this element.
69 * @param axis Axis specs
71 virtual void MakeHistograms(TAxis* axis);
79 virtual Int_t Compare(const TObject* o) const;
87 AliFMDSpectraDisplayElement(const char* name, const char* title)
88 : TNamed(name, title), fFull(0), fCut(0)
90 AliFMDSpectraDisplayElement(const AliFMDSpectraDisplayElement& o)
95 AliFMDSpectraDisplayElement&
96 operator=(const AliFMDSpectraDisplayElement&) { return *this; }
100 * @param v Value to fill
102 void DoFill(Double_t v);
103 TH1* fFull; // Full spectra
104 TH1* fCut; // Spectra after cut
105 ClassDef(AliFMDSpectraDisplayElement,0); // Element in FMD spectra display
108 //__________________________________________________________________
110 * Top element in FMD spectra display
113 class AliFMDSpectraDisplayTop : public AliFMDSpectraDisplayElement,
120 * @param frame Parent frame
121 * @param canvas Canvas
123 AliFMDSpectraDisplayTop(TGCompositeFrame& frame, TCanvas* canvas);
129 TGListTree& GetList() { return fList; }
131 * Get or add a detector element
133 * @param id Element id
137 AliFMDSpectraDisplayDetector& GetOrAdd(UShort_t id);
147 void Fill(UShort_t d, Char_t ring,
148 UShort_t sec, UShort_t str, Double_t v);
154 TAxis* GetAxis() { return fAxis; }
158 * @param a Axis spec.
160 void SetAxis(TAxis* a);
164 * @return top element
166 AliFMDSpectraDisplayTop& GetTop() { return *this; }
171 * @param e selected entry, if any
172 * @param id Id of entry
174 virtual void HandleEntry(TGListTreeItem* e, Int_t id);
177 * @param f Item selected, if any
178 * @param keysym Key symbol
179 * @param mask Modifier mask
181 virtual void HandleKey(TGListTreeItem* f, UInt_t keysym, UInt_t mask);
184 * @param f Selected item, if any
186 virtual void HandleReturn(TGListTreeItem* f);
190 virtual void ClearList();
194 virtual void ClearCanvas();
198 virtual void UpdateCanvas();
202 virtual void UpdateList();
204 * Return the currently selected entry
206 TGListTreeItem* CurrentEntry() const { return fCurrentEntry; }
208 * @return the currently selected user data (possibly 0)
210 TObject* Current() const;
212 * Selection changed signal
214 void SelectionChanged() { Emit("SelectionChanged()"); }//*SIGNAL*
216 * Get Picture for 1D histogram
218 const TGPicture* GetH1Pic() { return fHist1DIcon; }
222 const TGPicture* GetH2Pic() { return fHist2DIcon; }
226 const TGPicture* GetH3Pic() { return fHist3DIcon; }
230 const TGPicture* GetGPic() { return fGraphIcon; }
236 TGListTreeItem& GetEntry() { return fEntry; }
244 virtual Int_t Compare(const TObject* o) const;
246 AliFMDSpectraDisplayTop(const AliFMDSpectraDisplayTop& o)
247 : AliFMDSpectraDisplayElement(o),
250 fContainer(), // o.fContainer),
251 fList(), // o.fList),
252 fChildren(o.fChildren),
253 fCurrentEntry(o.fCurrentEntry),
255 fHist1DIcon(o.fHist1DIcon),
256 fHist2DIcon(o.fHist2DIcon),
257 fHist3DIcon(o.fHist3DIcon),
258 fGraphIcon(o.fGraphIcon),
263 AliFMDSpectraDisplayTop& operator=(const AliFMDSpectraDisplayTop&)
267 TGLayoutHints fHints; // Layout hints
268 TGCanvas fContainer; // Container
269 TGListTree fList; // List
270 TObjArray fChildren; // Children
271 TGListTreeItem* fCurrentEntry; // Current entry
272 TCanvas* fCanvas; // Canvas
273 const TGPicture* fHist1DIcon; // 1D Histogram Icon
274 const TGPicture* fHist2DIcon; // 2D Histogram Icon
275 const TGPicture* fHist3DIcon; // 3D Histogram Icon
276 const TGPicture* fGraphIcon; // Graph Icon
277 TAxis* fAxis; // The axis to use
278 TGListTreeItem& fEntry; // Entry
280 ClassDef(AliFMDSpectraDisplayTop,0);
283 //__________________________________________________________________
285 * Detector element in FMD spectra display
288 class AliFMDSpectraDisplayDetector : public AliFMDSpectraDisplayElement
297 AliFMDSpectraDisplayDetector(UShort_t det, AliFMDSpectraDisplayTop& top);
303 UShort_t Id() const { return fId; }
305 * Get top of hierarcy
309 AliFMDSpectraDisplayTop& GetTop() { return fParent; }
315 AliFMDSpectraDisplayTop& GetParent() { return fParent; }
317 * Get or add a ring element
323 AliFMDSpectraDisplayRing& GetOrAdd(Char_t id);
332 void Fill(Char_t ring, UShort_t sec, UShort_t str, Double_t v);
339 TGListTreeItem& GetEntry() { return fEntry; }
347 virtual Int_t Compare(const TObject* o) const;
349 UShort_t fId; // Identifier
350 AliFMDSpectraDisplayTop& fParent; // Parent
351 TObjArray fChildren; // Children
352 TGListTreeItem& fEntry; // The entry
353 ClassDef(AliFMDSpectraDisplayDetector,0); // Detector element in FMD spectra
356 //__________________________________________________________________
358 * Ring element in FMD spectra display
361 class AliFMDSpectraDisplayRing : public AliFMDSpectraDisplayElement
370 AliFMDSpectraDisplayRing(Char_t id, AliFMDSpectraDisplayDetector& d);
376 Char_t Id() const { return fId; }
378 * Get detector identifier
382 UShort_t DetectorId() { return fParent.Id(); }
384 * Get top of hierarcy
388 AliFMDSpectraDisplayTop& GetTop() { return fParent.GetTop(); }
390 * Get parent detector
394 AliFMDSpectraDisplayDetector& GetDetector() { return GetParent(); }
396 * Get parent detector
400 AliFMDSpectraDisplayDetector& GetParent() { return fParent; }
402 * Get or add a sector element
408 AliFMDSpectraDisplaySector& GetOrAdd(UShort_t id);
416 void Fill(UShort_t sec, UShort_t str, Double_t v);
422 TGListTreeItem& GetEntry() { return fEntry; }
430 virtual Int_t Compare(const TObject* o) const;
432 AliFMDSpectraDisplayDetector& fParent; // Parent
433 Char_t fId; // Identifier
434 TObjArray fChildren; // Children
435 TGListTreeItem& fEntry; // Entry
436 ClassDef(AliFMDSpectraDisplayRing,0); // Ring element in FMD spectra
439 //__________________________________________________________________
441 * Sector element in FMD spectra display
444 class AliFMDSpectraDisplaySector : public AliFMDSpectraDisplayElement
453 AliFMDSpectraDisplaySector(UShort_t id, AliFMDSpectraDisplayRing& r);
459 UShort_t Id() const { return fId; }
461 * Get detector identifier
465 UShort_t DetectorId() { return fParent.DetectorId(); }
467 * Get ring identifier
471 Char_t RingId() { return fParent.Id(); }
473 * Get top of hierarcy
477 AliFMDSpectraDisplayTop& GetTop() { return fParent.GetTop(); }
479 * Get parent detector
483 AliFMDSpectraDisplayDetector& GetDetector() { return fParent.GetDetector(); }
489 AliFMDSpectraDisplayRing& GetRing() { return fParent; }
495 AliFMDSpectraDisplayRing& GetParent() { return fParent; }
497 * Get or add a strip element
503 AliFMDSpectraDisplayStrip& GetOrAdd(UShort_t id);
510 void Fill(UShort_t str, Double_t v);
516 TGListTreeItem& GetEntry() { return fEntry; }
524 virtual Int_t Compare(const TObject* o) const;
526 AliFMDSpectraDisplayRing& fParent; // PArent
527 UShort_t fId; // Identifier
528 TObjArray fChildren;// Children
529 TGListTreeItem& fEntry; // Entry
530 ClassDef(AliFMDSpectraDisplaySector,0); // Sector element in FMD spectra
533 //__________________________________________________________________
535 * Strip element in FMD spectra display
538 class AliFMDSpectraDisplayStrip : public AliFMDSpectraDisplayElement
547 AliFMDSpectraDisplayStrip(UShort_t id, AliFMDSpectraDisplaySector& s);
553 UShort_t Id() const { return fId; }
555 * Get detector identifier
559 UShort_t DetectorId() { return fParent.DetectorId(); }
561 * Get ring identifier
565 Char_t RingId() { return fParent.RingId(); }
567 * Get sector identifier
571 UShort_t SectorId() { return fParent.Id(); }
573 * Get top of hierarcy
577 AliFMDSpectraDisplayTop& GetTop() { return fParent.GetTop(); }
579 * Get parent detector
583 AliFMDSpectraDisplayDetector& GetDetector() { return fParent.GetDetector(); }
589 AliFMDSpectraDisplayRing& GetRing() { return fParent.GetRing(); }
595 AliFMDSpectraDisplaySector& GetSector() { return fParent; }
601 AliFMDSpectraDisplaySector& GetParent() { return fParent; }
607 void Fill(Double_t v);
613 TGListTreeItem& GetEntry() { return fEntry; }
621 virtual Int_t Compare(const TObject* o) const;
623 AliFMDSpectraDisplaySector& fParent; // Parent
624 UShort_t fId; // Identifier
625 TGListTreeItem& fEntry; // Entry
626 ClassDef(AliFMDSpectraDisplayStrip,0);
629 //____________________________________________________________________
631 * FMD event and spectra display
634 class AliFMDSpectraDisplay : public AliFMDPattern
641 AliFMDSpectraDisplay();
666 Bool_t ProcessHit(AliFMDHit* hit, TParticle* p);
674 Bool_t ProcessDigit(AliFMDDigit* digit);
676 * Process a summable digit
682 Bool_t ProcessSDigit(AliFMDSDigit* sdigit);
684 * Process a raw digit
690 Bool_t ProcessRawDigit(AliFMDDigit* digit);
692 * Process a reconstruction point
698 Bool_t ProcessRecPoint(AliFMDRecPoint* recpoint);
700 * Process and ESD entry
711 Bool_t ProcessESD(UShort_t det, Char_t rng, UShort_t sec, UShort_t str,
712 Float_t x, Float_t mult);
714 TGMainFrame fSelector; // GUI to select spectra
715 AliFMDSpectraDisplayTop fTop; // Top of hierarcy
716 ClassDef(AliFMDSpectraDisplay,0); // FMD event and spectra display
721 //____________________________________________________________________