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 //____________________________________________________________________
34 * FMD event and spectra display
37 class AliFMDSpectraDisplay : public AliFMDPattern
40 class AliFMDSpectraDisplayTop;
41 class AliFMDSpectraDisplayDetector;
42 class AliFMDSpectraDisplayRing;
43 class AliFMDSpectraDisplaySector;
44 class AliFMDSpectraDisplayStrip;
46 //__________________________________________________________________
48 * Base class for elements in the tree.
51 class AliFMDSpectraDisplayElement : public TNamed
59 virtual ~AliFMDSpectraDisplayElement() {}
63 * @param option Draw option
67 virtual void Show(Option_t* option, Double_t l, Double_t h);
69 * Get the top of the tree
73 virtual AliFMDSpectraDisplayTop& GetTop() = 0;
75 * Make histograms for this element.
77 * @param axis Axis specs
79 virtual void MakeHistograms(const TAxis* axis);
87 virtual Int_t Compare(const TObject* o) const;
95 AliFMDSpectraDisplayElement(const char* name, const char* title)
96 : TNamed(name, title), fFull(0), fCut(0)
98 AliFMDSpectraDisplayElement(const AliFMDSpectraDisplayElement& o)
103 AliFMDSpectraDisplayElement&
104 operator=(const AliFMDSpectraDisplayElement&) { return *this; }
108 * @param v Value to fill
110 void DoFill(Double_t v);
111 TH1* fFull; // Full spectra
112 TH1* fCut; // Spectra after cut
113 ClassDef(AliFMDSpectraDisplayElement,0); // Element in FMD spectra display
116 //__________________________________________________________________
118 * Top element in FMD spectra display
121 class AliFMDSpectraDisplayTop : public AliFMDSpectraDisplayElement,
128 * @param frame Parent frame
129 * @param canvas Canvas
131 AliFMDSpectraDisplayTop(TGCompositeFrame& frame, TCanvas* canvas);
137 TGListTree& GetList() { return fList; }
139 * Get or add a detector element
141 * @param id Element id
145 AliFMDSpectraDisplayDetector& GetOrAdd(UShort_t id);
155 void Fill(UShort_t d, Char_t ring,
156 UShort_t sec, UShort_t str, Double_t v);
162 TAxis* GetAxis() const { return fAxis; }
166 * @param a Axis spec.
168 void SetAxis(TAxis* a);
172 * @return top element
174 AliFMDSpectraDisplayTop& GetTop() { return *this; }
179 * @param e selected entry, if any
180 * @param id Id of entry
182 virtual void HandleEntry(TGListTreeItem* e, Int_t id);
185 * @param f Item selected, if any
186 * @param keysym Key symbol
187 * @param mask Modifier mask
189 virtual void HandleKey(TGListTreeItem* f, UInt_t keysym, UInt_t mask);
192 * @param f Selected item, if any
194 virtual void HandleReturn(TGListTreeItem* f);
198 virtual void ClearList();
202 virtual void ClearCanvas();
206 virtual void UpdateCanvas();
210 virtual void UpdateList();
212 * Return the currently selected entry
214 TGListTreeItem* CurrentEntry() const { return fCurrentEntry; }
216 * @return the currently selected user data (possibly 0)
218 TObject* Current() const;
220 * Selection changed signal
222 void SelectionChanged() { Emit("SelectionChanged()"); }//*SIGNAL*
224 * Get Picture for 1D histogram
226 const TGPicture* GetH1Pic() const { return fkHist1DIcon; }
230 const TGPicture* GetH2Pic() const { return fkHist2DIcon; }
234 const TGPicture* GetH3Pic() const { return fkHist3DIcon; }
238 const TGPicture* GetGPic() const { return fkGraphIcon; }
244 TGListTreeItem& GetEntry() const { return fEntry; }
252 virtual Int_t Compare(const TObject* o) const;
254 AliFMDSpectraDisplayTop(const AliFMDSpectraDisplayTop& o)
255 : AliFMDSpectraDisplayElement(o),
258 fContainer(), // o.fContainer),
259 fList(), // o.fList),
260 fChildren(o.fChildren),
261 fCurrentEntry(o.fCurrentEntry),
263 fkHist1DIcon(o.fkHist1DIcon),
264 fkHist2DIcon(o.fkHist2DIcon),
265 fkHist3DIcon(o.fkHist3DIcon),
266 fkGraphIcon(o.fkGraphIcon),
271 AliFMDSpectraDisplayTop& operator=(const AliFMDSpectraDisplayTop&)
275 TGLayoutHints fHints; // Layout hints
276 TGCanvas fContainer; // Container
277 TGListTree fList; // List
278 TObjArray fChildren; // Children
279 TGListTreeItem* fCurrentEntry; // Current entry
280 TCanvas* fCanvas; // Canvas
281 const TGPicture* fkHist1DIcon; // 1D Histogram Icon
282 const TGPicture* fkHist2DIcon; // 2D Histogram Icon
283 const TGPicture* fkHist3DIcon; // 3D Histogram Icon
284 const TGPicture* fkGraphIcon; // Graph Icon
285 TAxis* fAxis; // The axis to use
286 TGListTreeItem& fEntry; // Entry
288 ClassDef(AliFMDSpectraDisplayTop,0);
291 //__________________________________________________________________
293 * Detector element in FMD spectra display
296 class AliFMDSpectraDisplayDetector : public AliFMDSpectraDisplayElement
305 AliFMDSpectraDisplayDetector(UShort_t det, AliFMDSpectraDisplayTop& top);
311 UShort_t Id() const { return fId; }
313 * Get top of hierarcy
317 AliFMDSpectraDisplayTop& GetTop() { return fParent; }
323 AliFMDSpectraDisplayTop& GetParent() const { return fParent; }
325 * Get or add a ring element
331 AliFMDSpectraDisplayRing& GetOrAdd(Char_t id);
340 void Fill(Char_t ring, UShort_t sec, UShort_t str, Double_t v);
347 TGListTreeItem& GetEntry() const { return fEntry; }
355 virtual Int_t Compare(const TObject* o) const;
357 UShort_t fId; // Identifier
358 AliFMDSpectraDisplayTop& fParent; // Parent
359 TObjArray fChildren; // Children
360 TGListTreeItem& fEntry; // The entry
361 ClassDef(AliFMDSpectraDisplayDetector,0); // Detector element in FMD spectra
364 //__________________________________________________________________
366 * Ring element in FMD spectra display
369 class AliFMDSpectraDisplayRing : public AliFMDSpectraDisplayElement
378 AliFMDSpectraDisplayRing(Char_t id, AliFMDSpectraDisplayDetector& d);
384 Char_t Id() const { return fId; }
386 * Get detector identifier
390 UShort_t DetectorId() const { return fParent.Id(); }
392 * Get top of hierarcy
396 AliFMDSpectraDisplayTop& GetTop() { return fParent.GetTop(); }
398 * Get parent detector
402 AliFMDSpectraDisplayDetector& GetDetector() const { return GetParent(); }
404 * Get parent detector
408 AliFMDSpectraDisplayDetector& GetParent() const { return fParent; }
410 * Get or add a sector element
416 AliFMDSpectraDisplaySector& GetOrAdd(UShort_t id);
424 void Fill(UShort_t sec, UShort_t str, Double_t v);
430 TGListTreeItem& GetEntry() const { return fEntry; }
438 virtual Int_t Compare(const TObject* o) const;
440 AliFMDSpectraDisplayDetector& fParent; // Parent
441 Char_t fId; // Identifier
442 TObjArray fChildren; // Children
443 TGListTreeItem& fEntry; // Entry
444 ClassDef(AliFMDSpectraDisplayRing,0); // Ring element in FMD spectra
447 //__________________________________________________________________
449 * Sector element in FMD spectra display
452 class AliFMDSpectraDisplaySector : public AliFMDSpectraDisplayElement
461 AliFMDSpectraDisplaySector(UShort_t id, AliFMDSpectraDisplayRing& r);
467 UShort_t Id() const { return fId; }
469 * Get detector identifier
473 UShort_t DetectorId() const { return fParent.DetectorId(); }
475 * Get ring identifier
479 Char_t RingId() const { return fParent.Id(); }
481 * Get top of hierarcy
485 AliFMDSpectraDisplayTop& GetTop() { return fParent.GetTop(); }
487 * Get parent detector
491 AliFMDSpectraDisplayDetector& GetDetector() { return fParent.GetDetector(); }
497 AliFMDSpectraDisplayRing& GetRing() { return fParent; }
503 AliFMDSpectraDisplayRing& GetParent() { return fParent; }
505 * Get or add a strip element
511 AliFMDSpectraDisplayStrip& GetOrAdd(UShort_t id);
518 void Fill(UShort_t str, Double_t v);
524 TGListTreeItem& GetEntry() const { return fEntry; }
532 virtual Int_t Compare(const TObject* o) const;
534 AliFMDSpectraDisplayRing& fParent; // PArent
535 UShort_t fId; // Identifier
536 TObjArray fChildren;// Children
537 TGListTreeItem& fEntry; // Entry
538 ClassDef(AliFMDSpectraDisplaySector,0); // Sector element in FMD spectra
541 //__________________________________________________________________
543 * Strip element in FMD spectra display
546 class AliFMDSpectraDisplayStrip : public AliFMDSpectraDisplayElement
555 AliFMDSpectraDisplayStrip(UShort_t id, AliFMDSpectraDisplaySector& s);
561 UShort_t Id() const { return fId; }
563 * Get detector identifier
567 UShort_t DetectorId() const { return fParent.DetectorId(); }
569 * Get ring identifier
573 Char_t RingId() const { return fParent.RingId(); }
575 * Get sector identifier
579 UShort_t SectorId() const { return fParent.Id(); }
581 * Get top of hierarcy
585 AliFMDSpectraDisplayTop& GetTop() { return fParent.GetTop(); }
587 * Get parent detector
591 AliFMDSpectraDisplayDetector& GetDetector() { return fParent.GetDetector(); }
597 AliFMDSpectraDisplayRing& GetRing() { return fParent.GetRing(); }
603 AliFMDSpectraDisplaySector& GetSector() { return fParent; }
609 AliFMDSpectraDisplaySector& GetParent() { return fParent; }
615 void Fill(Double_t v);
621 TGListTreeItem& GetEntry() const { return fEntry; }
629 virtual Int_t Compare(const TObject* o) const;
631 AliFMDSpectraDisplaySector& fParent; // Parent
632 UShort_t fId; // Identifier
633 TGListTreeItem& fEntry; // Entry
634 ClassDef(AliFMDSpectraDisplayStrip,0);
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 //____________________________________________________________________