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 //////////////////////////////////////////////////////////////////////////////////
79 AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber(TGWindow *parent)
80 : TGCompositeFrame(parent, 720, 500),
104 SetLayoutManager(new TGVerticalLayout(this));
105 fGPanel = new TGHorizontalFrame(this);
107 // fGLabel = new TGLabel(fGPanel, "Current Chamber: ");
108 fGPrevSM = new TGTextButton(fGPanel, "Prev SM");
109 fGPrevChamber = new TGTextButton(fGPanel, "Prev Chamber");
111 fGNextSM = new TGTextButton(fGPanel, "Next SM");
112 fGNextChamber = new TGTextButton(fGPanel, "Next Chamber");
114 fGSelectSM = new TGComboBox(fGPanel);
115 for(int i=0; i<fgknSM; i++) fGSelectSM->AddEntry(Form("SM %d", i), i);
116 fGSelectSM->Resize(100, (Int_t)(fGPrevSM->GetHeight()*1.4));
117 fGSelectSM->Select(fIdxSM);
119 fGSelectChamber = new TGComboBox(fGPanel);
120 for(int i=0; i<fgknChamber; i++) fGSelectChamber->AddEntry(Form("Chamber %d", i), i);
121 fGSelectChamber->Resize(100, (Int_t)(fGPrevSM->GetHeight()*1.4));
122 fGSelectChamber->Select(fIdxChamber);
125 fGSelectView = new TGComboBox(fGPanel);
126 fGSelectView->AddEntry("pedestals",0);
127 fGSelectView->AddEntry("entiries", 1);
128 fGSelectView->Resize(150, (Int_t)(fGPrevSM->GetHeight()*1.4));
129 fGSelectView->Select(0);
132 //fGPlay = new TGTextButton(fGPanel, "PLAY");
134 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
136 // fGPanel->AddFrame(fGLabel, hint);
137 fGPanel->AddFrame(fGPrevSM, hint);
138 fGPanel->AddFrame(fGPrevChamber, hint);
140 fGPanel->AddFrame(fGSelectSM, hint);
141 fGPanel->AddFrame(fGSelectChamber, hint);
143 fGPanel->AddFrame(fGNextChamber, hint);
144 fGPanel->AddFrame(fGNextSM, hint);
146 fGPanel->AddFrame(fGSelectView, hint);
147 //fGPanel->AddFrame(fGPlay, hint);
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()");
157 fGSelectSM->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectSM(Int_t)");
158 fGSelectChamber->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectChamber(Int_t)");
160 fGSelectView->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectView(Int_t)");
162 //fGPlay->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "Play()");
166 // fGCanvas = new TGCompositeFrame(this);
167 // fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,2,0,0));
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]);
175 fGCanvasUp = new TGCompositeFrame(this);
176 fGCanvasUp->SetLayoutManager(new TGMatrixLayout(fGCanvasUp,1,2,1,1));
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);
187 fGCanvasDown = new TGCompositeFrame(this);
188 fGCanvasDown->SetLayoutManager(new TGMatrixLayout(fGCanvasDown, 1,3,1,1));
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);
197 for(Int_t i=0; i<5; i++) {
201 AddFrame(fGCanvasUp);
202 AddFrame(fGCanvasDown);
206 //////////////////////////////////////////////////////////////////////////////////
208 void AliTRDqaGuiBlackChamber::SetQAFile(const char *filename) {
210 // sets a file with histograms
213 //const char *names[5] = {"ped", "noise", "pedDist", "noiseDist", "signal"};
214 const char *names[10] = {
215 "ped", "noise", "pedDist", "noiseDist", "signal",
216 "entries", "entriesRM", "entriesDist", "", ""
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};
221 strcpy(fFileName, filename);
223 for(int i=0; i<5; i++) {
224 if (fHistList[i]) delete fHistList[i];
227 TFile *file = new TFile(filename);
229 // printf("%d %lf %lf\n", fSetRangePed, fRangePed[0], fRangePed[1]);
230 //printf("%d %lf %lf\n", fSetRangeNoise, fRangeNoise[0], fRangeNoise[1]);
232 for(Int_t i=0; i<5; i++) {
234 Int_t index = fIdxSM * 30 + fIdxChamber;
235 const char *nn = Form("%s_%d", names[i+5*fView], index);
236 //printf("%s\n", nn);
237 fHistList[i] = (TH1*)file->Get(nn); //Form("%s_$d", names[fIdxType], index));
238 if (!fHistList[i]) continue;
240 if ( (fView == 1) && (i == 0)) {
241 fHistList[i]->SetMinimum(0);
242 fHistList[i]->SetMaximum(2);
245 if ( (fView == 0) && (i == 0) && fSetRangePed) {
246 fHistList[i]->SetMinimum(fRangePed[0]);
247 fHistList[i]->SetMaximum(fRangePed[1]);
250 if ( (fView == 0) && (i == 1) && fSetRangeNoise) {
251 fHistList[i]->SetMinimum(fRangeNoise[0]);
252 fHistList[i]->SetMaximum(fRangeNoise[1]);
255 fCanvasList[i]->GetCanvas()->cd();
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();
263 for(Int_t i=1; i<8; i++) {
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);
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);
278 for(Int_t i=1; i<4; i++) {
280 fCanvasList[0]->GetCanvas()->cd();
281 line = new TLine(i*4-0.5, 0, i*4-0.5, 143);
282 line->SetLineStyle(2);
285 fCanvasList[1]->GetCanvas()->cd();
286 line = new TLine(i*4-0.5, 0, i*4-0.5, 143);
287 line->SetLineStyle(2);
295 for(Int_t i=0; i<5; i++)
296 fCanvasList[i]->GetCanvas()->Update();
299 //////////////////////////////////////////////////////////////////////////////////
301 void AliTRDqaGuiBlackChamber::SetChamber(Int_t idxChamber) {
303 // sets active chamber
306 fIdxChamber = idxChamber;
307 fGSelectSM->Select(fIdxSM, 0);
308 fGSelectChamber->Select(fIdxChamber, 0);
309 SetQAFile(fFileName);
312 //////////////////////////////////////////////////////////////////////////////////
314 void AliTRDqaGuiBlackChamber::SetSM(Int_t idxSM) {
316 // sets active supermodule
320 fGSelectSM->Select(fIdxSM, 0);
321 fGSelectChamber->Select(fIdxChamber, 0);
322 SetQAFile(fFileName);
325 //////////////////////////////////////////////////////////////////////////////////
327 void AliTRDqaGuiBlackChamber::SetView(Int_t idxView) {
333 fGSelectView->Select(idxView);
334 SetQAFile(fFileName);
336 //////////////////////////////////////////////////////////////////////////////////