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: AliTRDqaGuiBlackSM.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 "AliTRDqaGuiBlackSM.h"
41 #include "TGComboBox.h"
43 #include "TRootEmbeddedCanvas.h"
45 ClassImp(AliTRDqaGuiBlackSM)
47 //////////////////////////////////////////////////////////////////////////////////
49 AliTRDqaGuiBlackSM::AliTRDqaGuiBlackSM()
62 // Default constructor
65 for (Int_t i = 0; i < 5; i++) {
68 for (Int_t i = 0; i < 2; i++) {
72 for (Int_t i = 0; i < 30; i++) {
77 strncpy(fFileName,"",256);
81 //////////////////////////////////////////////////////////////////////////////////
83 AliTRDqaGuiBlackSM::AliTRDqaGuiBlackSM(TGWindow *parent)
84 : TGCompositeFrame(parent, 720, 500),
105 SetLayoutManager(new TGVerticalLayout(this));
107 fGPanel = new TGHorizontalFrame(this);
109 // fGLabel = new TGLabel(fGPanel, "Current SM: ");
110 fGPrev = new TGTextButton(fGPanel, "Prev SM");
111 fGNext = new TGTextButton(fGPanel, "Next SM");
113 fGSelect = new TGComboBox(fGPanel);
114 for(int i=0; i<18; i++) fGSelect->AddEntry(Form("SM %d", i), i);
115 fGSelect->Resize(100, (Int_t)(fGPrev->GetHeight()*1.4));
116 fGSelect->Select(fIdx,0);
118 const char *textTypes[11] = {
119 "pedestals", "noise", "peak-peak", "pedestalDist", "noiseDist", "signal",
120 "entries", "entriesDist", "entriesRM", "errorLocMCM", "errorLocADC"
123 fGSelectType = new TGComboBox(fGPanel);
124 for(int i=0; i<11; i++) fGSelectType->AddEntry(textTypes[i], i);
125 fGSelectType->Resize(100, (Int_t)(fGPrev->GetHeight()*1.4));
126 fGSelectType->Select(fIdxType, 0);
128 //fGPlay = new TGTextButton(fGPanel, "PLAY");
130 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
132 // fGPanel->AddFrame(fGLabel, hint);
133 fGPanel->AddFrame(fGPrev, hint);
134 fGPanel->AddFrame(fGSelect, hint);
135 fGPanel->AddFrame(fGNext, hint);
136 //fGPanel->AddFrame(fGPlay, hint);
137 fGPanel->AddFrame(fGSelectType, hint);
142 fGPrev->Connect("Clicked()", "AliTRDqaGuiBlackSM", this, "PreviusSM()");
143 fGNext->Connect("Clicked()", "AliTRDqaGuiBlackSM", this, "NextSM()");
144 fGSelect->Connect("Selected(Int_t)", "AliTRDqaGuiBlackSM", this, "SelectSM(Int_t)");
145 fGSelectType->Connect("Selected(Int_t)", "AliTRDqaGuiBlackSM", this, "SelectType(Int_t)");
146 //fGPlay->Connect("Clicked()", "AliTRDqaGuiBlackSM", this, "Play()");
150 fGCanvas = new TGCompositeFrame(this);
151 fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,6,5,0,0));
153 for(Int_t i=0; i<30; i++) {
154 fCanvasList[i] = new TRootEmbeddedCanvas(Form("pos_%d", i), fGCanvas, 200, 120);
155 fGCanvas->AddFrame(fCanvasList[i]);
156 fCanvasList[i]->GetCanvas()->SetRightMargin(0.05);
157 fCanvasList[i]->GetCanvas()->SetTopMargin(0.05);
160 for(Int_t i=0; i<30; i++) {
168 //////////////////////////////////////////////////////////////////////////////////
170 void AliTRDqaGuiBlackSM::SetQAFile(const char *filename) {
172 // Set the file with histograms
175 const char *names[11] = {"ped", "noise", "pp","pedDist", "noiseDist", "signal",
176 "entries", "entriesDist", "entriesRM", "errorLocMCM", "errorLocADC" };
177 const char *opt[11] = {"col", "col", "", "", "", "", "col", "", "col", "col", "col"};
178 const Int_t kLogy[11] = {0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0};
180 strncpy(fFileName,filename,256);
182 for(int i=0; i<30; i++) {
183 if (fHistList[i]) delete fHistList[i];
186 TFile *file = new TFile(filename);
188 for(int i=0; i<30; i++) {
189 Int_t index = i + fIdx * 30;
190 const char *nn = Form("%s_%d", names[fIdxType], index);
191 //printf("%s\n", nn);
192 fHistList[i] = (TH1*)file->Get(nn); //Form("%s_$d", names[fIdxType], index));
196 Int_t pos = (5-l) * 5 + s;
198 fCanvasList[pos]->GetCanvas()->cd();
199 fCanvasList[pos]->GetCanvas()->SetLogy(kLogy[fIdxType]);
201 if (fHistList[i]) fHistList[i]->Draw(opt[fIdxType]);
203 if (fHistList[i] && (fIdxType == 6)) {
204 fHistList[i]->SetMinimum(0);
205 fHistList[i]->SetMaximum(2);
208 if ( fHistList[i] && (fIdxType == 0) && fSetRangePed) {
209 fHistList[i]->SetMinimum(fRangePed[0]);
210 fHistList[i]->SetMaximum(fRangePed[1]);
213 if ( fHistList[i] && (fIdxType == 1) && fSetRangeNoise) {
214 fHistList[i]->SetMinimum(fRangeNoise[0]);
215 fHistList[i]->SetMaximum(fRangeNoise[1]);
218 fCanvasList[pos]->GetCanvas()->Update();
222 //////////////////////////////////////////////////////////////////////////////////
224 void AliTRDqaGuiBlackSM::SetSM(Int_t idx) {
226 // Selects active super module
230 fGSelect->Select(fIdx, 0);
231 SetQAFile(fFileName);
234 //////////////////////////////////////////////////////////////////////////////////
236 void AliTRDqaGuiBlackSM::SelectType(Int_t idx) {
242 fGSelectType->Select(fIdxType, 0);
243 SetQAFile(fFileName);
246 //////////////////////////////////////////////////////////////////////////////////
248 void AliTRDqaGuiBlackSM::Play() {
251 for(Int_t i=0; i<18; i++) {
252 gSystem->Sleep(2 * 1e3);
257 //////////////////////////////////////////////////////////////////////////////////