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"
42 #include "TPaveText.h"
44 #include "TGComboBox.h"
46 #include "TRootEmbeddedCanvas.h"
48 ClassImp(AliTRDqaGuiBlackChamber)
50 const Int_t AliTRDqaGuiBlackChamber::fgknSM = 18;
51 const Int_t AliTRDqaGuiBlackChamber::fgknChamber = 30;
52 //const Int_t AliTRDqaGuiBlackChamber::fgknCh = 6;
54 //////////////////////////////////////////////////////////////////////////////////
56 AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber()
75 //////////////////////////////////////////////////////////////////////////////////
77 AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber(TGWindow *parent)
78 : TGCompositeFrame(parent, 720, 500),
101 SetLayoutManager(new TGVerticalLayout(this));
102 fGPanel = new TGHorizontalFrame(this);
104 // fGLabel = new TGLabel(fGPanel, "Current Chamber: ");
105 fGPrevSM = new TGTextButton(fGPanel, "Prev SM");
106 fGPrevChamber = new TGTextButton(fGPanel, "Prev Chamber");
108 fGNextSM = new TGTextButton(fGPanel, "Next SM");
109 fGNextChamber = new TGTextButton(fGPanel, "Next Chamber");
111 fGSelectSM = new TGComboBox(fGPanel);
112 for(int i=0; i<fgknSM; i++) fGSelectSM->AddEntry(Form("SM %d", i), i);
113 fGSelectSM->Resize(100, fGPrevSM->GetHeight());
114 fGSelectSM->Select(fIdxSM);
116 fGSelectChamber = new TGComboBox(fGPanel);
117 for(int i=0; i<fgknChamber; i++) fGSelectChamber->AddEntry(Form("Chamber %d", i), i);
118 fGSelectChamber->Resize(100, fGPrevSM->GetHeight());
119 fGSelectChamber->Select(fIdxChamber);
122 fGSelectView = new TGComboBox(fGPanel);
123 fGSelectView->AddEntry("pedestals",0);
124 fGSelectView->AddEntry("entiries", 1);
125 fGSelectView->Resize(150, fGPrevSM->GetHeight());
126 fGSelectView->Select(0);
129 //fGPlay = new TGTextButton(fGPanel, "PLAY");
131 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
133 // fGPanel->AddFrame(fGLabel, hint);
134 fGPanel->AddFrame(fGPrevSM, hint);
135 fGPanel->AddFrame(fGPrevChamber, hint);
137 fGPanel->AddFrame(fGSelectSM, hint);
138 fGPanel->AddFrame(fGSelectChamber, hint);
140 fGPanel->AddFrame(fGNextChamber, hint);
141 fGPanel->AddFrame(fGNextSM, hint);
143 fGPanel->AddFrame(fGSelectView, hint);
144 //fGPanel->AddFrame(fGPlay, hint);
149 fGPrevChamber->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "PreviusChamber()");
150 fGNextChamber->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "NextChamber()");
151 fGPrevSM->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "PreviusSM()");
152 fGNextSM->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "NextSM()");
154 fGSelectSM->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectSM(Int_t)");
155 fGSelectChamber->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectChamber(Int_t)");
157 fGSelectView->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectView(Int_t)");
159 //fGPlay->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "Play()");
163 // fGCanvas = new TGCompositeFrame(this);
164 // fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,2,0,0));
166 //for(Int_t i=0; i<4; i++) {
167 // fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvas, 480, 300);
168 // fGCanvas->AddFrame(fCanvasList[i]);
172 fGCanvasUp = new TGCompositeFrame(this);
173 fGCanvasUp->SetLayoutManager(new TGMatrixLayout(fGCanvasUp,1,2,1,1));
175 for(Int_t i=0; i<2; i++) {
176 fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvasUp, 480, 400);
177 fGCanvasUp->AddFrame(fCanvasList[i]);
178 fCanvasList[i]->GetCanvas()->SetTopMargin(0.05);
179 fCanvasList[i]->GetCanvas()->SetRightMargin(0.15);
180 fCanvasList[i]->GetCanvas()->SetBottomMargin(0.05);
184 fGCanvasDown = new TGCompositeFrame(this);
185 fGCanvasDown->SetLayoutManager(new TGMatrixLayout(fGCanvasDown, 1,3,1,1));
187 for(Int_t i=2; i<5; i++) {
188 fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvasDown, 320, 300);
189 fGCanvasDown->AddFrame(fCanvasList[i]);
190 fCanvasList[i]->GetCanvas()->SetTopMargin(0.05);
191 fCanvasList[i]->GetCanvas()->SetRightMargin(0.05);
194 for(Int_t i=0; i<5; i++) {
198 AddFrame(fGCanvasUp);
199 AddFrame(fGCanvasDown);
203 //////////////////////////////////////////////////////////////////////////////////
205 void AliTRDqaGuiBlackChamber::SetQAFile(const char *filename) {
207 // sets a file with histograms
211 //const char *names[5] = {"ped", "noise", "pedDist", "noiseDist", "signal"};
212 const char *names[10] = {
213 "ped", "noise", "pedDist", "noiseDist", "signal",
214 "entries", "", "entriesDist", "", ""
216 const char *opt[10] = {"colz", "colz", "", "", "", "colz", "colz", "", "", ""};
217 const Int_t kLogy[10] = {0, 0, 1, 1, 1, 0, 0, 1, 1,1};
219 strcpy(fFileName, filename);
221 for(int i=0; i<5; i++) {
222 if (fHistList[i]) delete fHistList[i];
225 TFile *file = new TFile(filename);
227 // printf("%d %lf %lf\n", fSetRangePed, fRangePed[0], fRangePed[1]);
228 //printf("%d %lf %lf\n", fSetRangeNoise, fRangeNoise[0], fRangeNoise[1]);
230 for(Int_t i=0; i<5; i++) {
232 Int_t index = fIdxSM * 30 + fIdxChamber;
233 const char *nn = Form("%s_%d", names[i+5*fView], index);
234 //printf("%s\n", nn);
235 fHistList[i] = (TH1*)file->Get(nn); //Form("%s_$d", names[fIdxType], index));
236 if (!fHistList[i]) continue;
238 if ( (fView == 1) && (i == 0)) {
239 fHistList[i]->SetMinimum(0);
240 fHistList[i]->SetMaximum(2);
243 if ( (fView == 0) && (i == 0) && fSetRangePed) {
244 fHistList[i]->SetMinimum(fRangePed[0]);
245 fHistList[i]->SetMaximum(fRangePed[1]);
248 if ( (fView == 0) && (i == 1) && fSetRangeNoise) {
249 fHistList[i]->SetMinimum(fRangeNoise[0]);
250 fHistList[i]->SetMaximum(fRangeNoise[1]);
254 fCanvasList[i]->GetCanvas()->cd();
255 fCanvasList[i]->GetCanvas()->SetLogy(kLogy[i+5*fView]);
256 if (fHistList[i]) fHistList[i]->Draw(opt[i+5*fView]);
257 //fCanvasList[i]->GetCanvas()->Update();
260 for(Int_t i=0; i<5; i++)
261 fCanvasList[i]->GetCanvas()->Update();
264 //////////////////////////////////////////////////////////////////////////////////
266 void AliTRDqaGuiBlackChamber::SetChamber(Int_t idxChamber) {
268 // sets active chamber
271 fIdxChamber = idxChamber;
272 fGSelectSM->Select(fIdxSM, 0);
273 fGSelectChamber->Select(fIdxChamber, 0);
274 SetQAFile(fFileName);
277 //////////////////////////////////////////////////////////////////////////////////
279 void AliTRDqaGuiBlackChamber::SetSM(Int_t idxSM) {
281 // sets active supermodule
285 fGSelectSM->Select(fIdxSM, 0);
286 fGSelectChamber->Select(fIdxChamber, 0);
287 SetQAFile(fFileName);
290 //////////////////////////////////////////////////////////////////////////////////
292 void AliTRDqaGuiBlackChamber::SetView(Int_t idxView) {
298 fGSelectView->Select(idxView);
299 SetQAFile(fFileName);
301 //////////////////////////////////////////////////////////////////////////////////