]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/mood/TMCal.cxx
AliMUONRecoCheck udate:
[u/mrichter/AliRoot.git] / EMCAL / mood / TMCal.cxx
CommitLineData
a69378db 1#include "TMCal.h"
2#include "TRandom.h"
3#include "TF1.h"
4
5#include "AliRawEventHeaderBase.h"
6#include "AliRawReaderRoot.h"
7
8ClassImp(TMCal)
9
10//_____________________________________________________________________________
11TMCal::TMCal(const TGWindow *p, UInt_t w, UInt_t h, AliCaloCalibPedestal::kDetType detectorType) :
12 TMBaseModule(p, w, h),
13 fDetType(detectorType),
14 fEvents(0),
15 fPedestals(0),
16 fRawReader(0),
17 fCaloRawStream(0),
18 fLowGainMode(kFALSE),
19 fSingleModule(kTRUE),
20 fVisibleModule(2),
21 fMaxPed(100.0),
22 fMaxPeak(100.0),
23 fMaxPeakDiff(100.0),
24 fMaxPedDiff(100.0),
25 fMaxPedRatio(2.0),
26 fMaxPeakRatio(3.0)
27{
28 //PHOS/EMCAL MOOD Module;
29 // GUI related pointers (frames, canvases, buttons are initialized in the Construct* methods
30 // called later in this ctor.
31
32 //Create the object for making the histograms
33 fPedestals = new AliCaloCalibPedestal( fDetType );
34 // AliCaloCalibPedestal knows how many modules we have for PHOS or EMCAL
35 fNumModules = fPedestals->GetModules();
36
37 //Load the reference object (Note: a fixed path. This should be made a variable that can somehow be set other than via the constants file and recompiled..)
38 if (fDetType == AliCaloCalibPedestal::kPhos) {
39 if (fPedestals->LoadReferenceCalib(fgkReferenceFilePhos, fgkReferenceObject) != kTRUE) {
40 printf("Could not load PHOS reference calib.\n");
41 }
42 }
43 else {
44 if (fPedestals->LoadReferenceCalib(fgkReferenceFileEmCal, fgkReferenceObject) != kTRUE) {
45 printf("Could not load EMCAL reference calib.\n");
46 }
47 }
48
49 //Init the readers and streams
50 InitRawReaderAndStream(fgkDefaultRunNo);
51
52 // standard style options:
53 //Make all histos use a more sensible palette.
54 gStyle->SetPalette(1);
55 //Kill the titles etc...
56 gStyle->SetOptStat(0);
57 //gStyle->SetOptTitle(0);
58 gStyle->SetTitleW(0.8);
59 gStyle->SetTitleH(0.08);
60 gStyle->SetTitleX(0.1);
61 gROOT->ForceStyle(kFALSE);
62
63 //Construct the various buttons and info 'menu' for the lower panel
64 ConstructMenu(w);
65
66 //Construct the various tabs and frames
67 ConstructFullGUI();
68
69 //Set the handler to handle the tab changing, so we can enforce the palette we like.
70#ifdef fgkCustomDeadMapPalette
71 GetTab()->Connect("Selected(Int_t)", "TMCal", this, "OnTabChange(Int_t)");
72#endif
73}
74
75//_____________________________________________________________________________
76void TMCal::InitRawReaderAndStream(unsigned int runNo)
77{
78 char file[256];
79 if (fDetType == AliCaloCalibPedestal::kPhos) {
80 snprintf(file, 256, fgkSourceFileTemplatePhos, runNo);
81 }
82 else {
83 snprintf(file, 256, fgkSourceFileTemplateEmCal, runNo);
84 }
85 printf("\n TMCal::InitRawReaderAndStream file= %s \n", file);
86
87 fEvents = 0;
88
89 //Initialize the raw readers
90 if (fCaloRawStream) {
91 delete fCaloRawStream;
92 }
93 if (fRawReader) {
94 delete fRawReader;
95 }
96
97 fRawReader = new AliRawReaderRoot(file);
98 fCaloRawStream = new AliCaloRawStream(fRawReader, (fDetType==AliCaloCalibPedestal::kPhos) ? "PHOS" : "EMCAL");
99
100 fCaloRawStream->SetOldRCUFormat(kTRUE); // should maybe have a switch for this later?
101
102 //Not sure if this should be here... get to the first event, or never look at the first one?
103 fRawReader->NextEvent();
104
105 //Reset the actual analysis, since we changed the source file
106 fPedestals->Reset();
107
108 fPedestals->SetRunNumber(runNo);
109
110 //Set the histo titles
111 SetTitles();
112 printf("Reference run #%i.\n", fPedestals->GetRefRunNumber());
113}
114
115//_____________________________________________________________________________
116void TMCal::SetTitles()
117{
118 char title[256];
119 for (int i = 0; i < fNumModules; i++) {
120 sprintf(title, "Pedestals, high gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
121 fPedestals->GetPedProfileHighGain(i)->SetTitle(title);
122 sprintf(title, "Peak-Pedestals, high gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
123 fPedestals->GetPeakProfileHighGain(i)->SetTitle(title);
124
125 sprintf(title, "Pedestals, low gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
126 fPedestals->GetPedProfileLowGain(i)->SetTitle(title);
127 sprintf(title, "Peak-Pedestals, low gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
128 fPedestals->GetPeakProfileLowGain(i)->SetTitle(title);
129
130 sprintf(title, "Peak-Pedestals difference, high gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
131 fPedestals->GetPeakProfileHighGainDiff(i)->SetTitle(title);
132 sprintf(title, "Pedestals difference, high gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
133 fPedestals->GetPedProfileHighGainDiff(i)->SetTitle(title);
134
135 sprintf(title, "Peak-Pedestals difference, low gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
136 fPedestals->GetPeakProfileLowGainDiff(i)->SetTitle(title);
137 sprintf(title, "Pedestals difference, low gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
138 fPedestals->GetPedProfileLowGainDiff(i)->SetTitle(title);
139
140 sprintf(title, "Peak-Pedestals ratio, high gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
141 fPedestals->GetPeakProfileHighGainRatio(i)->SetTitle(title);
142 sprintf(title, "Pedestals ratio, high gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
143 fPedestals->GetPedProfileHighGainRatio(i)->SetTitle(title);
144
145 sprintf(title, "Peak-Pedestals ratio, low gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
146 fPedestals->GetPeakProfileLowGainRatio(i)->SetTitle(title);
147 sprintf(title, "Pedestals ratio, low gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
148 fPedestals->GetPedProfileLowGainRatio(i)->SetTitle(title);
149
150 }
151
152 // Note: Dead map is currently only for high gain.. and we try to use a special palette style for it
153 gStyle->SetPalette(AliCaloCalibPedestal::kNumDeadMapStates, fDeadMapPalette);
154 for (int i = 0; i < fNumModules; i++) {
155 sprintf(title, "Dead map, high gain, run #%.4i, module %i", fPedestals->GetRunNumber(), i);
156 fPedestals->GetDeadMap(i)->SetTitle(title);
157 fPedestals->GetDeadMap(i)->UseCurrentStyle();
158 }
159 // back to standard palette
160 gStyle->SetPalette(1);
161 return;
162}
163
164//_____________________________________________________________________________
165void TMCal::ConstructMenu(UInt_t w)
166{//Constructs the buttons and info 'menu'
167
168 //create frame for the High gain/Low gain -button
169 TGHorizontalFrame *buttonFrame = new TGHorizontalFrame(GetMainViewFrame(),(UInt_t)w,(UInt_t)30);
170 GetMainViewFrame()->AddFrame(buttonFrame,new TGLayoutHints(kLHintsTop|kLHintsExpandX,0,0,0,0));
171
172 //Create the high/lowgain button
173 fGainButton = new TGTextButton(buttonFrame,"Low gain");
174 fGainButton->Connect("Clicked()","TMCal",this,"OnGainButton()");
175 //fGainButton->AllowStayDown(kTRUE);
176 buttonFrame->AddFrame(fGainButton,new TGLayoutHints(kLHintsCenterY,0,(UInt_t)5,0,0));
177
178 fDeadCountText = new TGLabel(buttonFrame,"Run #0000: Dead: 000, 000%; 000 new, 0000 recov.; ref. run 0000");
179 //We set generous margins for the label to make sure the text fits even with 4-digit numbers.
180 fDeadCountText->SetMargins(fDeadCountText->GetLeftMargin()+fgkDeadCountTextMargin, fDeadCountText->GetRightMargin()+fgkDeadCountTextMargin, fDeadCountText->GetTopMargin(), fDeadCountText->GetBottomMargin());
181 buttonFrame->AddFrame(fDeadCountText, new TGLayoutHints(kLHintsCenterY, 0, (UInt_t)5, 0, 0));
182
183 //Create the one histo/multi-histo -selection buttons
184 TGButtonGroup * buttGr = new TGButtonGroup(buttonFrame, "Display module", kHorizontalFrame);
185 TGRadioButton * radButts[fNumModules + 1];
186 char txt[64];
187 for (int i = 0; i < fNumModules; i++) {
188 sprintf(txt, "%i", i);
189 radButts[i] = new TGRadioButton(buttGr, new TGHotString(txt));
190 sprintf(txt, "OnModeButton(=%i)", i);
191 radButts[i]->Connect("Clicked()", "TMCal", this, txt);
192 }
193
194 radButts[fNumModules] = new TGRadioButton(buttGr, new TGHotString("All"));
195 sprintf(txt, "OnModeButton(=%i)", fNumModules);
196 radButts[fNumModules]->Connect("Clicked()", "TMCal", this, txt);
197
198 radButts[fVisibleModule]->SetState(kButtonDown);
199 buttonFrame->AddFrame(buttGr,new TGLayoutHints(kLHintsCenterY,0,(UInt_t)5,0,0));
200 //buttGr->Show();
201
202 //Add the run number entry
203 TGLabel * runnoText = new TGLabel(buttonFrame,"Run #: ");;
204 buttonFrame->AddFrame(runnoText, new TGLayoutHints(kLHintsCenterY, 0, (UInt_t)5, 0, 0));
205 fRunNoEntry = new TGNumberEntry(buttonFrame, fgkDefaultRunNo, 6, -1,TGNumberFormat::kNESInteger, //style
206 TGNumberFormat::kNEAPositive//input value filter
207 );
208 fRunNoEntry->Connect("ValueSet(Long_t)", "TMCal",this,"OnRunNoChange(Long_t)");
209 buttonFrame->AddFrame(fRunNoEntry,new TGLayoutHints(kLHintsCenterY|kLHintsLeft,0,(UInt_t)5,0,0));
210
211 return;
212}
213
214//_____________________________________________________________________________
215void TMCal::ConstructFullGUI()
216{//Constructs the GUI
217
218 //We need to set the palette for drawing the dead map
219 fDeadMapPalette[AliCaloCalibPedestal::kAlive] = fgkLiveTowerColor;
220 fDeadMapPalette[AliCaloCalibPedestal::kDead] = fgkDeadTowerColor;
221 fDeadMapPalette[AliCaloCalibPedestal::kResurrected] = fgkResurrectedTowerColor;
222 fDeadMapPalette[AliCaloCalibPedestal::kRecentlyDeceased] = fgkRecentlyDeceasedTowerColor;
223
224 // set up the TPaveText to have the info on the palette also
225 fDeadMapPaveText = new TPaveText(0.9,0.7,0.995,0.9,"brNDC");
226 /* alive ones are not shown really..
227 TText *tAlive = fDeadMapPaveText->AddText("OK");
228 tAlive->SetTextColor(fgkLiveTowerColor);
229 */
230 TText *tDead = fDeadMapPaveText->AddText("Dead");
231 TText *tResurrected = fDeadMapPaveText->AddText("New OK");
232 TText *tRecentlyDeceased = fDeadMapPaveText->AddText("New Dead");
233 tDead->SetTextColor(fgkDeadTowerColor);
234 tResurrected->SetTextColor(fgkResurrectedTowerColor);
235 tRecentlyDeceased->SetTextColor(fgkRecentlyDeceasedTowerColor);
236
237 fPeaksTab = GetTab()->AddTab("Peak-Pedestal");
238 fPeaksFrameSingle = MakeSingleModuleTab(fPeaksTab, &fPeaksCanvasSingle, &fPeaksRangeSingle, kPeaksSingle, AliCaloCalibPedestal::GetSampleMin(),
239 AliCaloCalibPedestal::GetSampleMax(), fMaxPeak);
240 fPeaksFrame = MakeAllModulesTab(fPeaksTab, fPeaksCanvas, &fPeaksRange, kPeaks, AliCaloCalibPedestal::GetSampleMin(),
241 AliCaloCalibPedestal::GetSampleMax(), fMaxPeak);
242 fPeaksCanvas[fNumModules] = fPeaksCanvasSingle;
243
244 fPedsTab = GetTab()->AddTab("Pedestal");
245 fPedsFrameSingle = MakeSingleModuleTab(fPedsTab, &fPedsCanvasSingle, &fPedsRangeSingle, kPedsSingle, AliCaloCalibPedestal::GetSampleMin(),
246 AliCaloCalibPedestal::GetSampleMax(), fMaxPed);
247 fPedsFrame = MakeAllModulesTab(fPedsTab, fPedsCanvas, &fPedsRange, kPeds, AliCaloCalibPedestal::GetSampleMin(),
248 AliCaloCalibPedestal::GetSampleMax(), fMaxPed); //Create the all modules version of the tab
249 fPedsCanvas[fNumModules] = fPedsCanvasSingle;
250
251
252 fPeaksDiffTab = GetTab()->AddTab("Peak diff");
253 fPeaksDiffFrameSingle = MakeSingleModuleTab(fPeaksDiffTab, &fPeaksDiffCanvasSingle, &fPeaksDiffRangeSingle, kPeaksDiffSingle, AliCaloCalibPedestal::GetSampleMin(),
254 AliCaloCalibPedestal::GetSampleMax(), fMaxPeakDiff);
255 fPeaksDiffFrame = MakeAllModulesTab(fPeaksDiffTab, fPeaksDiffCanvas, &fPeaksDiffRange, kPeaksDiff, AliCaloCalibPedestal::GetSampleMin(),
256 AliCaloCalibPedestal::GetSampleMax(), fMaxPeakDiff);
257 fPeaksDiffTab->MapSubwindows();
258 fPeaksDiffCanvas[fNumModules] = fPeaksDiffCanvasSingle; //Copy the pointer to the array, so we can just loop over this one too
259
260
261 fPedsDiffTab = GetTab()->AddTab("Pedestal diff");
262 fPedsDiffFrameSingle = MakeSingleModuleTab(fPedsDiffTab, &fPedsDiffCanvasSingle, &fPedsDiffRangeSingle, kPedsDiffSingle, AliCaloCalibPedestal::GetSampleMin(),
263 AliCaloCalibPedestal::GetSampleMax(), fMaxPedDiff);
264 fPedsDiffFrame = MakeAllModulesTab(fPedsDiffTab, fPedsDiffCanvas, &fPedsDiffRange, kPedsDiff, AliCaloCalibPedestal::GetSampleMin(),
265 AliCaloCalibPedestal::GetSampleMax(), fMaxPedDiff);
266 fPedsDiffCanvas[fNumModules] = fPedsDiffCanvasSingle;
267
268 fPeaksRatioTab = GetTab()->AddTab("Peak ratio");
269 fPeaksRatioFrameSingle = MakeSingleModuleTab(fPeaksRatioTab, &fPeaksRatioCanvasSingle, &fPeaksRatioRangeSingle, kPeaksRatioSingle,
270 fgkMinMaxRatioExp*fgkRatioStepScale, fgkMaxMaxRatioExp*fgkRatioStepScale,
271 -(log(fMaxPeakRatio)/log(2))*fgkRatioStepScale + fgkMaxMaxRatioExp*fgkRatioStepScale);
272 fPeaksRatioFrame = MakeAllModulesTab(fPeaksRatioTab, fPeaksRatioCanvas, &fPeaksRatioRange, kPeaksRatio,
273 fgkMinMaxRatioExp*fgkRatioStepScale, fgkMaxMaxRatioExp*fgkRatioStepScale,
274 -(log(fMaxPeakRatio)/log(2))*fgkRatioStepScale + fgkMaxMaxRatioExp*fgkRatioStepScale);
275 fPeaksRatioCanvas[fNumModules] = fPeaksRatioCanvasSingle;
276
277 fPedsRatioTab = GetTab()->AddTab("Pedestal ratio");
278 fPedsRatioFrameSingle = MakeSingleModuleTab(fPedsRatioTab, &fPedsRatioCanvasSingle, &fPedsRatioRangeSingle, kPedsRatioSingle,
279 fgkMinMaxRatioExp*fgkRatioStepScale, fgkMaxMaxRatioExp*fgkRatioStepScale,
280 -(log(fMaxPedRatio)/log(2))*fgkRatioStepScale + fgkMaxMaxRatioExp*fgkRatioStepScale);
281 fPedsRatioFrame = MakeAllModulesTab(fPedsRatioTab, fPedsRatioCanvas, &fPedsRatioRange, kPedsRatio,
282 fgkMinMaxRatioExp*fgkRatioStepScale, fgkMaxMaxRatioExp*fgkRatioStepScale,
283 -(log(fMaxPedRatio)/log(2))*fgkRatioStepScale + fgkMaxMaxRatioExp*fgkRatioStepScale);
284 fPedsRatioCanvas[fNumModules] = fPedsRatioCanvasSingle;
285
286 fDeadMapTab = GetTab()->AddTab(fgkDeadMapTabName);
287 fDeadMapFrameSingle = MakeSingleModuleTab(fDeadMapTab, &fDeadMapCanvasSingle);
288 fDeadMapFrame = MakeAllModulesTab(fDeadMapTab, fDeadMapCanvas);
289 fDeadMapCanvas[fNumModules] = fDeadMapCanvasSingle;
290
291 DrawHistos();
292
293 UpdateMonitors();//This is actually just to update the status text... which should then perhaps be done elsewhere, so we could call that separately,
294 //but since it's needed in exactly one place, I'm too lazy...
295
296 return;
297}
298
299//_____________________________________________________________________________
300TGCompositeFrame * TMCal::MakeAllModulesTab(TGCompositeFrame * tab,
301 TCanvas **canvArray, //Array of pointers to the canvases to which the histos have been drawn. MUST be initialized.
302 TGVSlider **slider, //The pointer to the pointer to the slider, which to put the pointer to the slider to
303 kTab tabId, //The tab Id which the slider should give as a parameter when connecting
304 double sliderMin, double sliderMax, double sliderPos //The range and position of the slider
305 )
306{//The function to create a tab full of histos
307
308 //The frames. The magic numbers here don't really matter, because the ExpandX and ExpandY
309 //hints will override them anyway. If this behaviour is modified, then these numbers
310 //should be properly declared as constants.
311 TGHorizontalFrame * verFrame = new TGHorizontalFrame(tab, (UInt_t)5*400, (UInt_t)600);
312 TGCompositeFrame * histoFrame = new TGCompositeFrame(verFrame,(UInt_t)40, (UInt_t)400);
313
314 //Make the layout manager a matrix style
315 histoFrame->SetLayoutManager(new TGMatrixLayout(histoFrame, 0, fgkHistosPerRow));
316
317 //Add a vertical frame to stack the high/low -gain histos on top of each others
318 tab->AddFrame(verFrame, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
319
320
321 if (slider) {//Add the slider to the histoframe
322 TGVSlider * range = new TGVSlider(verFrame, fgk2DHistoHeight, kSlider1);
323 range->SetRange((int)sliderMin, (int)sliderMax);
324 range->SetPosition( (int)(sliderMax - sliderPos) ); //We have to invert this by hand
325 char str[64];
326 sprintf(str, "OnRange(=%u)", (int)tabId);
327 //range->Connect("PositionChanged(Int_t)", "TMCal",this,str);
328 range->Connect("Released()", "TMCal",this,str);
329 verFrame->AddFrame(range,new TGLayoutHints(0,0,fgk2DHistoMarginX,0,0));
330 *slider = range;
331 }
332
333 //Add the horizontal frames which layout the individual histos for each module
334 verFrame->AddFrame(histoFrame, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 0, 0, 0, 0));
335
336 //-------------------------------------
337 //Create the canvases
338
339 TString canvasName = tab->GetName();
340 for (int i = 0; i < fNumModules; i++) {
341
342 TRootEmbeddedCanvas *ECanvas = new TRootEmbeddedCanvas(canvasName + " " + (TString)i,histoFrame,fgk2DHistoWidth,fgk2DHistoHeight);
343
344
345 histoFrame->AddFrame(ECanvas, new TGLayoutHints(0, fgk2DHistoMarginX,0, fgk2DHistoMarginY, 0));
346
347 canvArray[i] = ECanvas->GetCanvas();
348 }
349
350 return verFrame;
351}
352
353//_____________________________________________________________________________
354TGCompositeFrame * TMCal::MakeSingleModuleTab(TGCompositeFrame * tab,
355 TCanvas **canvas,
356 TGVSlider **slider, //The pointer to the pointer to the slider, which to put the pointer to the slider to
357 kTab tabId, //The tab Id which the slider should give as a parameter when connecting
358 double sliderMin, double sliderMax, double sliderPos //The range and position of the slider
359 )
360{//The function to create a tab with a single big histo.
361
362 //TODO: consider if we really need the vertical frame at all, or should just arrange everything to the horizontal frame...
363
364 //The frames. The magic numbers here don't really matter, because the ExpandX and ExpandY
365 //hints will override them anyway. If this behaviour is modified, then these numbers
366 //should be properly declared as constants.
367 TGVerticalFrame * verFrame = new TGVerticalFrame(tab, (UInt_t)5*400, (UInt_t)600);
368 TGHorizontalFrame * histoFrame = new TGHorizontalFrame(verFrame,(UInt_t)400, (UInt_t)400);
369
370 //Add a vertical frame to stack the high/low -gain histos on top of each others
371 tab->AddFrame(verFrame, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
372
373 //Add the horizontal frames which layout the individual histos for each module
374 verFrame->AddFrame(histoFrame, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 0, 0, 0, 0));
375
376 if (slider) {//Add the slider to the histoframe
377 TGVSlider * range = new TGVSlider(histoFrame, fgk2DSingleHistoHeight, kSlider1);
378 range->SetRange((int)sliderMin, (int)sliderMax);
379 range->SetPosition( (int)(sliderMax - sliderPos) ); //We have to invert this by hand
380 char str[64];
381 sprintf(str, "OnRange(=%u)", (int)tabId);
382 //range->Connect("PositionChanged(Int_t)", "TMCal",this,str);
383 range->Connect("Released()", "TMCal",this,str);
384 histoFrame->AddFrame(range,new TGLayoutHints(0,0,0,0,0));
385 *slider = range;
386 }
387
388 //-------------------------------------
389 //Create the canvas
390
391 TString canvasName = tab->GetName();
392
393 TRootEmbeddedCanvas *ECanvas = new TRootEmbeddedCanvas(canvasName + " single",histoFrame,fgk2DSingleHistoWidth,fgk2DSingleHistoHeight);
394
395 histoFrame->AddFrame(ECanvas, new TGLayoutHints(0, fgk2DSingleHistoMarginX,0, fgk2DSingleHistoMarginY, 0));
396
397 *canvas = ECanvas->GetCanvas();
398
399 return verFrame;
400}
401
402//_____________________________________________________________________________
403void TMCal::MonitorEvent(void)
404{
405// printf("Monitoring for the %ith time this evening.\n", i);
406 //Process the next event
407 if (fRawReader->NextEvent())
408 {
409 AliRawEventHeaderBase *aliHeader = (AliRawEventHeaderBase*) fRawReader->GetEventHeader();
410
411 if (aliHeader->Get("Type") == AliRawEventHeaderBase::kPhysicsEvent)
412 {
413 fEvents++;
414 //printf("A physics event.\n");
415 fPedestals->ProcessEvent(fCaloRawStream);
416 } //else
417 // printf("A non-physics event.\n");
418 }
419
420}
421
422//_____________________________________________________________________________
423void TMCal::UpdateMonitors(void)
424{
425 //Just update all the histograms
426 fPedestals->ComputeDiffAndRatio();//Re-compute the difference and the ratio
427 //Update the dead cells count
428 fPedestals->ComputeDeadTowers(fgkDeadThreshold);
429 for (int i = 0; (i < fNumModules) && (!fSingleModule); i++) {
430 fPeaksCanvas[i]->Paint();
431 fPeaksCanvas[i]->Update();
432 fPeaksCanvas[i]->Paint();
433
434 fPedsCanvas[i]->Paint();
435 fPedsCanvas[i]->Update();
436 fPedsCanvas[i]->Paint();
437
438 fPedsDiffCanvas[i]->Paint();
439 fPedsDiffCanvas[i]->Update();
440 fPedsDiffCanvas[i]->Paint();
441
442 fPeaksDiffCanvas[i]->Paint();
443 fPeaksDiffCanvas[i]->Update();
444 fPeaksDiffCanvas[i]->Paint();
445
446 fPedsRatioCanvas[i]->Paint();
447 fPedsRatioCanvas[i]->Update();
448 fPedsRatioCanvas[i]->Paint();
449
450 fPeaksRatioCanvas[i]->Paint();
451 fPeaksRatioCanvas[i]->Update();
452 fPeaksRatioCanvas[i]->Paint();
453
454 fPedestals->GetDeadMap(i)->UseCurrentStyle();
455 fDeadMapCanvas[i]->Paint();
456 fDeadMapCanvas[i]->Update();
457 fDeadMapCanvas[i]->Paint();
458 }
459
460 if (fSingleModule) {
461 fPeaksCanvasSingle->Paint();
462 fPeaksCanvasSingle->Update();
463 fPeaksCanvasSingle->Paint();
464
465 fPeaksCanvasSingle->Paint();
466 fPedsCanvasSingle->Update();
467 fPedsCanvasSingle->Paint();
468
469 fPeaksCanvasSingle->Paint();
470 fPedsDiffCanvasSingle->Update();
471 fPedsDiffCanvasSingle->Paint();
472
473 fPeaksCanvasSingle->Paint();
474 fPeaksDiffCanvasSingle->Update();
475 fPeaksDiffCanvasSingle->Paint();
476
477 fPeaksCanvasSingle->Paint();
478 fPedsRatioCanvasSingle->Update();
479 fPedsRatioCanvasSingle->Paint();
480
481 fPeaksCanvasSingle->Paint();
482 fPeaksRatioCanvasSingle->Update();
483 fPeaksRatioCanvasSingle->Paint();
484
485 fPedestals->GetDeadMap(fVisibleModule)->UseCurrentStyle();
486 fDeadMapCanvasSingle->Paint();
487 fDeadMapCanvasSingle->Update();
488 fDeadMapCanvasSingle->Paint();
489 }
490
491 char tmp[128];
492 sprintf(tmp, "Run #%.4i: Dead: %i, %.1f%%; %i new, %i recov.; Ref. run %i",
493 fPedestals->GetRunNumber(), (int)fPedestals->GetDeadTowerCount(),
494 (float)(100.0*fPedestals->GetDeadTowerRatio()),
495 (int)fPedestals->GetDeadTowerNew(),
496 (int)fPedestals->GetDeadTowerResurrected(), (int)fPedestals->GetRefRunNumber());
497
498 fDeadCountText->SetText(tmp);
499
500 return;
501}
502
503//_____________________________________________________________________________
504void TMCal::PostMonitor(void)
505{
506 fPedestals->ComputeDeadTowers(fgkDeadThreshold, fgkDeadMapName);//Write out the deadmap
507 return;
508}
509
510//_____________________________________________________________________________
511TMCal::~TMCal()
512{ // Destructor
513 if (fCaloRawStream) delete fCaloRawStream;
514 if (fRawReader) delete fRawReader;
515 if (fPedestals) delete fPedestals;
516}
517
518//_____________________________________________________________________________
519void TMCal::DrawHistos() { // Gain button handler
520 //Recalculate the differences and ratios (because this causes a screen update)
521 fPedestals->ComputeDiffAndRatio();
522
523 //Finally draw the deadmap. This has to be done outside the low/highgain iffing.
524 //There is probably a smoother way to do this than by repeating the loop, though...
525 for (int i = 0; (i < fNumModules) && (!fSingleModule); i++) {
526 fDeadMapCanvas[i]->cd();
527 //Draw the deadmap
528 fPedestals->GetDeadMap(i)->Draw("col");
529 // also a TPaveText with info on what the colors mean
530 fDeadMapPaveText->Draw();
531 fDeadMapCanvas[i]->Update();
532 fDeadMapCanvas[i]->Paint();
533 }
534
535 if (fSingleModule) {
536 fDeadMapCanvasSingle->cd();
537 fPedestals->GetDeadMap(fVisibleModule)->Draw("col");
538 // also a TPaveText with info on what the colors mean
539 fDeadMapPaveText->Draw();
540 fDeadMapCanvasSingle->Update();
541 fDeadMapCanvasSingle->Paint();
542 }
543
544 if (!fLowGainMode) {
545 for (int i = 0; (i < fNumModules) && (!fSingleModule); i++) {
546 fPeaksCanvas[i]->cd();
547 //Draw the high gain peak-minus pedestals
548 fPedestals->GetPeakProfileHighGain((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
549 fPeaksCanvas[i]->Update();
550 fPeaksCanvas[i]->Paint();
551
552 fPedsCanvas[i]->cd();
553 //Draw the high gain peak-minus pedestals
554 fPedestals->GetPedProfileHighGain((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
555 fPedsCanvas[i]->Update();
556 fPedsCanvas[i]->Paint();
557
558 fPedsDiffCanvas[i]->cd();
559 //Draw the high gain peak-minus pedestals
560 fPedestals->GetPedProfileHighGainDiff((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
561 fPedsDiffCanvas[i]->Update();
562 fPedsDiffCanvas[i]->Paint();
563
564 fPeaksDiffCanvas[i]->cd();
565 //Draw the high gain peak-minus pedestals
566 fPedestals->GetPeakProfileHighGainDiff((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
567 fPeaksDiffCanvas[i]->Update();
568 fPeaksDiffCanvas[i]->Paint();
569
570 fPeaksRatioCanvas[i]->cd();
571 //Draw the high gain peak-minus pedestals
572 fPedestals->GetPeakProfileHighGainRatio((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
573 fPeaksRatioCanvas[i]->Update();
574 fPeaksRatioCanvas[i]->Paint();
575
576 fPedsRatioCanvas[i]->cd();
577 //Draw the high gain peak-minus pedestals
578 fPedestals->GetPedProfileHighGainRatio((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
579 fPedsRatioCanvas[i]->Update();
580 fPedsRatioCanvas[i]->Paint();
581 } // i = modules
582
583 if (fSingleModule) {
584 fPeaksCanvas[fNumModules]->cd();
585 //Draw the high gain peak-minus pedestals
586 fPedestals->GetPeakProfileHighGain(fVisibleModule)->Draw("colz");
587 fPeaksCanvas[fNumModules]->Update();
588 fPeaksCanvas[fNumModules]->Paint();
589
590 fPedsCanvas[fNumModules]->cd();
591 //Draw the high gain peak-minus pedestals
592 fPedestals->GetPedProfileHighGain(fVisibleModule)->Draw("colz");
593 fPedsCanvas[fNumModules]->Update();
594 fPedsCanvas[fNumModules]->Paint();
595
596 fPedsDiffCanvas[fNumModules]->cd();
597 //Draw the high gain peak-minus pedestals
598 fPedestals->GetPedProfileHighGainDiff(fVisibleModule)->Draw("colz");
599 fPedsDiffCanvas[fNumModules]->Update();
600 fPedsDiffCanvas[fNumModules]->Paint();
601
602 fPeaksDiffCanvas[fNumModules]->cd();
603 //Draw the high gain peak-minus pedestals
604 fPedestals->GetPeakProfileHighGainDiff(fVisibleModule)->Draw("colz");
605 fPeaksDiffCanvas[fNumModules]->Update();
606 fPeaksDiffCanvas[fNumModules]->Paint();
607
608 fPeaksRatioCanvas[fNumModules]->cd();
609 //Draw the high gain peak-minus pedestals
610 fPedestals->GetPeakProfileHighGainRatio(fVisibleModule)->Draw("colz");
611 fPeaksRatioCanvas[fNumModules]->Update();
612 fPeaksRatioCanvas[fNumModules]->Paint();
613
614 fPedsRatioCanvas[fNumModules]->cd();
615 //Draw the high gain peak-minus pedestals
616 fPedestals->GetPedProfileHighGainRatio(fVisibleModule)->Draw("colz");
617 fPedsRatioCanvas[fNumModules]->Update();
618 fPedsRatioCanvas[fNumModules]->Paint();
619 }
620 } // not low gain
621 else {
622 for (int i = 0; (i < fNumModules) && (!fSingleModule); i++) {
623 fPeaksCanvas[i]->cd();
624 //Draw the high gain peak-minus pedestals
625 fPedestals->GetPeakProfileLowGain((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
626 fPeaksCanvas[i]->Update();
627 fPeaksCanvas[i]->Paint();
628
629 fPedsCanvas[i]->cd();
630 //Draw the high gain peak-minus pedestals
631 fPedestals->GetPedProfileLowGain((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
632 fPedsCanvas[i]->Update();
633 fPedsCanvas[i]->Paint();
634
635 fPedsDiffCanvas[i]->cd();
636 //Draw the high gain peak-minus pedestals
637 fPedestals->GetPedProfileLowGainDiff((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
638 fPedsDiffCanvas[i]->Update();
639 fPedsDiffCanvas[i]->Paint();
640
641 fPeaksDiffCanvas[i]->cd();
642 //Draw the high gain peak-minus pedestals
643 fPedestals->GetPeakProfileLowGainDiff((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
644 fPeaksDiffCanvas[i]->Update();
645 fPeaksDiffCanvas[i]->Paint();
646
647 fPeaksRatioCanvas[i]->cd();
648 //Draw the high gain peak-minus pedestals
649 fPedestals->GetPeakProfileLowGainRatio((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
650 fPeaksRatioCanvas[i]->Update();
651 fPeaksRatioCanvas[i]->Paint();
652
653 fPedsRatioCanvas[i]->cd();
654 //Draw the high gain peak-minus pedestals
655 fPedestals->GetPedProfileLowGainRatio((i < fNumModules) ? i : fVisibleModule)->Draw("colz");
656 fPedsRatioCanvas[i]->Update();
657 fPedsRatioCanvas[i]->Paint();
658 }
659
660 if (fSingleModule) {
661 fPeaksCanvas[fNumModules]->cd();
662 //Draw the high gain peak-minus pedestals
663 fPedestals->GetPeakProfileLowGain(fVisibleModule)->Draw("colz");
664 fPeaksCanvas[fNumModules]->Update();
665 fPeaksCanvas[fNumModules]->Paint();
666
667 fPedsCanvas[fNumModules]->cd();
668 //Draw the high gain peak-minus pedestals
669 fPedestals->GetPedProfileLowGain(fVisibleModule)->Draw("colz");
670 fPedsCanvas[fNumModules]->Update();
671 fPedsCanvas[fNumModules]->Paint();
672
673 fPedsDiffCanvas[fNumModules]->cd();
674 //Draw the high gain peak-minus pedestals
675 fPedestals->GetPedProfileLowGainDiff(fVisibleModule)->Draw("colz");
676 fPedsDiffCanvas[fNumModules]->Update();
677 fPedsDiffCanvas[fNumModules]->Paint();
678
679 fPeaksDiffCanvas[fNumModules]->cd();
680 //Draw the high gain peak-minus pedestals
681 fPedestals->GetPeakProfileLowGainDiff(fVisibleModule)->Draw("colz");
682 fPeaksDiffCanvas[fNumModules]->Update();
683 fPeaksDiffCanvas[fNumModules]->Paint();
684
685 fPeaksRatioCanvas[fNumModules]->cd();
686 //Draw the high gain peak-minus pedestals
687 fPedestals->GetPeakProfileLowGainRatio(fVisibleModule)->Draw("colz");
688 fPeaksRatioCanvas[fNumModules]->Update();
689 fPeaksRatioCanvas[fNumModules]->Paint();
690
691 fPedsRatioCanvas[fNumModules]->cd();
692 //Draw the high gain peak-minus pedestals
693 fPedestals->GetPedProfileLowGainRatio(fVisibleModule)->Draw("colz");
694 fPedsRatioCanvas[fNumModules]->Update();
695 fPedsRatioCanvas[fNumModules]->Paint();
696 }
697 } // low gain
698
699 return;
700}
701
702//_____________________________________________________________________________
703void TMCal::OnGainButton()
704{ // Gain button handler
705
706 if (fLowGainMode) {
707 fLowGainMode = kFALSE;
708 fGainButton->SetText("Low gain");
709 }
710 else {
711 fLowGainMode = kTRUE;
712 fGainButton->SetText("High gain");
713 }
714
715 DrawHistos();
716
717 return;
718}
719
720//_____________________________________________________________________________
721void TMCal::OnRange(kTab tab)
722{//Range change handler
723 int i = 0;
724 switch(tab) {
725
726 case kPeds:
727 fPedsRangeSingle->SetPosition(fPedsRange->GetPosition());
728 fMaxPed = AliCaloCalibPedestal::GetSampleMax() - fPedsRange->GetPosition();
729 //printf("Value changed to %u.\n", (unsigned int)fMaxPedDiff);
730 for (i = 0; i < fNumModules; i++) {
731 fPedestals->GetPedProfileHighGain(i)->GetZaxis()->SetRangeUser(-1.0*fMaxPed, fMaxPed);
732 fPedestals->GetPedProfileLowGain(i)->GetZaxis()->SetRangeUser(-1.0*fMaxPed, fMaxPed);
733 if (!fSingleModule) {//Don't update all the monitors if we're in single module mode, to speed up the redraw there
734 fPedsCanvas[i]->Paint(); //For some reason we need paint-update-paint, just update-paint or paint-update won't do...
735 fPedsCanvas[i]->Update();
736 fPedsCanvas[i]->Paint();
737 }
738 }
739 fPedsCanvasSingle->Paint(); //For some reason we need paint-update-paint, just update-paint or paint-update won't do...
740 fPedsCanvasSingle->Update();
741 fPedsCanvasSingle->Paint();
742 break;
743
744 case kPeaks:
745 fPeaksRangeSingle->SetPosition(fPeaksRange->GetPosition());
746 fMaxPeak = AliCaloCalibPedestal::GetSampleMax() - fPeaksRange->GetPosition();
747 //printf("Value changed to %u.\n", (unsigned int)fMaxPedDiff);
748 for (i = 0; i < fNumModules; i++) {
749 fPedestals->GetPeakProfileHighGain(i)->GetZaxis()->SetRangeUser(-1.0*fMaxPeak, fMaxPeak);
750 fPedestals->GetPeakProfileLowGain(i)->GetZaxis()->SetRangeUser(-1.0*fMaxPeak, fMaxPeak);
751 if (!fSingleModule) {//Don't update all the monitors if we're in single module mode, to speed up the redraw there
752 fPeaksCanvas[i]->Paint(); //For some reason we need paint-update-paint, just update-paint or paint-update won't do...
753 fPeaksCanvas[i]->Update();
754 fPeaksCanvas[i]->Paint();
755 }
756 }
757 fPeaksCanvasSingle->Paint(); //For some reason we need paint-update-paint, just update-paint or paint-update won't do...
758 fPeaksCanvasSingle->Update();
759 fPeaksCanvasSingle->Paint();
760 break;
761
762 case kPedsDiff:
763 fPedsDiffRangeSingle->SetPosition(fPedsDiffRange->GetPosition());
764 fMaxPedDiff = AliCaloCalibPedestal::GetSampleMax() - fPedsDiffRange->GetPosition();
765 //printf("Value changed to %u.\n", (unsigned int)fMaxPedDiff);
766 for (i = 0; i < fNumModules; i++) {
767 fPedestals->GetPedProfileHighGainDiff(i)->GetZaxis()->SetRangeUser(-1.0*fMaxPedDiff, fMaxPedDiff);
768 fPedestals->GetPedProfileLowGainDiff(i)->GetZaxis()->SetRangeUser(-1.0*fMaxPedDiff, fMaxPedDiff);
769 if (!fSingleModule) {//Don't update all the monitors if we're in single module mode, to speed up the redraw there
770 fPedsDiffCanvas[i]->Paint(); //For some reason we need paint-update-paint, just update-paint or paint-update won't do...
771 fPedsDiffCanvas[i]->Update();
772 fPedsDiffCanvas[i]->Paint();
773 }
774 }
775 fPedsDiffCanvasSingle->Paint(); //For some reason we need paint-update-paint, just update-paint or paint-update won't do...
776 fPedsDiffCanvasSingle->Update();
777 fPedsDiffCanvasSingle->Paint();
778 break;
779
780 case kPeaksDiff:
781 fPeaksDiffRangeSingle->SetPosition(fPeaksDiffRange->GetPosition());
782 fMaxPeakDiff = AliCaloCalibPedestal::GetSampleMax() - fPeaksDiffRange->GetPosition();
783 //printf("Value changed to %u.\n", (unsigned int)fMaxPedDiff);
784 for (i = 0; i < fNumModules; i++) {
785 fPedestals->GetPeakProfileHighGainDiff(i)->GetZaxis()->SetRangeUser(-1.0*fMaxPeakDiff, fMaxPeakDiff);
786 fPedestals->GetPeakProfileLowGainDiff(i)->GetZaxis()->SetRangeUser(-1.0*fMaxPeakDiff, fMaxPeakDiff);
787 if (!fSingleModule) {//Don't update all the monitors if we're in single module mode, to speed up the redraw there
788 fPeaksDiffCanvas[i]->Paint();
789 fPeaksDiffCanvas[i]->Update();
790 fPeaksDiffCanvas[i]->Paint();
791 }
792 }
793 fPeaksDiffCanvasSingle->Paint();
794 fPeaksDiffCanvasSingle->Update();
795 fPeaksDiffCanvasSingle->Paint();
796 break;
797
798 case kPedsRatio:
799 fPedsRatioRangeSingle->SetPosition(fPedsRatioRange->GetPosition());
800 //fMaxPedRatio = fgkMaxMaxRatio - fPedsDiffRange->GetPosition() + fgkMinMaxRatio;
801 fMaxPedRatio = pow(2.0, -fPedsRatioRange->GetPosition()/fgkRatioStepScale);//Make the control logarithmic
802 //printf("Pedsratio changed to %g, position is set at %i.\n", fMaxPedRatio, (int)fPedsRatioRange->GetPosition());
803 for (i = 0; i < fNumModules; i++) {
804 fPedestals->GetPedProfileHighGainRatio(i)->GetZaxis()->SetRangeUser(0.0, fMaxPedRatio);
805 fPedestals->GetPedProfileLowGainRatio(i)->GetZaxis()->SetRangeUser(0.0, fMaxPedRatio);
806 if (!fSingleModule) {//Don't update all the monitors if we're in single module mode, to speed up the redraw there
807 fPedsRatioCanvas[i]->Paint();
808 fPedsRatioCanvas[i]->Update();
809 fPedsRatioCanvas[i]->Paint();
810 }
811 }
812 fPedsRatioCanvasSingle->Paint();
813 fPedsRatioCanvasSingle->Update();
814 fPedsRatioCanvasSingle->Paint();
815 break;
816
817 case kPeaksRatio:
818 fPeaksRatioRangeSingle->SetPosition(fPeaksRatioRange->GetPosition());
819 fMaxPeakRatio = pow(2.0, -fPeaksRatioRange->GetPosition()/fgkRatioStepScale);//Make the control logarithmic
820 //printf("Pedsratio changed to %g, position is set at %i.\n", fMaxPeakRatio, (int)fPeaksRatioRange->GetPosition());
821 for (i = 0; i < fNumModules; i++) {
822 fPedestals->GetPeakProfileHighGainRatio(i)->GetZaxis()->SetRangeUser(0.0, fMaxPeakRatio);
823 fPedestals->GetPeakProfileLowGainRatio(i)->GetZaxis()->SetRangeUser(0.0, fMaxPeakRatio);
824 if (!fSingleModule) {//Don't update all the monitors if we're in single module mode, to speed up the redraw there
825 fPeaksRatioCanvas[i]->Paint();
826 fPeaksRatioCanvas[i]->Update();
827 fPeaksRatioCanvas[i]->Paint();
828 }
829 }
830 fPeaksRatioCanvasSingle->Paint();
831 fPeaksRatioCanvasSingle->Update();
832 fPeaksRatioCanvasSingle->Paint();
833 break;
834
835 //The single-histo-at-a-time sliders. We'll just set the other slider to match and call the normal handler :)
836 case kPedsSingle:
837 fPedsRange->SetPosition(fPedsRangeSingle->GetPosition());
838 OnRange(kPeds);
839 break;
840 case kPeaksSingle:
841 fPeaksRange->SetPosition(fPeaksRangeSingle->GetPosition());
842 OnRange(kPeaks);
843 break;
844 case kPedsDiffSingle:
845 fPedsDiffRange->SetPosition(fPedsDiffRangeSingle->GetPosition());
846 OnRange(kPedsDiff);
847 break;
848 case kPeaksDiffSingle:
849 fPeaksDiffRange->SetPosition(fPeaksDiffRangeSingle->GetPosition());
850 OnRange(kPeaksDiff);
851 break;
852 case kPedsRatioSingle:
853 fPedsRatioRange->SetPosition(fPedsRatioRangeSingle->GetPosition());
854 OnRange(kPedsRatio);
855 break;
856 case kPeaksRatioSingle:
857 fPeaksRatioRange->SetPosition(fPeaksRatioRangeSingle->GetPosition());
858 OnRange(kPeaksRatio);
859 break;
860 default:
861 printf("Unknown tab slider %u.\n", (int)tab);
862 break;
863 }
864
865 return;
866}
867
868//_____________________________________________________________________________
869void TMCal::OnModeButton(int button)
870{ // Module selection radio button handler
871 if (button < fNumModules) {
872 fVisibleModule = button;
873 fSingleModule = true;
874
875 fPeaksTab->HideFrame(fPeaksFrame);
876 fPeaksTab->ShowFrame(fPeaksFrameSingle);
877
878 fPedsTab->HideFrame(fPedsFrame);
879 fPedsTab->ShowFrame(fPedsFrameSingle);
880
881 fPeaksDiffTab->HideFrame(fPeaksDiffFrame);
882 fPeaksDiffTab->ShowFrame(fPeaksDiffFrameSingle);
883
884 fPedsDiffTab->HideFrame(fPedsDiffFrame);
885 fPedsDiffTab->ShowFrame(fPedsDiffFrameSingle);
886
887 fPeaksRatioTab->HideFrame(fPeaksRatioFrame);
888 fPeaksRatioTab->ShowFrame(fPeaksRatioFrameSingle);
889
890 fPedsRatioTab->HideFrame(fPedsRatioFrame);
891 fPedsRatioTab->ShowFrame(fPedsRatioFrameSingle);
892
893 fDeadMapTab->HideFrame(fDeadMapFrame);
894 fDeadMapTab->ShowFrame(fDeadMapFrameSingle);
895
896 DrawHistos();
897 }
898 else { // all
899 fSingleModule = false;
900 fPeaksTab->HideFrame(fPeaksFrameSingle);
901 fPeaksTab->ShowFrame(fPeaksFrame);
902
903 fPedsTab->HideFrame(fPedsFrameSingle);
904 fPedsTab->ShowFrame(fPedsFrame);
905
906 fPeaksDiffTab->HideFrame(fPeaksDiffFrameSingle);
907 fPeaksDiffTab->ShowFrame(fPeaksDiffFrame);
908
909 fPedsDiffTab->HideFrame(fPedsDiffFrameSingle);
910 fPedsDiffTab->ShowFrame(fPedsDiffFrame);
911
912 fPeaksRatioTab->HideFrame(fPeaksRatioFrameSingle);
913 fPeaksRatioTab->ShowFrame(fPeaksRatioFrame);
914
915 fPedsRatioTab->HideFrame(fPedsRatioFrameSingle);
916 fPedsRatioTab->ShowFrame(fPedsRatioFrame);
917
918 fDeadMapTab->HideFrame(fDeadMapFrameSingle);
919 fDeadMapTab->ShowFrame(fDeadMapFrame);
920
921 DrawHistos();//this is because we may not have drawn the histos to their canvases.
922 }
923
924 return;
925}
926
927//_____________________________________________________________________________
928void TMCal::OnRunNoChange(Long_t val)
929{
930 //printf("Run number changed to %u.\n", (int)fRunNoEntry->GetIntNumber());
931 InitRawReaderAndStream(fRunNoEntry->GetIntNumber());
932 UpdateMonitors();
933 //We still need to re-paint the tabs to make the change visible
934 fPeaksFrame->Paint();
935 return;
936}
937
938//_____________________________________________________________________________
939void TMCal::OnTabChange(Int_t Id)
940{
941 //This sets the palette for the deadmap tab to the four colors we want there, and otherwise to
942 //the standard no. 1 palette. To make this work, we need to do updatemonitors, which is slow,
943 //so in case you're willing to sacrifice the custom palette for the deadmap in favor of speed,
944 //just comment out/remove this function and the GetTab()->Connect(...) in the constructor.
945 if (!strcmp(GetTab()->GetTabTab(Id)->GetString(), fgkDeadMapTabName)) {
946 gStyle->SetPalette(AliCaloCalibPedestal::kNumDeadMapStates, fDeadMapPalette);
947 }
948 else {
949 gStyle->SetPalette(1);
950 }
951
952 UpdateMonitors();
953
954 return;
955}