1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /* $Id: AliTRDqaGuiBlackChamber.cxx 23871 2008-02-12 11:48:20Z hristov $ */
18 //////////////////////////////////////////////////////////////////////////////////
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.
30 //////////////////////////////////////////////////////////////////////////////////
32 #include "AliTRDqaGuiBlackChamber.h"
43 #include "TPaveText.h"
45 #include "TGComboBox.h"
47 #include "TRootEmbeddedCanvas.h"
49 ClassImp(AliTRDqaGuiBlackChamber)
51 const Int_t AliTRDqaGuiBlackChamber::fgknSM = 18;
52 const Int_t AliTRDqaGuiBlackChamber::fgknChamber = 30;
53 //const Int_t AliTRDqaGuiBlackChamber::fgknCh = 6;
55 //////////////////////////////////////////////////////////////////////////////////
57 AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber()
77 // Default constructor
80 for (Int_t i = 0; i < 2; i++) {
85 for (Int_t j = 0; j < 5; j++) {
90 //strncpy(fFileName,"",256);
94 //////////////////////////////////////////////////////////////////////////////////
96 AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber(TGWindow *parent)
97 : TGCompositeFrame(parent, 720, 500),
122 SetLayoutManager(new TGVerticalLayout(this));
123 fGPanel = new TGHorizontalFrame(this);
125 // fGLabel = new TGLabel(fGPanel, "Current Chamber: ");
126 fGPrevSM = new TGTextButton(fGPanel, "Prev SM");
127 fGPrevChamber = new TGTextButton(fGPanel, "Prev Chamber");
129 fGNextSM = new TGTextButton(fGPanel, "Next SM");
130 fGNextChamber = new TGTextButton(fGPanel, "Next Chamber");
132 fGSelectSM = new TGComboBox(fGPanel);
133 for(int i=0; i<fgknSM; i++) fGSelectSM->AddEntry(Form("SM %d", i), i);
134 fGSelectSM->Resize(100, (Int_t)(fGPrevSM->GetHeight()*1.4));
135 fGSelectSM->Select(fIdxSM);
137 fGSelectChamber = new TGComboBox(fGPanel);
138 for(int i=0; i<fgknChamber; i++) fGSelectChamber->AddEntry(Form("Chamber %d", i), i);
139 fGSelectChamber->Resize(100, (Int_t)(fGPrevSM->GetHeight()*1.4));
140 fGSelectChamber->Select(fIdxChamber);
143 fGSelectView = new TGComboBox(fGPanel);
144 fGSelectView->AddEntry("pedestals",0);
145 fGSelectView->AddEntry("entiries", 1);
146 fGSelectView->Resize(150, (Int_t)(fGPrevSM->GetHeight()*1.4));
147 fGSelectView->Select(0);
150 //fGPlay = new TGTextButton(fGPanel, "PLAY");
152 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
154 // fGPanel->AddFrame(fGLabel, hint);
155 fGPanel->AddFrame(fGPrevSM, hint);
156 fGPanel->AddFrame(fGPrevChamber, hint);
158 fGPanel->AddFrame(fGSelectSM, hint);
159 fGPanel->AddFrame(fGSelectChamber, hint);
161 fGPanel->AddFrame(fGNextChamber, hint);
162 fGPanel->AddFrame(fGNextSM, hint);
164 fGPanel->AddFrame(fGSelectView, hint);
165 //fGPanel->AddFrame(fGPlay, hint);
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()");
175 fGSelectSM->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectSM(Int_t)");
176 fGSelectChamber->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectChamber(Int_t)");
178 fGSelectView->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectView(Int_t)");
180 //fGPlay->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "Play()");
184 // fGCanvas = new TGCompositeFrame(this);
185 // fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,2,0,0));
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]);
193 fGCanvasUp = new TGCompositeFrame(this);
194 fGCanvasUp->SetLayoutManager(new TGMatrixLayout(fGCanvasUp,1,2,1,1));
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);
205 fGCanvasDown = new TGCompositeFrame(this);
206 fGCanvasDown->SetLayoutManager(new TGMatrixLayout(fGCanvasDown, 1,3,1,1));
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);
215 for(Int_t i=0; i<5; i++) {
219 AddFrame(fGCanvasUp);
220 AddFrame(fGCanvasDown);
224 //////////////////////////////////////////////////////////////////////////////////
226 void AliTRDqaGuiBlackChamber::SetQAFile(const char *filename) {
228 // sets a file with histograms
231 //const char *names[5] = {"ped", "noise", "pedDist", "noiseDist", "signal"};
232 const char *names[10] = {
233 "ped", "noise", "pedDist", "noiseDist", "signal",
234 "entries", "entriesRM", "entriesDist", "", ""
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};
239 //strncpy(fFileName,filename,256);
240 fFileName = filename;
242 for(int i=0; i<5; i++) {
243 if (fHistList[i]) delete fHistList[i];
246 TFile *file = new TFile(filename);
248 // printf("%d %lf %lf\n", fSetRangePed, fRangePed[0], fRangePed[1]);
249 //printf("%d %lf %lf\n", fSetRangeNoise, fRangeNoise[0], fRangeNoise[1]);
251 for(Int_t i=0; i<5; i++) {
253 Int_t index = fIdxSM * 30 + fIdxChamber;
254 const char *nn = Form("%s_%d", names[i+5*fView], index);
255 //printf("%s\n", nn);
256 fHistList[i] = (TH1*)file->Get(nn); //Form("%s_$d", names[fIdxType], index));
257 if (!fHistList[i]) continue;
259 if ( (fView == 1) && (i == 0)) {
260 fHistList[i]->SetMinimum(0);
261 fHistList[i]->SetMaximum(2);
264 if ( (fView == 0) && (i == 0) && fSetRangePed) {
265 fHistList[i]->SetMinimum(fRangePed[0]);
266 fHistList[i]->SetMaximum(fRangePed[1]);
269 if ( (fView == 0) && (i == 1) && fSetRangeNoise) {
270 fHistList[i]->SetMinimum(fRangeNoise[0]);
271 fHistList[i]->SetMaximum(fRangeNoise[1]);
274 fCanvasList[i]->GetCanvas()->cd();
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();
282 for(Int_t i=1; i<8; i++) {
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);
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);
297 for(Int_t i=1; i<4; i++) {
299 fCanvasList[0]->GetCanvas()->cd();
300 line = new TLine(i*4-0.5, 0, i*4-0.5, 143);
301 line->SetLineStyle(2);
304 fCanvasList[1]->GetCanvas()->cd();
305 line = new TLine(i*4-0.5, 0, i*4-0.5, 143);
306 line->SetLineStyle(2);
314 for(Int_t i=0; i<5; i++)
315 fCanvasList[i]->GetCanvas()->Update();
318 //////////////////////////////////////////////////////////////////////////////////
320 void AliTRDqaGuiBlackChamber::SetChamber(Int_t idxChamber) {
322 // sets active chamber
325 fIdxChamber = idxChamber;
326 fGSelectSM->Select(fIdxSM, 0);
327 fGSelectChamber->Select(fIdxChamber, 0);
328 SetQAFile(fFileName);
331 //////////////////////////////////////////////////////////////////////////////////
333 void AliTRDqaGuiBlackChamber::SetSM(Int_t idxSM) {
335 // sets active supermodule
339 fGSelectSM->Select(fIdxSM, 0);
340 fGSelectChamber->Select(fIdxChamber, 0);
341 SetQAFile(fFileName);
344 //////////////////////////////////////////////////////////////////////////////////
346 void AliTRDqaGuiBlackChamber::SetView(Int_t idxView) {
352 fGSelectView->Select(idxView);
353 SetQAFile(fFileName);
355 //////////////////////////////////////////////////////////////////////////////////