]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDDisplay.h
Fixes for SDigit generation. First attempt at making SDigit->Digit
[u/mrichter/AliRoot.git] / FMD / AliFMDDisplay.h
1 #ifndef AliFMDDISPLAY_H
2 #define AliFMDDISPLAY_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 "AliFMDInput.h"
22 #include <TObjArray.h>
23 class TCanvas;
24 class TPad;
25 class TButton;
26 class TSlider;
27 class TH1;
28
29 //___________________________________________________________________
30 /** @class AliFMDDisplay 
31     @brief Utility class to visualize FMD data in geometry. 
32     @ingroup FMD_util
33  */
34 class AliFMDDisplay : public AliFMDInput
35 {
36 public:
37   /** Constructor
38       @param onlyFMD Only show the FMD
39       @param gAliceFile galice file*/
40   AliFMDDisplay(Bool_t onlyFMD=kTRUE, const char* gAliceFile="galice.root");
41   /** DTOR */
42   virtual ~AliFMDDisplay();
43   /** Singleton access function
44       @return Singleton object. */
45   static AliFMDDisplay* Instance();
46
47   /** Continue to next event */
48   void  Continue() { fWait = kFALSE; }
49   /** Zoom mode */
50   void  Zoom() { fZoomMode = kTRUE; }
51   /** Pick mode */
52   void  Pick() { fZoomMode = kFALSE; }
53   /** Redisplay the event */ 
54   virtual void Redisplay(); // *MENU*
55   /** Break */
56   virtual void Break();
57   /** Render in 3D */
58   virtual void Render();
59   
60   /** Change cut */
61   virtual void ChangeCut();
62   /** Change cut */
63   virtual void ChangeFactor();
64   /** Called when a mouse or similar event happens in the display. 
65       @param event Event type
66       @param px    where the event happened in pixels along X
67       @param py    where the event happened in pixels along Y */
68   virtual void  ExecuteEvent(Int_t event, Int_t px, Int_t py);
69   /** Calculate distance from point @f$ (p_x,p_y)@f$ to this object. 
70       @param px Pixel X coordinate 
71       @param py Pixel Y coordinate 
72       @return distance. */
73   virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
74   /** Paint into canvas 
75       @param option Not used */
76   virtual void  Paint(Option_t* option="") { (void)option; }
77
78   /** Initialize
79       @return  @c false on error */
80   virtual Bool_t Init();
81   /** Called at beginning of an event 
82       @param event Event number
83       @return @c false on error  */
84   virtual Bool_t Begin(Int_t event);
85   /** Called at end of an event 
86       @return @c false on error  */
87   virtual Bool_t End();
88   /** Visualize a hit
89       @param hit Hit
90       @param p   Track
91       @return @c false on error  */
92   virtual Bool_t ProcessHit(AliFMDHit* hit, TParticle* p);
93   /** Visualize a digit
94       @param digit Digit to draw
95       @return @c false on error  */
96   virtual Bool_t ProcessDigit(AliFMDDigit* digit);
97   /** Visualize a summable digit
98       @param sdigit Summable digit to draw
99       @return @c false on error  */
100   virtual Bool_t ProcessSDigit(AliFMDSDigit* sdigit);
101   /** Visualize a raw digit
102       @param digit Raw digit.
103       @return @c false on error  */
104   virtual Bool_t ProcessRaw(AliFMDDigit* digit);
105   /** Visualize a reconstructed point.
106       @param recpoint Reconstructed point
107       @return @c false on error  */
108   virtual Bool_t ProcessRecPoint(AliFMDRecPoint* recpoint);
109   /** Process ESD data for the FMD.  Users should overload this to
110       deal with ESD data. 
111       @param d    Detector number (1-3)
112       @param r    Ring identifier ('I' or 'O')
113       @param s    Sector number (0-19, or 0-39)
114       @param t    Strip number (0-511, or 0-255)
115       @param eta  Psuedo-rapidity 
116       @param mult Psuedo-multiplicity 
117       @return  @c false on error  */
118   virtual Bool_t ProcessESD(UShort_t d, Char_t r, UShort_t s, UShort_t t, 
119                             Float_t eta, Float_t mult);
120   /** Look up a color index, based on the value @a x and the maximum
121       value of @a x
122       @param x   Value 
123       @param max Maximum (for example 1023 for digits)
124       @return @c false on error  */
125   virtual Int_t  LookupColor(Float_t x, Float_t min, Float_t max)  const;
126 protected:
127   /** Copy constructor 
128       @param o Object to copy from  */
129   AliFMDDisplay(const AliFMDDisplay& o) 
130     : AliFMDInput(o),
131       fWait(kFALSE),
132       fMarkers(0),
133       fHits(0),
134       fCanvas(0),
135       fPad(0),
136       fButtons(0),
137       fSlider(0),
138       fFactor(0),
139       fZoomMode(0),
140       fX0(0),
141       fY0(0),
142       fX1(0),
143       fY1(0),
144       fXPixel(0),
145       fYPixel(0),
146       fOldXPixel(0),
147       fOldYPixel(0),
148       fLineDrawn(0), 
149       fOnlyFMD(kTRUE),
150       fSpec(0), 
151       fSpecCut(0),
152       fAux(0),
153       fReturn(kFALSE)
154   { } 
155   /** Assignment operator 
156       @return Reference to this object */
157   AliFMDDisplay& operator=(const AliFMDDisplay&) { return *this; } 
158   /** Add a marker to the display
159       @param x   X position
160       @param y   Y position
161       @param z   Z position
162       @param o   Object to refer to
163       @param s   Signal 
164       @param max Maximum of signal */
165   virtual void AddMarker(Float_t x, Float_t y, Float_t z, 
166                          TObject* o, Float_t s, Float_t min, Float_t max);
167   /** Add a marker to the display
168       @param det Detector
169       @param rng Ring
170       @param sec Sector 
171       @param str Strip
172       @param o   Object to refer to
173       @param s   Signal 
174       @param max Maximum of signal */
175   virtual void AddMarker(UShort_t det, Char_t rng, UShort_t sec, UShort_t str, 
176                          TObject* o, Float_t s, Float_t min, Float_t max);
177   
178   /** Show only the FMD detectors. */
179   void ShowOnlyFMD();
180   /** Make base canvas */ 
181   virtual void MakeCanvas(const char** which);
182   virtual void MakeAux();
183   virtual void DrawAux();
184   virtual void Idle();
185   virtual void AtEnd();
186   virtual Bool_t InsideCut(Float_t v, const Float_t& min, 
187                          const Float_t& max) const;
188   
189   static AliFMDDisplay* fgInstance; // Static instance 
190   Bool_t                fWait;      // Wait until user presses `Continue'
191   TObjArray*            fMarkers;   // Cache of markers
192   TObjArray*            fHits;      // Cache of `hits'
193   TCanvas*              fCanvas;    // Canvas to draw in 
194   TPad*                 fPad;       // View pad. 
195   TObjArray             fButtons;   // Continue button
196   TSlider*              fSlider;    // Cut slider
197   TSlider*              fFactor;    // Factor slider
198   Bool_t                fZoomMode;  // Whether we're in Zoom mode
199   Float_t               fX0;        // X at lower left corner or range 
200   Float_t               fY0;        // Y at lower left corner or range 
201   Float_t               fX1;        // X at upper right corner or range 
202   Float_t               fY1;        // Y at upper right corner or range 
203   Int_t                 fXPixel;    // X pixel of mark
204   Int_t                 fYPixel;    // Y pixel of mark
205   Int_t                 fOldXPixel; // Old x pixel of mark
206   Int_t                 fOldYPixel; // Old y pixel of mark
207   Bool_t                fLineDrawn; // Whether we're drawing a box
208   Bool_t                fOnlyFMD;   // Whether to only do FMD
209   TH1*                  fSpec;      // Spectra
210   TH1*                  fSpecCut;   // Cut spectra
211   TCanvas*              fAux;       // Aux canvas.
212   Bool_t                fReturn;    // Stop 
213   ClassDef(AliFMDDisplay,0)  // FMD specialised event display
214 };
215
216 #endif
217 //____________________________________________________________________
218 //
219 // Local Variables:
220 //   mode: C++
221 // End:
222 //
223 // EOF
224 //