Bug fix
[u/mrichter/AliRoot.git] / FMD / AliFMDSpectraDisplay.h
CommitLineData
7af3df7f 1#ifndef AliFMDSPECTRADISPLAY_H
2#define AliFMDSPECTRADISPLAY_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
4 * reserved.
5 *
6 * See cxx source for full Copyright notice
7 */
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
12*/
13//___________________________________________________________________
14//
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.
20//
21#include "AliFMDPattern.h"
22#include <TGFrame.h>
23#include <TGListTree.h>
24#include <TObjArray.h>
25#include <TQObject.h>
26#include <RQ_OBJECT.h>
27
28class TGPicture;
29class TH1;
30class TAxis;
31
c6b36280 32//____________________________________________________________________
7af3df7f 33/**
c6b36280 34 * FMD event and spectra display
7af3df7f 35 *
36 */
c6b36280 37class AliFMDSpectraDisplay : public AliFMDPattern
7af3df7f 38{
39public:
c6b36280 40 class AliFMDSpectraDisplayTop;
41 class AliFMDSpectraDisplayDetector;
42 class AliFMDSpectraDisplayRing;
43 class AliFMDSpectraDisplaySector;
44 class AliFMDSpectraDisplayStrip;
7af3df7f 45
c6b36280 46 //__________________________________________________________________
47 /**
48 * Base class for elements in the tree.
7af3df7f 49 *
7af3df7f 50 */
c6b36280 51 class AliFMDSpectraDisplayElement : public TNamed
52 {
53 public:
54 /**
55 * Destructor.
56 *
57 *
58 */
59 virtual ~AliFMDSpectraDisplayElement() {}
60 /**
61 * Draw it
62 *
63 * @param option Draw option
64 * @param l Low cut
65 * @param h High cut
66 */
67 virtual void Show(Option_t* option, Double_t l, Double_t h);
68 /**
69 * Get the top of the tree
70 *
71 * @return Top element
72 */
73 virtual AliFMDSpectraDisplayTop& GetTop() = 0;
74 /**
75 * Make histograms for this element.
76 *
77 * @param axis Axis specs
78 */
79 virtual void MakeHistograms(TAxis* axis);
80 /**
81 * Compare to object
82 *
83 * @param o
84 *
85 * @return
86 */
87 virtual Int_t Compare(const TObject* o) const;
88 protected:
89 /**
90 * Constructor
91 *
92 * @param name Name
93 * @param title Title
94 */
95 AliFMDSpectraDisplayElement(const char* name, const char* title)
96 : TNamed(name, title), fFull(0), fCut(0)
97 {}
98 AliFMDSpectraDisplayElement(const AliFMDSpectraDisplayElement& o)
99 : TNamed(o),
100 fFull(o.fFull),
101 fCut(o.fCut)
102 {}
103 AliFMDSpectraDisplayElement&
104 operator=(const AliFMDSpectraDisplayElement&) { return *this; }
105 /**
106 * Fill histogram
107 *
108 * @param v Value to fill
109 */
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
114 };
115
116 //__________________________________________________________________
117 /**
118 * Top element in FMD spectra display
7af3df7f 119 *
7af3df7f 120 */
c6b36280 121 class AliFMDSpectraDisplayTop : public AliFMDSpectraDisplayElement,
122 public TQObject
123 {
124 public:
125 /**
126 * Constructor
127 *
128 * @param frame Parent frame
129 * @param canvas Canvas
130 */
131 AliFMDSpectraDisplayTop(TGCompositeFrame& frame, TCanvas* canvas);
132 /**
133 * Get the list tree
134 *
135 * @return List tree
136 */
137 TGListTree& GetList() { return fList; }
138 /**
139 * Get or add a detector element
140 *
141 * @param id Element id
142 *
143 * @return element
144 */
145 AliFMDSpectraDisplayDetector& GetOrAdd(UShort_t id);
146 /**
147 * Fill histograms
148 *
149 * @param d Detector
150 * @param ring Ring
151 * @param sec Sector
152 * @param str Strip
153 * @param v value
154 */
155 void Fill(UShort_t d, Char_t ring,
156 UShort_t sec, UShort_t str, Double_t v);
157 /**
158 * Get the axis spec.
159 *
160 * @return Axis spec,
161 */
162 TAxis* GetAxis() const { return fAxis; }
163 /**
164 * Set the axis spec.
165 *
166 * @param a Axis spec.
167 */
168 void SetAxis(TAxis* a);
169 /**
170 * Get the top.
171 *
172 * @return top element
173 */
174 AliFMDSpectraDisplayTop& GetTop() { return *this; }
7af3df7f 175
c6b36280 176 /**
177 * Handle entries
178 *
179 * @param e selected entry, if any
180 * @param id Id of entry
181 */
182 virtual void HandleEntry(TGListTreeItem* e, Int_t id);
183 /**
184 * Handle key strokes
185 * @param f Item selected, if any
186 * @param keysym Key symbol
187 * @param mask Modifier mask
188 */
189 virtual void HandleKey(TGListTreeItem* f, UInt_t keysym, UInt_t mask);
190 /**
191 * Handle Return
192 * @param f Selected item, if any
193 */
194 virtual void HandleReturn(TGListTreeItem* f);
195 /**
196 * Clear the list
197 */
198 virtual void ClearList();
199 /**
200 * Clear the canvas
201 */
202 virtual void ClearCanvas();
203 /**
204 * Update canvas
205 */
206 virtual void UpdateCanvas();
207 /**
208 * Update canvas
209 */
210 virtual void UpdateList();
211 /**
212 * Return the currently selected entry
213 */
214 TGListTreeItem* CurrentEntry() const { return fCurrentEntry; }
215 /**
216 * @return the currently selected user data (possibly 0)
217 */
218 TObject* Current() const;
219 /**
220 * Selection changed signal
221 */
222 void SelectionChanged() { Emit("SelectionChanged()"); }//*SIGNAL*
223 /**
224 * Get Picture for 1D histogram
225 */
226 const TGPicture* GetH1Pic() const { return fkHist1DIcon; }
227 /**
228 * 2D Histogram Icon
229 */
230 const TGPicture* GetH2Pic() const { return fkHist2DIcon; }
231 /**
232 * 3D Histogram Icon
233 */
234 const TGPicture* GetH3Pic() const { return fkHist3DIcon; }
235 /**
236 * Graph Icon
237 */
238 const TGPicture* GetGPic() const { return fkGraphIcon; }
239 /**
240 * Get the entry
241 *
242 * @return
243 */
244 TGListTreeItem& GetEntry() const { return fEntry; }
245 /**
246 * Compare to object
247 *
248 * @param o
249 *
250 * @return
251 */
252 virtual Int_t Compare(const TObject* o) const;
253 protected:
254 AliFMDSpectraDisplayTop(const AliFMDSpectraDisplayTop& o)
255 : AliFMDSpectraDisplayElement(o),
256 TQObject(),
257 fHints(o.fHints),
258 fContainer(), // o.fContainer),
259 fList(), // o.fList),
260 fChildren(o.fChildren),
261 fCurrentEntry(o.fCurrentEntry),
262 fCanvas(o.fCanvas),
263 fkHist1DIcon(o.fkHist1DIcon),
264 fkHist2DIcon(o.fkHist2DIcon),
265 fkHist3DIcon(o.fkHist3DIcon),
266 fkGraphIcon(o.fkGraphIcon),
267 fAxis(o.fAxis),
268 fEntry(o.fEntry)
269 {}
7af3df7f 270
c6b36280 271 AliFMDSpectraDisplayTop& operator=(const AliFMDSpectraDisplayTop&)
272 {
273 return *this;
274 }
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
7af3df7f 287
c6b36280 288 ClassDef(AliFMDSpectraDisplayTop,0);
289 };
7af3df7f 290
c6b36280 291 //__________________________________________________________________
292 /**
293 * Detector element in FMD spectra display
7af3df7f 294 *
7af3df7f 295 */
c6b36280 296 class AliFMDSpectraDisplayDetector : public AliFMDSpectraDisplayElement
297 {
298 public:
299 /**
300 * Constructor
301 *
302 * @param det
303 * @param top
304 */
305 AliFMDSpectraDisplayDetector(UShort_t det, AliFMDSpectraDisplayTop& top);
306 /**
307 * Get identifier
308 *
309 * @return
310 */
311 UShort_t Id() const { return fId; }
312 /**
313 * Get top of hierarcy
314 *
315 * @return
316 */
317 AliFMDSpectraDisplayTop& GetTop() { return fParent; }
318 /**
319 * Get parent
320 *
321 * @return
322 */
323 AliFMDSpectraDisplayTop& GetParent() const { return fParent; }
324 /**
325 * Get or add a ring element
326 *
327 * @param id
328 *
329 * @return
330 */
331 AliFMDSpectraDisplayRing& GetOrAdd(Char_t id);
332 /**
333 * Fill histograms
334 *
335 * @param ring
336 * @param sec
337 * @param str
338 * @param v
339 */
340 void Fill(Char_t ring, UShort_t sec, UShort_t str, Double_t v);
341 /**
342 * Get the entry
343 *
344 *
345 * @return
346 */
347 TGListTreeItem& GetEntry() const { return fEntry; }
348 /**
349 * Compare to object
350 *
351 * @param o
352 *
353 * @return
354 */
355 virtual Int_t Compare(const TObject* o) const;
356 protected:
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
362 };
7af3df7f 363
c6b36280 364 //__________________________________________________________________
365 /**
366 * Ring element in FMD spectra display
7af3df7f 367 *
7af3df7f 368 */
c6b36280 369 class AliFMDSpectraDisplayRing : public AliFMDSpectraDisplayElement
370 {
371 public:
372 /**
373 * Constructor
374 *
375 * @param id
376 * @param d
377 */
378 AliFMDSpectraDisplayRing(Char_t id, AliFMDSpectraDisplayDetector& d);
379 /**
380 * Get identifier
381 *
382 * @return
383 */
384 Char_t Id() const { return fId; }
385 /**
386 * Get detector identifier
387 *
388 * @return
389 */
390 UShort_t DetectorId() const { return fParent.Id(); }
391 /**
392 * Get top of hierarcy
393 *
394 * @return
395 */
396 AliFMDSpectraDisplayTop& GetTop() { return fParent.GetTop(); }
397 /**
398 * Get parent detector
399 *
400 * @return
401 */
402 AliFMDSpectraDisplayDetector& GetDetector() const { return GetParent(); }
403 /**
404 * Get parent detector
405 *
406 * @return
407 */
408 AliFMDSpectraDisplayDetector& GetParent() const { return fParent; }
409 /**
410 * Get or add a sector element
411 *
412 * @param id
413 *
414 * @return
415 */
416 AliFMDSpectraDisplaySector& GetOrAdd(UShort_t id);
417 /**
418 * Fill histograms
419 *
420 * @param sec
421 * @param str
422 * @param v
423 */
424 void Fill(UShort_t sec, UShort_t str, Double_t v);
425 /**
426 * Get the entry
427 *
428 * @return
429 */
430 TGListTreeItem& GetEntry() const { return fEntry; }
431 /**
432 * Compare to object
433 *
434 * @param o
435 *
436 * @return
437 */
438 virtual Int_t Compare(const TObject* o) const;
439 protected:
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
445 };
7af3df7f 446
c6b36280 447 //__________________________________________________________________
448 /**
449 * Sector element in FMD spectra display
7af3df7f 450 *
7af3df7f 451 */
c6b36280 452 class AliFMDSpectraDisplaySector : public AliFMDSpectraDisplayElement
453 {
454 public:
455 /**
456 * Constructor
457 *
458 * @param id
459 * @param r
460 */
461 AliFMDSpectraDisplaySector(UShort_t id, AliFMDSpectraDisplayRing& r);
462 /**
463 * Get identifier
464 *
465 * @return
466 */
467 UShort_t Id() const { return fId; }
468 /**
469 * Get detector identifier
470 *
471 * @return
472 */
473 UShort_t DetectorId() const { return fParent.DetectorId(); }
474 /**
475 * Get ring identifier
476 *
477 * @return
478 */
479 Char_t RingId() const { return fParent.Id(); }
480 /**
481 * Get top of hierarcy
482 *
483 * @return
484 */
485 AliFMDSpectraDisplayTop& GetTop() { return fParent.GetTop(); }
486 /**
487 * Get parent detector
488 *
489 * @return
490 */
491 AliFMDSpectraDisplayDetector& GetDetector() { return fParent.GetDetector(); }
492 /**
493 * Get parent ring.
494 *
495 * @return
496 */
497 AliFMDSpectraDisplayRing& GetRing() { return fParent; }
498 /**
499 * Get parent ring.
500 *
501 * @return
502 */
503 AliFMDSpectraDisplayRing& GetParent() { return fParent; }
504 /**
505 * Get or add a strip element
506 *
507 * @param id
508 *
509 * @return
510 */
511 AliFMDSpectraDisplayStrip& GetOrAdd(UShort_t id);
512 /**
513 * Fill histograms
514 *
515 * @param str
516 * @param v
517 */
518 void Fill(UShort_t str, Double_t v);
519 /**
520 * Get the entry
521 *
522 * @return
523 */
524 TGListTreeItem& GetEntry() const { return fEntry; }
525 /**
526 * Compare to object
527 *
528 * @param o
529 *
530 * @return
531 */
532 virtual Int_t Compare(const TObject* o) const;
533 protected:
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
539 };
7af3df7f 540
c6b36280 541 //__________________________________________________________________
542 /**
543 * Strip element in FMD spectra display
7af3df7f 544 *
7af3df7f 545 */
c6b36280 546 class AliFMDSpectraDisplayStrip : public AliFMDSpectraDisplayElement
547 {
548 public:
549 /**
550 * Constructor
551 *
552 * @param id
553 * @param s
554 */
555 AliFMDSpectraDisplayStrip(UShort_t id, AliFMDSpectraDisplaySector& s);
556 /**
557 * Get identifier
558 *
559 * @return
560 */
561 UShort_t Id() const { return fId; }
562 /**
563 * Get detector identifier
564 *
565 * @return
566 */
567 UShort_t DetectorId() const { return fParent.DetectorId(); }
568 /**
569 * Get ring identifier
570 *
571 * @return
572 */
573 Char_t RingId() const { return fParent.RingId(); }
574 /**
575 * Get sector identifier
576 *
577 * @return
578 */
579 UShort_t SectorId() const { return fParent.Id(); }
580 /**
581 * Get top of hierarcy
582 *
583 * @return
584 */
585 AliFMDSpectraDisplayTop& GetTop() { return fParent.GetTop(); }
586 /**
587 * Get parent detector
588 *
589 * @return
590 */
591 AliFMDSpectraDisplayDetector& GetDetector() { return fParent.GetDetector(); }
592 /**
593 * Get parent ring
594 *
595 * @return
596 */
597 AliFMDSpectraDisplayRing& GetRing() { return fParent.GetRing(); }
598 /**
599 * Get parent sector
600 *
601 * @return
602 */
603 AliFMDSpectraDisplaySector& GetSector() { return fParent; }
604 /**
605 * Get parent sector
606 *
607 * @return
608 */
609 AliFMDSpectraDisplaySector& GetParent() { return fParent; }
610 /**
611 * Fill histograms
612 *
613 * @param v
614 */
615 void Fill(Double_t v);
616 /**
617 * Get entry
618 *
619 * @return
620 */
621 TGListTreeItem& GetEntry() const { return fEntry; }
622 /**
623 * Compare to object
624 *
625 * @param o
626 *
627 * @return
628 */
629 virtual Int_t Compare(const TObject* o) const;
630 protected:
631 AliFMDSpectraDisplaySector& fParent; // Parent
632 UShort_t fId; // Identifier
633 TGListTreeItem& fEntry; // Entry
634 ClassDef(AliFMDSpectraDisplayStrip,0);
635 };
7af3df7f 636
7af3df7f 637 /**
638 * Constructor
639 *
640 */
641 AliFMDSpectraDisplay();
642 /**
643 * Handle draw
644 *
645 * @return
646 */
647 Bool_t HandleDraw();
648 /**
649 * Make AUX canvas
650 *
651 */
652 void MakeAux();
653 /**
654 * Draw spectra
655 *
656 */
657 void DrawAux();
658 /**
659 * Process a hit
660 *
661 * @param hit
662 * @param p
663 *
664 * @return
665 */
666 Bool_t ProcessHit(AliFMDHit* hit, TParticle* p);
667 /**
668 * Process a digit
669 *
670 * @param digit
671 *
672 * @return
673 */
674 Bool_t ProcessDigit(AliFMDDigit* digit);
675 /**
676 * Process a summable digit
677 *
678 * @param sdigit
679 *
680 * @return
681 */
682 Bool_t ProcessSDigit(AliFMDSDigit* sdigit);
683 /**
684 * Process a raw digit
685 *
686 * @param digit
687 *
688 * @return
689 */
690 Bool_t ProcessRawDigit(AliFMDDigit* digit);
691 /**
692 * Process a reconstruction point
693 *
694 * @param recpoint
695 *
696 * @return
697 */
698 Bool_t ProcessRecPoint(AliFMDRecPoint* recpoint);
699 /**
700 * Process and ESD entry
701 *
702 * @param det
703 * @param rng
704 * @param sec
705 * @param str
706 * @param x
707 * @param mult
708 *
709 * @return
710 */
711 Bool_t ProcessESD(UShort_t det, Char_t rng, UShort_t sec, UShort_t str,
712 Float_t x, Float_t mult);
713protected:
714 TGMainFrame fSelector; // GUI to select spectra
715 AliFMDSpectraDisplayTop fTop; // Top of hierarcy
716 ClassDef(AliFMDSpectraDisplay,0); // FMD event and spectra display
717}
c6b36280 718 ;
7af3df7f 719
720#endif
721//____________________________________________________________________
722//
723// Local Variables:
724// mode: C++
725// End:
726//
727// EOF
728//
729