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()
74 //////////////////////////////////////////////////////////////////////////////////
76 AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber(TGWindow *parent)
77 : TGCompositeFrame(parent, 720, 500),
99 SetLayoutManager(new TGVerticalLayout(this));
101 fGPanel = new TGHorizontalFrame(this);
103 // fGLabel = new TGLabel(fGPanel, "Current Chamber: ");
104 fGPrevSM = new TGTextButton(fGPanel, "Prev SM");
105 fGPrevChamber = new TGTextButton(fGPanel, "Prev Chamber");
107 fGNextSM = new TGTextButton(fGPanel, "Next SM");
108 fGNextChamber = new TGTextButton(fGPanel, "Next Chamber");
110 fGSelectSM = new TGComboBox(fGPanel);
111 for(int i=0; i<fgknSM; i++) fGSelectSM->AddEntry(Form("SM %d", i), i);
112 fGSelectSM->Resize(100, fGPrevSM->GetHeight());
113 fGSelectSM->Select(fIdxSM);
115 fGSelectChamber = new TGComboBox(fGPanel);
116 for(int i=0; i<fgknChamber; i++) fGSelectChamber->AddEntry(Form("Chamber %d", i), i);
117 fGSelectChamber->Resize(100, fGPrevSM->GetHeight());
118 fGSelectChamber->Select(fIdxChamber);
120 //fGPlay = new TGTextButton(fGPanel, "PLAY");
122 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
124 // fGPanel->AddFrame(fGLabel, hint);
125 fGPanel->AddFrame(fGPrevSM, hint);
126 fGPanel->AddFrame(fGPrevChamber, hint);
128 fGPanel->AddFrame(fGSelectSM, hint);
129 fGPanel->AddFrame(fGSelectChamber, hint);
131 fGPanel->AddFrame(fGNextChamber, hint);
132 fGPanel->AddFrame(fGNextSM, hint);
134 //fGPanel->AddFrame(fGPlay, hint);
139 fGPrevChamber->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "PreviusChamber()");
140 fGNextChamber->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "NextChamber()");
141 fGPrevSM->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "PreviusSM()");
142 fGNextSM->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "NextSM()");
144 fGSelectSM->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectSM(Int_t)");
145 fGSelectChamber->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectChamber(Int_t)");
147 //fGPlay->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "Play()");
151 // fGCanvas = new TGCompositeFrame(this);
152 // fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,2,0,0));
154 //for(Int_t i=0; i<4; i++) {
155 // fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvas, 480, 300);
156 // fGCanvas->AddFrame(fCanvasList[i]);
160 fGCanvasUp = new TGCompositeFrame(this);
161 fGCanvasUp->SetLayoutManager(new TGMatrixLayout(fGCanvasUp,1,2,1,1));
163 for(Int_t i=0; i<2; i++) {
164 fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvasUp, 480, 400);
165 fGCanvasUp->AddFrame(fCanvasList[i]);
166 fCanvasList[i]->GetCanvas()->SetTopMargin(0.05);
167 fCanvasList[i]->GetCanvas()->SetRightMargin(0.15);
168 fCanvasList[i]->GetCanvas()->SetBottomMargin(0.05);
172 fGCanvasDown = new TGCompositeFrame(this);
173 fGCanvasDown->SetLayoutManager(new TGMatrixLayout(fGCanvasDown, 1,3,1,1));
175 for(Int_t i=2; i<5; i++) {
176 fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvasDown, 320, 300);
177 fGCanvasDown->AddFrame(fCanvasList[i]);
178 fCanvasList[i]->GetCanvas()->SetTopMargin(0.05);
179 fCanvasList[i]->GetCanvas()->SetRightMargin(0.05);
182 for(Int_t i=0; i<5; i++) {
186 AddFrame(fGCanvasUp);
187 AddFrame(fGCanvasDown);
191 //////////////////////////////////////////////////////////////////////////////////
193 void AliTRDqaGuiBlackChamber::SetQAFile(const char *filename) {
195 // sets a file with histograms
199 const char *names[5] = {"ped", "noise", "pedDist", "noiseDist", "signal"};
200 const char *opt[5] = {"colz", "colz", "", "", ""};
201 const Int_t kLogy[5] = {0, 0, 1, 1, 0};
203 strcpy(fFileName, filename);
205 for(int i=0; i<5; i++) {
206 if (fHistList[i]) delete fHistList[i];
209 TFile *file = new TFile(filename);
211 // printf("%d %lf %lf\n", fSetRangePed, fRangePed[0], fRangePed[1]);
212 //printf("%d %lf %lf\n", fSetRangeNoise, fRangeNoise[0], fRangeNoise[1]);
214 for(Int_t i=0; i<5; i++) {
216 Int_t index = fIdxSM * 30 + fIdxChamber;
217 const char *nn = Form("%s_%d", names[i], index);
218 //printf("%s\n", nn);
219 fHistList[i] = (TH1*)file->Get(nn); //Form("%s_$d", names[fIdxType], index));
220 if (!fHistList[i]) continue;
222 if ( (i == 0) && fSetRangePed) {
223 fHistList[i]->SetMinimum(fRangePed[0]);
224 fHistList[i]->SetMaximum(fRangePed[1]);
227 if ( (i == 1) && fSetRangeNoise) {
228 fHistList[i]->SetMinimum(fRangeNoise[0]);
229 fHistList[i]->SetMaximum(fRangeNoise[1]);
233 fCanvasList[i]->GetCanvas()->cd();
234 fCanvasList[i]->GetCanvas()->SetLogy(kLogy[i]);
235 if (fHistList[i]) fHistList[i]->Draw(opt[i]);
236 fCanvasList[i]->GetCanvas()->Update();
240 //////////////////////////////////////////////////////////////////////////////////
242 void AliTRDqaGuiBlackChamber::SetChamber(Int_t idxChamber) {
244 // sets active chamber
247 fIdxChamber = idxChamber;
248 fGSelectSM->Select(fIdxSM, 0);
249 fGSelectChamber->Select(fIdxChamber, 0);
250 SetQAFile(fFileName);
253 //////////////////////////////////////////////////////////////////////////////////
255 void AliTRDqaGuiBlackChamber::SetSM(Int_t idxSM) {
257 // sets active supermodule
261 fGSelectSM->Select(fIdxSM, 0);
262 fGSelectChamber->Select(fIdxChamber, 0);
263 SetQAFile(fFileName);
266 //////////////////////////////////////////////////////////////////////////////////