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()
64 //////////////////////////////////////////////////////////////////////////////////
66 AliTRDqaGuiBlackSM::AliTRDqaGuiBlackSM(TGWindow *parent)
67 : TGCompositeFrame(parent, 720, 500),
89 SetLayoutManager(new TGVerticalLayout(this));
91 fGPanel = new TGHorizontalFrame(this);
93 // fGLabel = new TGLabel(fGPanel, "Current SM: ");
94 fGPrev = new TGTextButton(fGPanel, "Prev SM");
95 fGNext = new TGTextButton(fGPanel, "Next SM");
97 fGSelect = new TGComboBox(fGPanel);
98 for(int i=0; i<18; i++) fGSelect->AddEntry(Form("SM %d", i), i);
99 fGSelect->Resize(100, fGPrev->GetHeight());
100 fGSelect->Select(fIdx,0);
102 const char *textTypes[7] = {
103 "pedestals", "noise", "pedestalDist", "noiseDist", "signal", "entries", "entriesDist"
106 fGSelectType = new TGComboBox(fGPanel);
107 for(int i=0; i<7; i++) fGSelectType->AddEntry(textTypes[i], i);
108 fGSelectType->Resize(100, fGPrev->GetHeight());
109 fGSelectType->Select(fIdxType, 0);
111 //fGPlay = new TGTextButton(fGPanel, "PLAY");
113 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
115 // fGPanel->AddFrame(fGLabel, hint);
116 fGPanel->AddFrame(fGPrev, hint);
117 fGPanel->AddFrame(fGSelect, hint);
118 fGPanel->AddFrame(fGNext, hint);
119 //fGPanel->AddFrame(fGPlay, hint);
120 fGPanel->AddFrame(fGSelectType, hint);
125 fGPrev->Connect("Clicked()", "AliTRDqaGuiBlackSM", this, "PreviusSM()");
126 fGNext->Connect("Clicked()", "AliTRDqaGuiBlackSM", this, "NextSM()");
127 fGSelect->Connect("Selected(Int_t)", "AliTRDqaGuiBlackSM", this, "SelectSM(Int_t)");
128 fGSelectType->Connect("Selected(Int_t)", "AliTRDqaGuiBlackSM", this, "SelectType(Int_t)");
129 //fGPlay->Connect("Clicked()", "AliTRDqaGuiBlackSM", this, "Play()");
133 fGCanvas = new TGCompositeFrame(this);
134 fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,6,5,0,0));
136 for(Int_t i=0; i<30; i++) {
137 fCanvasList[i] = new TRootEmbeddedCanvas(Form("pos_%d", i), fGCanvas, 200, 120);
138 fGCanvas->AddFrame(fCanvasList[i]);
139 fCanvasList[i]->GetCanvas()->SetRightMargin(0.05);
140 fCanvasList[i]->GetCanvas()->SetTopMargin(0.05);
143 for(Int_t i=0; i<30; i++) {
151 //////////////////////////////////////////////////////////////////////////////////
153 void AliTRDqaGuiBlackSM::SetQAFile(const char *filename) {
155 // Set the file with histograms
158 const char *names[7] = {"ped", "noise", "pedDist", "noiseDist", "signal", "entries", "entriesDist"};
159 const char *opt[7] = {"col", "col", "", "", "", "colz", ""};
160 const Int_t kLogy[7] = {0, 0, 1, 1, 1, 0, 1};
162 fFileName = filename;
164 for(int i=0; i<30; i++) {
165 if (fHistList[i]) delete fHistList[i];
168 TFile *file = new TFile(filename);
170 for(int i=0; i<30; i++) {
171 Int_t index = i + fIdx * 30;
172 const char *nn = Form("%s_%d", names[fIdxType], index);
173 //printf("%s\n", nn);
174 fHistList[i] = (TH1*)file->Get(nn); //Form("%s_$d", names[fIdxType], index));
178 Int_t pos = (5-l) * 5 + s;
180 fCanvasList[pos]->GetCanvas()->cd();
181 fCanvasList[pos]->GetCanvas()->SetLogy(kLogy[fIdxType]);
183 if (fHistList[i]) fHistList[i]->Draw(opt[fIdxType]);
185 if (fHistList[i] && (fIdxType == 5)) {
186 fHistList[i]->SetMinimum(0);
187 fHistList[i]->SetMaximum(2);
190 if ( fHistList[i] && (fIdxType == 0) && fSetRangePed) {
191 fHistList[i]->SetMinimum(fRangePed[0]);
192 fHistList[i]->SetMaximum(fRangePed[1]);
195 if ( fHistList[i] && (fIdxType == 1) && fSetRangeNoise) {
196 fHistList[i]->SetMinimum(fRangeNoise[0]);
197 fHistList[i]->SetMaximum(fRangeNoise[1]);
200 fCanvasList[pos]->GetCanvas()->Update();
204 //////////////////////////////////////////////////////////////////////////////////
206 void AliTRDqaGuiBlackSM::SetSM(Int_t idx) {
208 // Selects active super module
212 fGSelect->Select(fIdx, 0);
213 SetQAFile(fFileName.Data());
216 //////////////////////////////////////////////////////////////////////////////////
218 void AliTRDqaGuiBlackSM::SelectType(Int_t idx) {
224 fGSelectType->Select(fIdxType, 0);
225 SetQAFile(fFileName.Data());
228 //////////////////////////////////////////////////////////////////////////////////
230 void AliTRDqaGuiBlackSM::Play() {
233 for(Int_t i=0; i<18; i++) {
234 gSystem->Sleep(2 * 1e3);
239 //////////////////////////////////////////////////////////////////////////////////