]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/qaGui/AliTRDqaGuiBlackChamber.cxx
1) Centrality dependent thresholds parameters
[u/mrichter/AliRoot.git] / TRD / qaGui / AliTRDqaGuiBlackChamber.cxx
CommitLineData
36f55715 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id: AliTRDqaGuiBlackChamber.cxx 23871 2008-02-12 11:48:20Z hristov $ */
17
18//////////////////////////////////////////////////////////////////////////////////
19//
20// This class is a Graphical User Interface for the Quality Monitorig
21// of black (non zero zuppresed) events from TRD.
22// It lets display and browse throu histograms created by the class
23// AliTRDqaBlackEvents.
24// The class works in cooperation with AliTRDqaGuiMainBlack.
25//
26// S. Radomski
27// Uni-Heidelberg
28// Feb. 2008
29//
30//////////////////////////////////////////////////////////////////////////////////
31
32#include "AliTRDqaGuiBlackChamber.h"
33
34#include "TH1D.h"
35#include "TH2D.h"
36#include "TH3D.h"
37#include "TFile.h"
38#include "TCanvas.h"
39#include "TString.h"
40#include "TSystem.h"
41
a73a87be 42#include "TLine.h"
36f55715 43#include "TPaveText.h"
44#include "TGLabel.h"
45#include "TGComboBox.h"
46#include "TGButton.h"
47#include "TRootEmbeddedCanvas.h"
48
49ClassImp(AliTRDqaGuiBlackChamber)
50
51const Int_t AliTRDqaGuiBlackChamber::fgknSM = 18;
52const Int_t AliTRDqaGuiBlackChamber::fgknChamber = 30;
53//const Int_t AliTRDqaGuiBlackChamber::fgknCh = 6;
54
55//////////////////////////////////////////////////////////////////////////////////
56
57AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber()
9b99c029 58 : fView(0),
59 fSetRangePed(0),
36f55715 60 fSetRangeNoise(0),
61 fIdxSM(0),
62 fIdxChamber(0),
821ef0a9 63 fFileName(0x0),
36f55715 64 fGPanel(0),
65 fGCanvas(0),
66 fGCanvasUp(0),
67 fGCanvasDown(0),
68 fGSelectSM(0),
69 fGSelectChamber(0),
80c0ced7 70 fGSelectView(0),
36f55715 71 fGPrevSM(0),
80c0ced7 72 fGPrevChamber(0),
36f55715 73 fGNextSM(0),
74 fGNextChamber(0)
75{
02f3bfcc 76 //
77 // Default constructor
78 //
79
80 for (Int_t i = 0; i < 2; i++) {
81 fRangePed[i] = 0.0;
82 fRangeNoise[i] = 0.0;
83 }
84
85 for (Int_t j = 0; j < 5; j++) {
86 fCanvasList[j] = 0x0;
87 fHistList[j] = 0x0;
88 }
89
821ef0a9 90 //strncpy(fFileName,"",256);
02f3bfcc 91
36f55715 92}
93
94//////////////////////////////////////////////////////////////////////////////////
95
9b99c029 96AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber(TGWindow *parent)
36f55715 97 : TGCompositeFrame(parent, 720, 500),
9b99c029 98 fView(0),
36f55715 99 fSetRangePed(0),
100 fSetRangeNoise(0),
101 fIdxSM(0),
102 fIdxChamber(0),
821ef0a9 103 fFileName(0x0),
36f55715 104 fGPanel(0),
105 fGCanvas(0),
106 fGCanvasUp(0),
107 fGCanvasDown(0),
108 fGSelectSM(0),
109 fGSelectChamber(0),
80c0ced7 110 fGSelectView(0),
36f55715 111 fGPrevSM(0),
112 fGPrevChamber(0),
113 fGNextSM(0),
114 fGNextChamber(0)
115{
116 //
117 // main constructor
118 //
119
9b99c029 120 // steering panel
36f55715 121
122 SetLayoutManager(new TGVerticalLayout(this));
36f55715 123 fGPanel = new TGHorizontalFrame(this);
124
125 // fGLabel = new TGLabel(fGPanel, "Current Chamber: ");
126 fGPrevSM = new TGTextButton(fGPanel, "Prev SM");
127 fGPrevChamber = new TGTextButton(fGPanel, "Prev Chamber");
128
129 fGNextSM = new TGTextButton(fGPanel, "Next SM");
130 fGNextChamber = new TGTextButton(fGPanel, "Next Chamber");
131
132 fGSelectSM = new TGComboBox(fGPanel);
133 for(int i=0; i<fgknSM; i++) fGSelectSM->AddEntry(Form("SM %d", i), i);
a73a87be 134 fGSelectSM->Resize(100, (Int_t)(fGPrevSM->GetHeight()*1.4));
36f55715 135 fGSelectSM->Select(fIdxSM);
136
137 fGSelectChamber = new TGComboBox(fGPanel);
138 for(int i=0; i<fgknChamber; i++) fGSelectChamber->AddEntry(Form("Chamber %d", i), i);
a73a87be 139 fGSelectChamber->Resize(100, (Int_t)(fGPrevSM->GetHeight()*1.4));
36f55715 140 fGSelectChamber->Select(fIdxChamber);
141
9b99c029 142 // vew
143 fGSelectView = new TGComboBox(fGPanel);
144 fGSelectView->AddEntry("pedestals",0);
145 fGSelectView->AddEntry("entiries", 1);
a73a87be 146 fGSelectView->Resize(150, (Int_t)(fGPrevSM->GetHeight()*1.4));
9b99c029 147 fGSelectView->Select(0);
148
149
36f55715 150 //fGPlay = new TGTextButton(fGPanel, "PLAY");
151
152 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
153
154 // fGPanel->AddFrame(fGLabel, hint);
155 fGPanel->AddFrame(fGPrevSM, hint);
156 fGPanel->AddFrame(fGPrevChamber, hint);
157
158 fGPanel->AddFrame(fGSelectSM, hint);
159 fGPanel->AddFrame(fGSelectChamber, hint);
160
161 fGPanel->AddFrame(fGNextChamber, hint);
162 fGPanel->AddFrame(fGNextSM, hint);
163
9b99c029 164 fGPanel->AddFrame(fGSelectView, hint);
36f55715 165 //fGPanel->AddFrame(fGPlay, hint);
166
167 AddFrame(fGPanel);
168
169 // panel logic
170 fGPrevChamber->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "PreviusChamber()");
171 fGNextChamber->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "NextChamber()");
172 fGPrevSM->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "PreviusSM()");
173 fGNextSM->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "NextSM()");
174
175 fGSelectSM->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectSM(Int_t)");
176 fGSelectChamber->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectChamber(Int_t)");
177
9b99c029 178 fGSelectView->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectView(Int_t)");
179
36f55715 180 //fGPlay->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "Play()");
181
182 // histograms
183
184 // fGCanvas = new TGCompositeFrame(this);
185 // fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,2,0,0));
186
187 //for(Int_t i=0; i<4; i++) {
188 // fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvas, 480, 300);
189 // fGCanvas->AddFrame(fCanvasList[i]);
190 // }
191
192
193 fGCanvasUp = new TGCompositeFrame(this);
194 fGCanvasUp->SetLayoutManager(new TGMatrixLayout(fGCanvasUp,1,2,1,1));
195
196 for(Int_t i=0; i<2; i++) {
197 fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvasUp, 480, 400);
198 fGCanvasUp->AddFrame(fCanvasList[i]);
199 fCanvasList[i]->GetCanvas()->SetTopMargin(0.05);
200 fCanvasList[i]->GetCanvas()->SetRightMargin(0.15);
201 fCanvasList[i]->GetCanvas()->SetBottomMargin(0.05);
202 }
203
204
205 fGCanvasDown = new TGCompositeFrame(this);
206 fGCanvasDown->SetLayoutManager(new TGMatrixLayout(fGCanvasDown, 1,3,1,1));
207
208 for(Int_t i=2; i<5; i++) {
209 fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvasDown, 320, 300);
210 fGCanvasDown->AddFrame(fCanvasList[i]);
211 fCanvasList[i]->GetCanvas()->SetTopMargin(0.05);
212 fCanvasList[i]->GetCanvas()->SetRightMargin(0.05);
213 }
214
215 for(Int_t i=0; i<5; i++) {
216 fHistList[i] = 0;
217 }
218
219 AddFrame(fGCanvasUp);
220 AddFrame(fGCanvasDown);
221
222}
223
224//////////////////////////////////////////////////////////////////////////////////
225
226void AliTRDqaGuiBlackChamber::SetQAFile(const char *filename) {
227 //
228 // sets a file with histograms
229 //
230
9b99c029 231 //const char *names[5] = {"ped", "noise", "pedDist", "noiseDist", "signal"};
232 const char *names[10] = {
233 "ped", "noise", "pedDist", "noiseDist", "signal",
80c0ced7 234 "entries", "entriesRM", "entriesDist", "", ""
9b99c029 235 };
236 const char *opt[10] = {"colz", "colz", "", "", "", "colz", "colz", "", "", ""};
237 const Int_t kLogy[10] = {0, 0, 1, 1, 1, 0, 0, 1, 1,1};
36f55715 238
821ef0a9 239 //strncpy(fFileName,filename,256);
240 fFileName = filename;
36f55715 241
242 for(int i=0; i<5; i++) {
243 if (fHistList[i]) delete fHistList[i];
244 }
245
246 TFile *file = new TFile(filename);
247
248 // printf("%d %lf %lf\n", fSetRangePed, fRangePed[0], fRangePed[1]);
249 //printf("%d %lf %lf\n", fSetRangeNoise, fRangeNoise[0], fRangeNoise[1]);
250
251 for(Int_t i=0; i<5; i++) {
252
253 Int_t index = fIdxSM * 30 + fIdxChamber;
9b99c029 254 const char *nn = Form("%s_%d", names[i+5*fView], index);
36f55715 255 //printf("%s\n", nn);
256 fHistList[i] = (TH1*)file->Get(nn); //Form("%s_$d", names[fIdxType], index));
257 if (!fHistList[i]) continue;
9b99c029 258
259 if ( (fView == 1) && (i == 0)) {
260 fHistList[i]->SetMinimum(0);
261 fHistList[i]->SetMaximum(2);
262 }
263
264 if ( (fView == 0) && (i == 0) && fSetRangePed) {
36f55715 265 fHistList[i]->SetMinimum(fRangePed[0]);
266 fHistList[i]->SetMaximum(fRangePed[1]);
267 }
268
9b99c029 269 if ( (fView == 0) && (i == 1) && fSetRangeNoise) {
36f55715 270 fHistList[i]->SetMinimum(fRangeNoise[0]);
271 fHistList[i]->SetMaximum(fRangeNoise[1]);
272 }
273
36f55715 274 fCanvasList[i]->GetCanvas()->cd();
9b99c029 275 fCanvasList[i]->GetCanvas()->SetLogy(kLogy[i+5*fView]);
276 if (fHistList[i]) fHistList[i]->Draw(opt[i+5*fView]);
277 //fCanvasList[i]->GetCanvas()->Update();
36f55715 278 }
9b99c029 279
a73a87be 280 // mcm lines
281 TLine *line;
282 for(Int_t i=1; i<8; i++) {
283
284 fCanvasList[0]->GetCanvas()->cd();
285 line = new TLine(0, i*18-0.5, 15, i*18-0.5);
286 line->SetLineStyle(2);
287 if (i!=4) line->SetLineStyle(3);
288 line->Draw();
289
290 fCanvasList[1]->GetCanvas()->cd();
291 line = new TLine(0, i*18-0.5, 15, i*18-0.5);
292 line->SetLineStyle(2);
293 if (i!=4) line->SetLineStyle(3);
294 line->Draw();
295 }
296
297 for(Int_t i=1; i<4; i++) {
298
299 fCanvasList[0]->GetCanvas()->cd();
300 line = new TLine(i*4-0.5, 0, i*4-0.5, 143);
301 line->SetLineStyle(2);
302 line->Draw();
303
304 fCanvasList[1]->GetCanvas()->cd();
305 line = new TLine(i*4-0.5, 0, i*4-0.5, 143);
306 line->SetLineStyle(2);
307 line->Draw();
308 }
309
310
311
312
313
9b99c029 314 for(Int_t i=0; i<5; i++)
315 fCanvasList[i]->GetCanvas()->Update();
36f55715 316}
317
318//////////////////////////////////////////////////////////////////////////////////
319
320void AliTRDqaGuiBlackChamber::SetChamber(Int_t idxChamber) {
321 //
322 // sets active chamber
323 //
324
325 fIdxChamber = idxChamber;
326 fGSelectSM->Select(fIdxSM, 0);
327 fGSelectChamber->Select(fIdxChamber, 0);
328 SetQAFile(fFileName);
329}
330
331//////////////////////////////////////////////////////////////////////////////////
332
333void AliTRDqaGuiBlackChamber::SetSM(Int_t idxSM) {
334 //
335 // sets active supermodule
336 //
337
338 fIdxSM = idxSM;
339 fGSelectSM->Select(fIdxSM, 0);
340 fGSelectChamber->Select(fIdxChamber, 0);
341 SetQAFile(fFileName);
342}
343
344//////////////////////////////////////////////////////////////////////////////////
9b99c029 345
346void AliTRDqaGuiBlackChamber::SetView(Int_t idxView) {
347 //
348 // sets active view
349 //
350
351 fView = idxView;
352 fGSelectView->Select(idxView);
353 SetQAFile(fFileName);
354}
355//////////////////////////////////////////////////////////////////////////////////