]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/qaGui/AliTRDqaGuiBlackChamber.cxx
Code cleanup in AliITSDetTypeRec and vertexers + minor bug fix in AliITSVertexer3D...
[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),
63 fGPanel(0),
64 fGCanvas(0),
65 fGCanvasUp(0),
66 fGCanvasDown(0),
67 fGSelectSM(0),
68 fGSelectChamber(0),
80c0ced7 69 fGSelectView(0),
36f55715 70 fGPrevSM(0),
80c0ced7 71 fGPrevChamber(0),
36f55715 72 fGNextSM(0),
73 fGNextChamber(0)
74{
75}
76
77//////////////////////////////////////////////////////////////////////////////////
78
9b99c029 79AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber(TGWindow *parent)
36f55715 80 : TGCompositeFrame(parent, 720, 500),
9b99c029 81 fView(0),
36f55715 82 fSetRangePed(0),
83 fSetRangeNoise(0),
84 fIdxSM(0),
85 fIdxChamber(0),
86 fGPanel(0),
87 fGCanvas(0),
88 fGCanvasUp(0),
89 fGCanvasDown(0),
90 fGSelectSM(0),
91 fGSelectChamber(0),
80c0ced7 92 fGSelectView(0),
36f55715 93 fGPrevSM(0),
94 fGPrevChamber(0),
95 fGNextSM(0),
96 fGNextChamber(0)
97{
98 //
99 // main constructor
100 //
101
9b99c029 102 // steering panel
36f55715 103
104 SetLayoutManager(new TGVerticalLayout(this));
36f55715 105 fGPanel = new TGHorizontalFrame(this);
106
107 // fGLabel = new TGLabel(fGPanel, "Current Chamber: ");
108 fGPrevSM = new TGTextButton(fGPanel, "Prev SM");
109 fGPrevChamber = new TGTextButton(fGPanel, "Prev Chamber");
110
111 fGNextSM = new TGTextButton(fGPanel, "Next SM");
112 fGNextChamber = new TGTextButton(fGPanel, "Next Chamber");
113
114 fGSelectSM = new TGComboBox(fGPanel);
115 for(int i=0; i<fgknSM; i++) fGSelectSM->AddEntry(Form("SM %d", i), i);
a73a87be 116 fGSelectSM->Resize(100, (Int_t)(fGPrevSM->GetHeight()*1.4));
36f55715 117 fGSelectSM->Select(fIdxSM);
118
119 fGSelectChamber = new TGComboBox(fGPanel);
120 for(int i=0; i<fgknChamber; i++) fGSelectChamber->AddEntry(Form("Chamber %d", i), i);
a73a87be 121 fGSelectChamber->Resize(100, (Int_t)(fGPrevSM->GetHeight()*1.4));
36f55715 122 fGSelectChamber->Select(fIdxChamber);
123
9b99c029 124 // vew
125 fGSelectView = new TGComboBox(fGPanel);
126 fGSelectView->AddEntry("pedestals",0);
127 fGSelectView->AddEntry("entiries", 1);
a73a87be 128 fGSelectView->Resize(150, (Int_t)(fGPrevSM->GetHeight()*1.4));
9b99c029 129 fGSelectView->Select(0);
130
131
36f55715 132 //fGPlay = new TGTextButton(fGPanel, "PLAY");
133
134 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
135
136 // fGPanel->AddFrame(fGLabel, hint);
137 fGPanel->AddFrame(fGPrevSM, hint);
138 fGPanel->AddFrame(fGPrevChamber, hint);
139
140 fGPanel->AddFrame(fGSelectSM, hint);
141 fGPanel->AddFrame(fGSelectChamber, hint);
142
143 fGPanel->AddFrame(fGNextChamber, hint);
144 fGPanel->AddFrame(fGNextSM, hint);
145
9b99c029 146 fGPanel->AddFrame(fGSelectView, hint);
36f55715 147 //fGPanel->AddFrame(fGPlay, hint);
148
149 AddFrame(fGPanel);
150
151 // panel logic
152 fGPrevChamber->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "PreviusChamber()");
153 fGNextChamber->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "NextChamber()");
154 fGPrevSM->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "PreviusSM()");
155 fGNextSM->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "NextSM()");
156
157 fGSelectSM->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectSM(Int_t)");
158 fGSelectChamber->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectChamber(Int_t)");
159
9b99c029 160 fGSelectView->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectView(Int_t)");
161
36f55715 162 //fGPlay->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "Play()");
163
164 // histograms
165
166 // fGCanvas = new TGCompositeFrame(this);
167 // fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,2,0,0));
168
169 //for(Int_t i=0; i<4; i++) {
170 // fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvas, 480, 300);
171 // fGCanvas->AddFrame(fCanvasList[i]);
172 // }
173
174
175 fGCanvasUp = new TGCompositeFrame(this);
176 fGCanvasUp->SetLayoutManager(new TGMatrixLayout(fGCanvasUp,1,2,1,1));
177
178 for(Int_t i=0; i<2; i++) {
179 fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvasUp, 480, 400);
180 fGCanvasUp->AddFrame(fCanvasList[i]);
181 fCanvasList[i]->GetCanvas()->SetTopMargin(0.05);
182 fCanvasList[i]->GetCanvas()->SetRightMargin(0.15);
183 fCanvasList[i]->GetCanvas()->SetBottomMargin(0.05);
184 }
185
186
187 fGCanvasDown = new TGCompositeFrame(this);
188 fGCanvasDown->SetLayoutManager(new TGMatrixLayout(fGCanvasDown, 1,3,1,1));
189
190 for(Int_t i=2; i<5; i++) {
191 fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvasDown, 320, 300);
192 fGCanvasDown->AddFrame(fCanvasList[i]);
193 fCanvasList[i]->GetCanvas()->SetTopMargin(0.05);
194 fCanvasList[i]->GetCanvas()->SetRightMargin(0.05);
195 }
196
197 for(Int_t i=0; i<5; i++) {
198 fHistList[i] = 0;
199 }
200
201 AddFrame(fGCanvasUp);
202 AddFrame(fGCanvasDown);
203
204}
205
206//////////////////////////////////////////////////////////////////////////////////
207
208void AliTRDqaGuiBlackChamber::SetQAFile(const char *filename) {
209 //
210 // sets a file with histograms
211 //
212
9b99c029 213 //const char *names[5] = {"ped", "noise", "pedDist", "noiseDist", "signal"};
214 const char *names[10] = {
215 "ped", "noise", "pedDist", "noiseDist", "signal",
80c0ced7 216 "entries", "entriesRM", "entriesDist", "", ""
9b99c029 217 };
218 const char *opt[10] = {"colz", "colz", "", "", "", "colz", "colz", "", "", ""};
219 const Int_t kLogy[10] = {0, 0, 1, 1, 1, 0, 0, 1, 1,1};
36f55715 220
221 strcpy(fFileName, filename);
222
223 for(int i=0; i<5; i++) {
224 if (fHistList[i]) delete fHistList[i];
225 }
226
227 TFile *file = new TFile(filename);
228
229 // printf("%d %lf %lf\n", fSetRangePed, fRangePed[0], fRangePed[1]);
230 //printf("%d %lf %lf\n", fSetRangeNoise, fRangeNoise[0], fRangeNoise[1]);
231
232 for(Int_t i=0; i<5; i++) {
233
234 Int_t index = fIdxSM * 30 + fIdxChamber;
9b99c029 235 const char *nn = Form("%s_%d", names[i+5*fView], index);
36f55715 236 //printf("%s\n", nn);
237 fHistList[i] = (TH1*)file->Get(nn); //Form("%s_$d", names[fIdxType], index));
238 if (!fHistList[i]) continue;
9b99c029 239
240 if ( (fView == 1) && (i == 0)) {
241 fHistList[i]->SetMinimum(0);
242 fHistList[i]->SetMaximum(2);
243 }
244
245 if ( (fView == 0) && (i == 0) && fSetRangePed) {
36f55715 246 fHistList[i]->SetMinimum(fRangePed[0]);
247 fHistList[i]->SetMaximum(fRangePed[1]);
248 }
249
9b99c029 250 if ( (fView == 0) && (i == 1) && fSetRangeNoise) {
36f55715 251 fHistList[i]->SetMinimum(fRangeNoise[0]);
252 fHistList[i]->SetMaximum(fRangeNoise[1]);
253 }
254
36f55715 255 fCanvasList[i]->GetCanvas()->cd();
9b99c029 256 fCanvasList[i]->GetCanvas()->SetLogy(kLogy[i+5*fView]);
257 if (fHistList[i]) fHistList[i]->Draw(opt[i+5*fView]);
258 //fCanvasList[i]->GetCanvas()->Update();
36f55715 259 }
9b99c029 260
a73a87be 261 // mcm lines
262 TLine *line;
263 for(Int_t i=1; i<8; i++) {
264
265 fCanvasList[0]->GetCanvas()->cd();
266 line = new TLine(0, i*18-0.5, 15, i*18-0.5);
267 line->SetLineStyle(2);
268 if (i!=4) line->SetLineStyle(3);
269 line->Draw();
270
271 fCanvasList[1]->GetCanvas()->cd();
272 line = new TLine(0, i*18-0.5, 15, i*18-0.5);
273 line->SetLineStyle(2);
274 if (i!=4) line->SetLineStyle(3);
275 line->Draw();
276 }
277
278 for(Int_t i=1; i<4; i++) {
279
280 fCanvasList[0]->GetCanvas()->cd();
281 line = new TLine(i*4-0.5, 0, i*4-0.5, 143);
282 line->SetLineStyle(2);
283 line->Draw();
284
285 fCanvasList[1]->GetCanvas()->cd();
286 line = new TLine(i*4-0.5, 0, i*4-0.5, 143);
287 line->SetLineStyle(2);
288 line->Draw();
289 }
290
291
292
293
294
9b99c029 295 for(Int_t i=0; i<5; i++)
296 fCanvasList[i]->GetCanvas()->Update();
36f55715 297}
298
299//////////////////////////////////////////////////////////////////////////////////
300
301void AliTRDqaGuiBlackChamber::SetChamber(Int_t idxChamber) {
302 //
303 // sets active chamber
304 //
305
306 fIdxChamber = idxChamber;
307 fGSelectSM->Select(fIdxSM, 0);
308 fGSelectChamber->Select(fIdxChamber, 0);
309 SetQAFile(fFileName);
310}
311
312//////////////////////////////////////////////////////////////////////////////////
313
314void AliTRDqaGuiBlackChamber::SetSM(Int_t idxSM) {
315 //
316 // sets active supermodule
317 //
318
319 fIdxSM = idxSM;
320 fGSelectSM->Select(fIdxSM, 0);
321 fGSelectChamber->Select(fIdxChamber, 0);
322 SetQAFile(fFileName);
323}
324
325//////////////////////////////////////////////////////////////////////////////////
9b99c029 326
327void AliTRDqaGuiBlackChamber::SetView(Int_t idxView) {
328 //
329 // sets active view
330 //
331
332 fView = idxView;
333 fGSelectView->Select(idxView);
334 SetQAFile(fFileName);
335}
336//////////////////////////////////////////////////////////////////////////////////