]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDSpectraDisplay.h
Fix some warnings.
[u/mrichter/AliRoot.git] / FMD / AliFMDSpectraDisplay.h
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
28 class TGPicture;
29 class TH1;
30 class TAxis;
31
32 class AliFMDSpectraDisplayTop;
33 class AliFMDSpectraDisplayDetector;
34 class AliFMDSpectraDisplayRing;
35 class AliFMDSpectraDisplaySector;
36 class AliFMDSpectraDisplayStrip;
37
38 //__________________________________________________________________
39 /**
40  * Base class for elements in the tree.
41  * 
42  */
43 class AliFMDSpectraDisplayElement : public TNamed 
44 {
45 public:
46   /** 
47    * Destructor.
48    * 
49    * 
50    */  
51   virtual ~AliFMDSpectraDisplayElement() {}
52   /** 
53    * Draw it
54    * 
55    * @param option Draw option
56    * @param l      Low cut 
57    * @param h      High cut
58    */
59   virtual void Show(Option_t* option, Double_t l, Double_t h);
60   /** 
61    * Get the top of the tree
62    * 
63    * @return Top element
64    */
65   virtual AliFMDSpectraDisplayTop& GetTop() = 0;
66   /** 
67    * Make histograms for this element.
68    * 
69    * @param axis Axis specs
70    */
71   virtual void MakeHistograms(TAxis* axis);
72   /** 
73    * Compare to object
74    * 
75    * @param o 
76    * 
77    * @return 
78    */  
79   virtual Int_t Compare(const TObject* o) const;
80 protected:
81   /** 
82    * Constructor
83    * 
84    * @param name  Name 
85    * @param title Title
86    */  
87   AliFMDSpectraDisplayElement(const char* name, const char* title) 
88     : TNamed(name, title), fFull(0), fCut(0)
89   {}
90   AliFMDSpectraDisplayElement(const AliFMDSpectraDisplayElement& o) 
91     : TNamed(o), 
92       fFull(o.fFull), 
93       fCut(o.fCut) 
94   {}
95   AliFMDSpectraDisplayElement&
96   operator=(const AliFMDSpectraDisplayElement&) { return *this; }
97   /** 
98    * Fill histogram
99    * 
100    * @param v Value to fill
101    */
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
106 };
107
108 //__________________________________________________________________
109 /**
110  * Top element in FMD spectra display
111  * 
112  */
113 class AliFMDSpectraDisplayTop : public AliFMDSpectraDisplayElement, 
114                                 public TQObject
115 {
116 public:
117   /** 
118    * Constructor
119    * 
120    * @param frame   Parent frame
121    * @param canvas  Canvas
122    */
123   AliFMDSpectraDisplayTop(TGCompositeFrame& frame, TCanvas* canvas);
124   /** 
125    * Get the list tree
126    * 
127    * @return List tree
128    */
129   TGListTree& GetList() { return fList; }
130   /** 
131    * Get or add a detector element
132    * 
133    * @param id Element id
134    * 
135    * @return element
136    */
137   AliFMDSpectraDisplayDetector& GetOrAdd(UShort_t id);
138   /** 
139    * Fill histograms
140    * 
141    * @param d    Detector
142    * @param ring Ring 
143    * @param sec  Sector
144    * @param str  Strip
145    * @param v    value
146    */
147   void      Fill(UShort_t d, Char_t ring, 
148                  UShort_t sec, UShort_t str, Double_t v);
149   /** 
150    * Get the axis spec.
151    *
152    * @return Axis spec,
153    */
154   TAxis* GetAxis() { return fAxis; }
155   /** 
156    * Set the axis spec.
157    * 
158    * @param a Axis spec.
159    */
160   void SetAxis(TAxis* a);
161   /** 
162    * Get the top.
163    * 
164    * @return top element
165    */
166   AliFMDSpectraDisplayTop&   GetTop() { return *this; }
167        
168   /** 
169    * Handle entries 
170    *
171    * @param e  selected entry, if any 
172    * @param id Id of entry 
173    */
174   virtual void HandleEntry(TGListTreeItem* e, Int_t id);
175   /** 
176    * Handle key strokes 
177    * @param f      Item selected, if any 
178    * @param keysym Key symbol 
179    * @param mask   Modifier mask 
180    */
181   virtual void HandleKey(TGListTreeItem* f, UInt_t keysym, UInt_t mask);
182   /**
183    * Handle Return 
184    * @param f Selected item, if any 
185    */
186   virtual void HandleReturn(TGListTreeItem* f);
187   /** 
188    * Clear the list 
189    */
190   virtual void ClearList();
191   /** 
192    * Clear the canvas 
193    */ 
194   virtual void ClearCanvas();
195   /** 
196    * Update canvas 
197    */ 
198   virtual void UpdateCanvas();
199   /** 
200    * Update canvas 
201    */ 
202   virtual void UpdateList();
203   /** 
204    * Return the currently selected entry 
205    */ 
206   TGListTreeItem* CurrentEntry() const { return fCurrentEntry; }
207   /** 
208    * @return the currently selected user data (possibly 0) 
209    */
210   TObject* Current() const;
211   /** 
212    * Selection changed signal 
213    */
214   void SelectionChanged() { Emit("SelectionChanged()"); }//*SIGNAL*
215   /** 
216    * Get Picture for 1D histogram 
217    */
218   const TGPicture* GetH1Pic() { return fHist1DIcon; }
219   /** 
220    * 2D Histogram Icon 
221    */
222   const TGPicture* GetH2Pic() { return fHist2DIcon; }
223   /** 
224    * 3D Histogram Icon 
225    */
226   const TGPicture* GetH3Pic() { return fHist3DIcon; }
227   /** 
228    * Graph Icon 
229    */
230   const TGPicture* GetGPic() { return fGraphIcon; }
231   /** 
232    * Get the entry 
233    *
234    * @return 
235    */
236   TGListTreeItem&  GetEntry() { return fEntry; }
237   /** 
238    * Compare to object
239    * 
240    * @param o 
241    * 
242    * @return 
243    */  
244   virtual Int_t Compare(const TObject* o) const;
245 protected:
246   AliFMDSpectraDisplayTop(const AliFMDSpectraDisplayTop& o) 
247     : AliFMDSpectraDisplayElement(o), 
248       TQObject(),
249       fHints(o.fHints),
250       fContainer(), // o.fContainer), 
251       fList(), // o.fList), 
252       fChildren(o.fChildren), 
253       fCurrentEntry(o.fCurrentEntry),
254       fCanvas(o.fCanvas),
255       fHist1DIcon(o.fHist1DIcon),
256       fHist2DIcon(o.fHist2DIcon),
257       fHist3DIcon(o.fHist3DIcon),
258       fGraphIcon(o.fGraphIcon),
259       fAxis(o.fAxis),
260       fEntry(o.fEntry)
261   {}
262   
263   AliFMDSpectraDisplayTop& operator=(const AliFMDSpectraDisplayTop&) 
264   {
265     return *this;
266   }
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
279
280   ClassDef(AliFMDSpectraDisplayTop,0);
281 };
282
283 //__________________________________________________________________
284 /**
285  * Detector element in FMD spectra display
286  * 
287  */
288 class AliFMDSpectraDisplayDetector : public AliFMDSpectraDisplayElement 
289 {
290 public:
291   /** 
292    * Constructor
293    * 
294    * @param det 
295    * @param top 
296    */
297   AliFMDSpectraDisplayDetector(UShort_t det, AliFMDSpectraDisplayTop& top);
298   /** 
299    * Get identifier
300    * 
301    * @return 
302    */
303   UShort_t Id() const { return fId; }
304   /** 
305    * Get top of hierarcy
306    * 
307    * @return 
308    */
309   AliFMDSpectraDisplayTop&     GetTop() { return fParent; }
310   /** 
311    * Get parent
312    * 
313    * @return 
314    */
315   AliFMDSpectraDisplayTop&     GetParent() { return fParent; }
316   /** 
317    * Get or add a ring element
318    * 
319    * @param id 
320    * 
321    * @return 
322    */
323   AliFMDSpectraDisplayRing&    GetOrAdd(Char_t id);
324   /** 
325    * Fill histograms
326    * 
327    * @param ring 
328    * @param sec 
329    * @param str 
330    * @param v 
331    */
332   void     Fill(Char_t ring, UShort_t sec, UShort_t str, Double_t v);
333   /** 
334    * Get the entry
335    * 
336    * 
337    * @return 
338    */
339   TGListTreeItem&  GetEntry() { return fEntry; }
340   /** 
341    * Compare to object
342    * 
343    * @param o 
344    * 
345    * @return 
346    */  
347   virtual Int_t Compare(const TObject* o) const;
348 protected:
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
354 };
355
356 //__________________________________________________________________
357 /**
358  * Ring element in FMD spectra display
359  * 
360  */
361 class AliFMDSpectraDisplayRing : public AliFMDSpectraDisplayElement 
362 {
363 public:
364   /** 
365    * Constructor
366    * 
367    * @param id 
368    * @param d 
369    */
370   AliFMDSpectraDisplayRing(Char_t id, AliFMDSpectraDisplayDetector& d);
371   /** 
372    * Get identifier
373    * 
374    * @return 
375    */
376   Char_t    Id() const { return fId; }
377   /** 
378    * Get detector identifier
379    * 
380    * @return 
381    */
382   UShort_t  DetectorId() { return fParent.Id(); }
383   /** 
384    * Get top of hierarcy
385    * 
386    * @return 
387    */  
388   AliFMDSpectraDisplayTop&      GetTop() { return fParent.GetTop(); }
389   /** 
390    * Get parent detector
391    * 
392    * @return 
393    */
394   AliFMDSpectraDisplayDetector& GetDetector() { return GetParent(); }
395   /** 
396    * Get parent detector
397    * 
398    * @return 
399    */
400   AliFMDSpectraDisplayDetector& GetParent() { return fParent; }
401   /** 
402    * Get or add a sector element
403    * 
404    * @param id 
405    * 
406    * @return 
407    */
408   AliFMDSpectraDisplaySector&   GetOrAdd(UShort_t id);
409   /** 
410    * Fill histograms
411    * 
412    * @param sec 
413    * @param str 
414    * @param v 
415    */
416   void      Fill(UShort_t sec, UShort_t str, Double_t v);
417   /** 
418    * Get the entry
419    * 
420    * @return 
421    */
422   TGListTreeItem&  GetEntry() { return fEntry; }
423   /** 
424    * Compare to object
425    * 
426    * @param o 
427    * 
428    * @return 
429    */  
430   virtual Int_t Compare(const TObject* o) const;
431 protected:
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
437 };
438   
439 //__________________________________________________________________
440 /**
441  * Sector element in FMD spectra display
442  * 
443  */
444 class AliFMDSpectraDisplaySector : public AliFMDSpectraDisplayElement 
445 {
446 public:
447   /** 
448    * Constructor
449    * 
450    * @param id 
451    * @param r 
452    */
453   AliFMDSpectraDisplaySector(UShort_t id, AliFMDSpectraDisplayRing& r);
454   /** 
455    * Get identifier
456    * 
457    * @return 
458    */
459   UShort_t  Id() const    { return fId; }
460   /** 
461    * Get detector identifier
462    * 
463    * @return 
464    */
465   UShort_t  DetectorId()  { return fParent.DetectorId(); }
466   /** 
467    * Get ring identifier
468    * 
469    * @return 
470    */
471   Char_t    RingId()      { return fParent.Id(); }
472   /** 
473    * Get top of hierarcy
474    * 
475    * @return 
476    */
477   AliFMDSpectraDisplayTop&      GetTop()      { return fParent.GetTop(); }
478   /** 
479    * Get parent detector
480    * 
481    * @return 
482    */
483   AliFMDSpectraDisplayDetector& GetDetector() { return fParent.GetDetector(); }
484   /** 
485    * Get parent ring.
486    * 
487    * @return 
488    */
489   AliFMDSpectraDisplayRing&     GetRing()     { return fParent; }
490   /** 
491    * Get parent ring.
492    * 
493    * @return 
494    */
495   AliFMDSpectraDisplayRing&     GetParent()   { return fParent; }
496   /** 
497    * Get or add a strip element
498    * 
499    * @param id 
500    * 
501    * @return 
502    */
503   AliFMDSpectraDisplayStrip&    GetOrAdd(UShort_t id);
504   /** 
505    * Fill histograms
506    * 
507    * @param str 
508    * @param v 
509    */  
510   void      Fill(UShort_t str, Double_t v);
511   /** 
512    * Get the entry
513    * 
514    * @return 
515    */  
516   TGListTreeItem&  GetEntry() { return fEntry; }
517   /** 
518    * Compare to object
519    * 
520    * @param o 
521    * 
522    * @return 
523    */  
524   virtual Int_t Compare(const TObject* o) const;
525 protected:
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
531 };
532
533 //__________________________________________________________________
534 /**
535  * Strip element in FMD spectra display
536  * 
537  */
538 class AliFMDSpectraDisplayStrip : public AliFMDSpectraDisplayElement 
539 {
540 public:
541   /** 
542    * Constructor
543    * 
544    * @param id 
545    * @param s 
546    */
547   AliFMDSpectraDisplayStrip(UShort_t id, AliFMDSpectraDisplaySector& s);
548   /** 
549    * Get identifier
550    * 
551    * @return 
552    */
553   UShort_t  Id() const    { return fId; }
554   /** 
555    * Get detector identifier
556    * 
557    * @return 
558    */
559   UShort_t  DetectorId()  { return fParent.DetectorId(); }
560   /** 
561    * Get ring identifier
562    * 
563    * @return 
564    */
565   Char_t    RingId()      { return fParent.RingId(); }
566   /** 
567    * Get sector identifier
568    * 
569    * @return 
570    */
571   UShort_t  SectorId()    { return fParent.Id(); }
572   /** 
573    * Get top of hierarcy
574    * 
575    * @return 
576    */
577   AliFMDSpectraDisplayTop&      GetTop()      { return fParent.GetTop(); }
578   /** 
579    * Get parent detector
580    * 
581    * @return 
582    */
583   AliFMDSpectraDisplayDetector& GetDetector() { return fParent.GetDetector(); }
584   /** 
585    * Get parent ring
586    * 
587    * @return 
588    */
589   AliFMDSpectraDisplayRing&     GetRing()     { return fParent.GetRing(); }
590   /** 
591    * Get parent sector
592    * 
593    * @return 
594    */
595   AliFMDSpectraDisplaySector&   GetSector()   { return fParent; }
596   /** 
597    * Get parent sector
598    * 
599    * @return 
600    */
601   AliFMDSpectraDisplaySector&   GetParent()   { return fParent; }
602   /** 
603    * Fill histograms
604    * 
605    * @param v 
606    */  
607   void      Fill(Double_t v);
608   /** 
609    * Get entry
610    * 
611    * @return 
612    */
613   TGListTreeItem&  GetEntry() { return fEntry; }
614   /** 
615    * Compare to object
616    * 
617    * @param o 
618    * 
619    * @return 
620    */  
621   virtual Int_t Compare(const TObject* o) const;
622 protected:
623   AliFMDSpectraDisplaySector&         fParent; // Parent
624   UShort_t                            fId;     // Identifier 
625   TGListTreeItem&                     fEntry;  // Entry
626   ClassDef(AliFMDSpectraDisplayStrip,0);
627 };
628
629 //____________________________________________________________________
630 /**
631  * FMD event and spectra display
632  * 
633  */
634 class AliFMDSpectraDisplay : public AliFMDPattern
635 {
636 public:
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);
713 protected:
714   TGMainFrame  fSelector; // GUI to select spectra
715   AliFMDSpectraDisplayTop fTop;     // Top of hierarcy
716   ClassDef(AliFMDSpectraDisplay,0); // FMD event and spectra display
717 }
718 ;
719
720 #endif
721 //____________________________________________________________________
722 //
723 // Local Variables:
724 //   mode: C++
725 // End:
726 //
727 // EOF
728 //
729