]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/mood/TMCal.h
6a5b0e9ea0664ea4cbab2ba4698577e29dbe04a2
[u/mrichter/AliRoot.git] / EMCAL / mood / TMCal.h
1 // Author: Filimon Roukoutakis 
2 /******************************************************************************
3   MOOD - Monitor Of On-line Data and Detector Debugger for ALICE Experiment
4 ******************************************************************************/
5
6 #ifndef TMCAL_H
7 #define TMCAL_H
8
9 /******************************************************************************
10  *                                                                            *
11  * TMCAL                                                                      *
12  *                                                                            *
13  * CAL Module Class; base class for EMCAL and PHOS monitors                   *
14  *                                                                            *
15  * Author: Timo Alho (Jyvaskyla), original version                            *
16  * [Consultant: D. Silvermyr (ORNL)]                                          *
17  *                                                                            *
18  ******************************************************************************/
19
20 #include "TMBaseModule.h"
21 #include "Mood.h"
22 #include "MoodOC.hh"
23 #include "TGSlider.h"
24
25 //This class will handle the pedestal data analysis
26 #include "AliRawReader.h"
27 #include "AliCaloRawStream.h"
28 #include "AliCaloCalibPedestal.h"
29
30 //TMCalConstants.hh includes all the defaults and GUI layout etc..
31 #include "TMCalConstants.hh" 
32
33 class TMCal: public TMBaseModule {
34   
35   RQ_OBJECT("TMCal")
36
37  protected:
38
39   virtual void ConstructGUI(void) {};
40   virtual void ConstructMonitors(void) {};
41   virtual void DestructMonitors(void) {};
42   virtual void DestructGUI(void) {};
43   virtual void InitMonitors(void) {};
44   virtual void MonitorEvent(void);
45   virtual void UpdateMonitors(void);
46   virtual void ResetMonitors(void) {};
47   virtual void PreMonitor(void) {};
48   virtual void PostMonitor(void);
49  
50  private:
51  
52   AliCaloCalibPedestal::kDetType fDetType; //The detector type for this object
53   int fNumModules;
54  
55   enum kTab {kPeds, kPeaks, kPedsDiff, kPeaksDiff, kPedsRatio, kPeaksRatio, 
56              kPedsSingle, kPeaksSingle, kPedsDiffSingle, kPeaksDiffSingle, kPedsRatioSingle, kPeaksRatioSingle};
57  
58   int   fEvents; //The number of events processed
59   AliCaloCalibPedestal *fPedestals; //The object taking care of pedestal and pedestal-peak profile generation
60   AliRawReader *fRawReader; //The raw data reader
61   AliCaloRawStream *fCaloRawStream; //The object to sort this out to EMCAL/PHOS data
62  
63   /////////////////////////////
64   //GUI components
65  
66   //Histocanvases. The last one, that is [fgkNumModules] is the single histo display canvas.
67   //This isn't too neat or good programming style, but it does make handling the updates etc simpler and more unified -> less prone to errors
68   TCanvas * fPedsCanvas[fgkMaxModules+1]; //!The pointers to the Ped canvases for the modules
69   TCanvas * fPeaksCanvas[fgkMaxModules+1]; //!The pointers to the Peak canvases for the modules
70   TCanvas * fPedsDiffCanvas[fgkMaxModules+1]; //!The pointers to the Ped difference canvases for the modules
71   TCanvas * fPeaksDiffCanvas[fgkMaxModules+1]; //!The pointers to the Peak difference canvases for the modules
72   TCanvas * fPedsRatioCanvas[fgkMaxModules+1]; //!The pointers to the Ped ratio canvases for the modules
73   TCanvas * fPeaksRatioCanvas[fgkMaxModules+1]; //!The pointers to the Peak ratio anvases for the modules
74   TCanvas * fDeadMapCanvas[fgkMaxModules+1];
75  
76   //Single histo canvases. These hold pointers to the single histo canvases. Note that a copy is in the main canvas arrays above
77   TCanvas * fPedsCanvasSingle; //!
78   TCanvas * fPeaksCanvasSingle; //!
79   TCanvas * fPedsDiffCanvasSingle; //!
80   TCanvas * fPeaksDiffCanvasSingle; //!
81   TCanvas * fPedsRatioCanvasSingle; //!
82   TCanvas * fPeaksRatioCanvasSingle; //!
83   TCanvas * fDeadMapCanvasSingle; //!
84   
85   TGLabel * fDeadCountText;
86   
87   //The tab pointers
88   TGCompositeFrame * fPedsTab;
89   TGCompositeFrame * fPeaksTab;
90   TGCompositeFrame * fPedsDiffTab;
91   TGCompositeFrame * fPeaksDiffTab;
92   TGCompositeFrame * fPedsRatioTab;
93   TGCompositeFrame * fPeaksRatioTab;
94   TGCompositeFrame * fDeadMapTab;
95   
96   //The vertical major frames for the multihisto displays in each of the tabs
97   TGCompositeFrame * fPeaksDiffFrame;
98   TGCompositeFrame * fPedsDiffFrame;
99   TGCompositeFrame * fPeaksFrame;
100   TGCompositeFrame * fPedsFrame;
101   TGCompositeFrame * fPeaksRatioFrame;
102   TGCompositeFrame * fPedsRatioFrame;
103   TGCompositeFrame * fDeadMapFrame;
104   
105   //The same for the single histo displays
106   TGCompositeFrame * fPeaksDiffFrameSingle;
107   TGCompositeFrame * fPedsDiffFrameSingle;
108   TGCompositeFrame * fPeaksFrameSingle;
109   TGCompositeFrame * fPedsFrameSingle;
110   TGCompositeFrame * fPeaksRatioFrameSingle;
111   TGCompositeFrame * fPedsRatioFrameSingle;
112   TGCompositeFrame * fDeadMapFrameSingle;
113   
114   //The buttons on the lower panel
115   TGTextButton * fGainButton;
116   TGTextButton * fSingleModeButton;
117   TGNumberEntry * fRunNoEntry;
118   
119   //The range sliders
120   TGVSlider * fPeaksRange;
121   TGVSlider * fPedsRange;
122   TGVSlider * fPeaksDiffRange;
123   TGVSlider * fPedsDiffRange;
124   TGVSlider * fPeaksRatioRange;
125   TGVSlider * fPedsRatioRange;
126   //The range sliders for single module
127   TGVSlider * fPeaksRangeSingle;
128   TGVSlider * fPedsRangeSingle;
129   TGVSlider * fPeaksDiffRangeSingle;
130   TGVSlider * fPedsDiffRangeSingle;
131   TGVSlider * fPeaksRatioRangeSingle;
132   TGVSlider * fPedsRatioRangeSingle;
133   
134   //GUI State
135   Bool_t fLowGainMode; //Low or high gain to be displayed
136   Bool_t fSingleModule; //If we are in a single module state
137   int fVisibleModule; //The module which is visible, if we're in the single module mode
138   Int_t fDeadMapPalette[AliCaloCalibPedestal::kNumDeadMapStates]; //The palette used for drawing the dead map. See TMCalConstants.hh for the color
139   //definition (which are assigned in the constructor of this class)
140   //The easiest way to define a string constant...
141 #define fgkDeadMapTabName "DeadMap"
142   TPaveText * fDeadMapPaveText;
143
144   double fMaxPed;
145   double fMaxPeak;
146   double fMaxPeakDiff;
147   double fMaxPedDiff;
148   double fMaxPedRatio;
149   double fMaxPeakRatio;
150   
151   //////////////////////////////
152   //GUI Creation helpers
153   
154   void DrawHistos();//Draw the histos                                
155   TGCompositeFrame * MakeAllModulesTab(TGCompositeFrame * tab,
156                                        TCanvas **canvArray, //Array of pointers to the canvases to which the histos have been drawn. MUST be initialized.
157                                        TGVSlider **slider = 0, //The pointer to the pointer to the slider, which to put the slider to
158                                        kTab tabId = kPeds, //The tab Id which the slider should give as a parameter when connecting
159                                        double sliderMin = 0.0, double sliderMax = 0.0, double sliderPos = 0.0 //The range and position of the slider
160                                        );//The function to create a tab full of histos
161
162   TGCompositeFrame * MakeSingleModuleTab(TGCompositeFrame * tab,
163                                          TCanvas **canvas,
164                                          TGVSlider **slider = 0, //The pointer to the pointer to the slider, which to put the slider to
165                                          kTab tabId = kPeds, //The tab Id which the slider should give as a parameter when connecting
166                                          double sliderMin = 0.0, double sliderMax = 0.0, double sliderPos = 0.0 //The range and position of the slider
167                                          );
168   void ConstructFullGUI(); //Constructs the GUI with all modules visible
169   void ConstructMenu(UInt_t w); //Constructs the GUI with all modules visible
170   void InitRawReaderAndStream(unsigned int runNo); //Inits the Raw  reader and CaloRawStream
171   void SetTitles();//Sets the title of the histos
172   
173  public:
174  
175   TMCal(const TGWindow *p, UInt_t w, UInt_t h, AliCaloCalibPedestal::kDetType detectorType);
176   virtual ~TMCal();
177  
178   //GUI event handlers
179   void OnGainButton();
180   void OnModeButton(int button);
181   void OnRange(kTab tab);
182   void OnRunNoChange(Long_t val);
183   void OnTabChange(Int_t Id);//Here we have to set the appropriate palette for the tab
184
185   ClassDef(TMCal, 1); // Calorimeter Module Base Class
186   
187 };
188
189 #endif