Added new 'status' histogram to the DQM data maker and checker. This histogram
[u/mrichter/AliRoot.git] / FMD / AliFMDDisplay.h
CommitLineData
bf000c32 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 */
c2fc1258 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*/
bf000c32 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"
a9579262 22#include <TObjArray.h>
2eddac03 23#include <TTimer.h>
bf000c32 24class TCanvas;
25class TPad;
26class TButton;
a9579262 27class TSlider;
28class TH1;
bf000c32 29
30//___________________________________________________________________
9f662337 31/** @class AliFMDDisplay
32 @brief Utility class to visualize FMD data in geometry.
33 @ingroup FMD_util
34 */
bf000c32 35class AliFMDDisplay : public AliFMDInput
36{
37public:
09b6c804 38 /**
39 * Constructor
40 *
41 * @param onlyFMD Only show the FMD
42 * @param gAliceFile galice file
43 */
a9579262 44 AliFMDDisplay(Bool_t onlyFMD=kTRUE, const char* gAliceFile="galice.root");
09b6c804 45 /**
46 * DTOR
47 */
a9579262 48 virtual ~AliFMDDisplay();
09b6c804 49 /**
50 * Singleton access function
51 *
52 * @return Singleton object.
53 */
bf000c32 54 static AliFMDDisplay* Instance();
55
09b6c804 56 /**
57 * Continue to next event
58 */
bf000c32 59 void Continue() { fWait = kFALSE; }
09b6c804 60 /**
61 * Run throug events as fast as possible
62 */
2eddac03 63 void Start() { fContinous = kTRUE; fWait = kFALSE; }
09b6c804 64 /**
65 * Pause the processing
66 */
2eddac03 67 void Pause() { fContinous = kFALSE; fWait = kTRUE; }
09b6c804 68 /**
69 * Zoom mode
70 */
bf000c32 71 void Zoom() { fZoomMode = kTRUE; }
09b6c804 72 /**
73 * Pick mode
74 */
bf000c32 75 void Pick() { fZoomMode = kFALSE; }
09b6c804 76 /**
77 * Redisplay the event
78 */
a9579262 79 virtual void Redisplay(); // *MENU*
09b6c804 80 /**
81 * Break
82 */
d98fbfa5 83 virtual void Break();
09b6c804 84 /**
85 * Render in 3D
86 */
d98fbfa5 87 virtual void Render();
88
09b6c804 89 /**
90 * Change cut
91 */
a9579262 92 virtual void ChangeCut();
09b6c804 93 /**
94 * Change cut
95 */
d98fbfa5 96 virtual void ChangeFactor();
09b6c804 97 /**
98 * Called when a mouse or similar event happens in the display.
99 *
100 * @param event Event type
101 * @param px where the event happened in pixels along X
102 * @param py where the event happened in pixels along Y
103 */
a9579262 104 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
09b6c804 105 /**
106 * Paint into canvas
107 *
108 * @param option Not used
109 */
a9579262 110 virtual void Paint(Option_t* option="") { (void)option; }
bf000c32 111
09b6c804 112 /**
113 * Initialize
114 *
115 * @return @c false on error
116 */
bf000c32 117 virtual Bool_t Init();
09b6c804 118 /**
119 * Called at beginning of an event
120 *
121 * @param event Event number
122 * @return @c false on error
123 */
bf000c32 124 virtual Bool_t Begin(Int_t event);
09b6c804 125 /**
126 * Called at end of an event
127 *
128 * @return @c false on error
129 */
bf000c32 130 virtual Bool_t End();
09b6c804 131 /**
132 * Visualize a hit
133 *
134 * @param hit Hit
135 * @param p Track
136 * @return @c false on error
137 */
bf000c32 138 virtual Bool_t ProcessHit(AliFMDHit* hit, TParticle* p);
09b6c804 139 /**
140 * Visualize a digit
141 *
142 * @param digit Digit to draw
143 * @return @c false on error
144 */
bf000c32 145 virtual Bool_t ProcessDigit(AliFMDDigit* digit);
09b6c804 146 /**
147 * Visualize a summable digit
148 *
149 * @param sdigit Summable digit to draw
150 * @return @c false on error
151 */
42f1b2f5 152 virtual Bool_t ProcessSDigit(AliFMDSDigit* sdigit);
09b6c804 153 /**
154 * Visualize a raw digit
155 *
156 * @param digit Raw digit.
157 * @return @c false on error
158 */
59194467 159 virtual Bool_t ProcessRawDigit(AliFMDDigit* digit);
09b6c804 160 /**
161 * Visualize a raw digit
162 *
163 * @param digit Raw digit.
164 * @return @c false on error
165 */
e064ab4a 166 virtual Bool_t ProcessRawCalibDigit(AliFMDDigit* digit);
09b6c804 167 /**
168 * Visualize a reconstructed point.
169 *
170 * @param recpoint Reconstructed point
171 * @return @c false on error
172 */
bf000c32 173 virtual Bool_t ProcessRecPoint(AliFMDRecPoint* recpoint);
09b6c804 174 /**
175 * Process ESD data for the FMD. Users should overload this to
176 * deal with ESD data.
177 *
178 * @param d Detector number (1-3)
179 * @param r Ring identifier ('I' or 'O')
180 * @param s Sector number (0-19, or 0-39)
181 * @param t Strip number (0-511, or 0-255)
182 * @param eta Psuedo-rapidity
183 * @param mult Psuedo-multiplicity
184 *
185 * @return @c false on error
186 */
a9579262 187 virtual Bool_t ProcessESD(UShort_t d, Char_t r, UShort_t s, UShort_t t,
188 Float_t eta, Float_t mult);
09b6c804 189 /**
190 * Look up a color index, based on the value @a x and the maximum
191 * value of @a x
192 *
193 * @param x Value
194 * @param max Maximum (for example 1023 for digits)
195 * @return @c false on error
196 */
d98fbfa5 197 virtual Int_t LookupColor(Float_t x, Float_t min, Float_t max) const;
ef8e8623 198
09b6c804 199 /**
200 * Set range of displayed values
201 */
ef8e8623 202 virtual void SetCut(Float_t l=0., Float_t h=1.); //*MENU*
09b6c804 203 /**
204 * Set the noise factor
205 *
206 * @param f Noise factor
207 */
e1a9aea4 208 virtual void SetFactor(Float_t f=1);
bf000c32 209protected:
09b6c804 210 /**
211 * Copy constructor
212 *
213 * @param o Object to copy from
214 */
b5ee4425 215 AliFMDDisplay(const AliFMDDisplay& o)
216 : AliFMDInput(o),
217 fWait(kFALSE),
218 fMarkers(0),
219 fHits(0),
220 fCanvas(0),
221 fPad(0),
2b893216 222 fButtons(0),
a9579262 223 fSlider(0),
d98fbfa5 224 fFactor(0),
b5ee4425 225 fZoomMode(0),
226 fX0(0),
227 fY0(0),
228 fX1(0),
229 fY1(0),
b5ee4425 230 fXPixel(0),
231 fYPixel(0),
232 fOldXPixel(0),
233 fOldYPixel(0),
2b893216 234 fLineDrawn(0),
235 fOnlyFMD(kTRUE),
236 fSpec(0),
237 fSpecCut(0),
d98fbfa5 238 fAux(0),
2eddac03 239 fReturn(kFALSE),
240 fContinous(kFALSE),
e1a9aea4 241 fTimeout(),
242 fInitialMin(0),
243 fInitialMax(1),
244 fInitialFactor(3./10)
b5ee4425 245 { }
09b6c804 246 /**
247 * Assignment operator
248 *
249 * @return Reference to this object
250 */
02a27b50 251 AliFMDDisplay& operator=(const AliFMDDisplay&) { return *this; }
09b6c804 252 /**
253 * Add a marker to the display
254 *
255 * @param x X position
256 * @param y Y position
257 * @param z Z position
258 * @param o Object to refer to
259 * @param s Signal
260 * @param max Maximum of signal
261 */
d98fbfa5 262 virtual void AddMarker(Float_t x, Float_t y, Float_t z,
263 TObject* o, Float_t s, Float_t min, Float_t max);
09b6c804 264 /**
265 * Add a marker to the display
266 *
267 * @param det Detector
268 * @param rng Ring
269 * @param sec Sector
270 * @param str Strip
271 * @param o Object to refer to
272 * @param s Signal
273 * @param max Maximum of signal
274 */
a9579262 275 virtual void AddMarker(UShort_t det, Char_t rng, UShort_t sec, UShort_t str,
d98fbfa5 276 TObject* o, Float_t s, Float_t min, Float_t max);
a9579262 277
09b6c804 278 /**
279 * Show only the FMD detectors.
280 */
a9579262 281 void ShowOnlyFMD();
09b6c804 282 /**
283 * Make base canvas
284 */
a9579262 285 virtual void MakeCanvas(const char** which);
09b6c804 286 /**
287 * Make AUX canvas
288 *
289 */
a9579262 290 virtual void MakeAux();
09b6c804 291 /**
292 * Draw AUX canvas
293 *
294 */
a9579262 295 virtual void DrawAux();
09b6c804 296 /**
297 * Set the ROOT event loop to idle
298 *
299 */
a9579262 300 virtual void Idle();
09b6c804 301 /**
302 * Called at end of event loop
303 *
304 */
a9579262 305 virtual void AtEnd();
09b6c804 306 /**
307 * Whether a point is inside
308 *
309 * @param v Point
310 * @param min Minimum
311 * @param max Maximum
312 *
313 * @return true if @a v is inside cut
314 */
d98fbfa5 315 virtual Bool_t InsideCut(Float_t v, const Float_t& min,
316 const Float_t& max) const;
09b6c804 317 /**
318 * Get the ADC threshold
319 *
320 * @param d Detector
321 * @param r Ring
322 * @param s Sector
323 * @param t Strip
324 *
325 * @return The threshold
326 */
e064ab4a 327 virtual Double_t GetADCThreshold(UShort_t d, Char_t r,
328 UShort_t s, UShort_t t) const;
02a27b50 329
bf000c32 330 static AliFMDDisplay* fgInstance; // Static instance
331 Bool_t fWait; // Wait until user presses `Continue'
332 TObjArray* fMarkers; // Cache of markers
333 TObjArray* fHits; // Cache of `hits'
334 TCanvas* fCanvas; // Canvas to draw in
335 TPad* fPad; // View pad.
a9579262 336 TObjArray fButtons; // Continue button
337 TSlider* fSlider; // Cut slider
d98fbfa5 338 TSlider* fFactor; // Factor slider
bf000c32 339 Bool_t fZoomMode; // Whether we're in Zoom mode
340 Float_t fX0; // X at lower left corner or range
341 Float_t fY0; // Y at lower left corner or range
342 Float_t fX1; // X at upper right corner or range
343 Float_t fY1; // Y at upper right corner or range
344 Int_t fXPixel; // X pixel of mark
345 Int_t fYPixel; // Y pixel of mark
346 Int_t fOldXPixel; // Old x pixel of mark
347 Int_t fOldYPixel; // Old y pixel of mark
348 Bool_t fLineDrawn; // Whether we're drawing a box
5c96b03f 349 Bool_t fOnlyFMD; // Whether to only do FMD
350 TH1* fSpec; // Spectra
351 TH1* fSpecCut; // Cut spectra
352 TCanvas* fAux; // Aux canvas.
d98fbfa5 353 Bool_t fReturn; // Stop
09b6c804 354 Bool_t fContinous; // Run continuous - do not stop
355 TTimer fTimeout; // Timeout
356 Float_t fInitialMin;// Initial minimum
357 Float_t fInitialMax;// Initial maximum
358 Float_t fInitialFactor;//Initial factor
ef8e8623 359
360 struct Range_t {
09b6c804 361 UInt_t fNbins; // Number of bins
362 Float_t fLow; // Low cut
363 Float_t fHigh; // High cut
ef8e8623 364 };
09b6c804 365 static const Range_t fgkEdepRange; // Energy loss range
366 static const Range_t fgkAdcRange; // ADC counts range
367 static const Range_t fgkMultRange; // Multiplicity range
ef8e8623 368
bf000c32 369 ClassDef(AliFMDDisplay,0) // FMD specialised event display
370};
371
372#endif
373//____________________________________________________________________
374//
375// Local Variables:
376// mode: C++
377// End:
378//
379// EOF
380//