]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/qaGui/AliTRDqaGuiBlackSM.cxx
Coverity stuff once more ...
[u/mrichter/AliRoot.git] / TRD / qaGui / AliTRDqaGuiBlackSM.cxx
CommitLineData
36f55715 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id: AliTRDqaGuiBlackSM.cxx 23871 2008-02-12 11:48:20Z hristov $ */
17
18//////////////////////////////////////////////////////////////////////////////////
19//
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.
25//
26// S. Radomski
27// Uni-Heidelberg
28// Feb. 2008
29//
30//////////////////////////////////////////////////////////////////////////////////
31
32#include "AliTRDqaGuiBlackSM.h"
33
34#include "TH1D.h"
35#include "TFile.h"
36#include "TCanvas.h"
37#include "TString.h"
38#include "TSystem.h"
39
40#include "TGLabel.h"
41#include "TGComboBox.h"
42#include "TGButton.h"
43#include "TRootEmbeddedCanvas.h"
44
45ClassImp(AliTRDqaGuiBlackSM)
46
47//////////////////////////////////////////////////////////////////////////////////
48
49AliTRDqaGuiBlackSM::AliTRDqaGuiBlackSM()
50 : fIdx(0),
51 fIdxType(0),
52 fSetRangePed(0),
53 fSetRangeNoise(0),
36f55715 54 fGPanel(0),
55 fGCanvas(0),
56 fGSelect(0),
57 fGPrev(0),
58 fGNext(0),
59 fGSelectType(0)
60{
02f3bfcc 61 //
62 // Default constructor
63 //
64
65 for (Int_t i = 0; i < 5; i++) {
66 fNameList[i] = 0x0;
67 }
68 for (Int_t i = 0; i < 2; i++) {
69 fRangePed[i] = 0.0;
70 fRangeNoise[i] = 0.0;
71 }
72 for (Int_t i = 0; i < 30; i++) {
a987273c 73 fHistList[i] = 0x0;
74 fCanvasList[i] = 0x0;
02f3bfcc 75 }
76
77 strncpy(fFileName,"",256);
78
36f55715 79}
80
81//////////////////////////////////////////////////////////////////////////////////
82
83AliTRDqaGuiBlackSM::AliTRDqaGuiBlackSM(TGWindow *parent)
84 : TGCompositeFrame(parent, 720, 500),
85 fIdx(0),
86 fIdxType(0),
87 fSetRangePed(0),
88 fSetRangeNoise(0),
36f55715 89 fGPanel(0),
90 fGCanvas(0),
91 fGSelect(0),
92 fGPrev(0),
93 fGNext(0),
94 fGSelectType(0)
95{
96 //
97 // Main constructor
98 //
99
100 fIdx = 0;
101 fIdxType = 0;
102
103 // steering panel
104
105 SetLayoutManager(new TGVerticalLayout(this));
106
107 fGPanel = new TGHorizontalFrame(this);
108
109 // fGLabel = new TGLabel(fGPanel, "Current SM: ");
110 fGPrev = new TGTextButton(fGPanel, "Prev SM");
111 fGNext = new TGTextButton(fGPanel, "Next SM");
112
113 fGSelect = new TGComboBox(fGPanel);
114 for(int i=0; i<18; i++) fGSelect->AddEntry(Form("SM %d", i), i);
a73a87be 115 fGSelect->Resize(100, (Int_t)(fGPrev->GetHeight()*1.4));
36f55715 116 fGSelect->Select(fIdx,0);
117
a73a87be 118 const char *textTypes[11] = {
119 "pedestals", "noise", "peak-peak", "pedestalDist", "noiseDist", "signal",
120 "entries", "entriesDist", "entriesRM", "errorLocMCM", "errorLocADC"
36f55715 121 };
122
123 fGSelectType = new TGComboBox(fGPanel);
a73a87be 124 for(int i=0; i<11; i++) fGSelectType->AddEntry(textTypes[i], i);
125 fGSelectType->Resize(100, (Int_t)(fGPrev->GetHeight()*1.4));
36f55715 126 fGSelectType->Select(fIdxType, 0);
127
128 //fGPlay = new TGTextButton(fGPanel, "PLAY");
129
130 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
131
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);
138
139 AddFrame(fGPanel);
140
141 // panel logic
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()");
147
148 // histograms
149 /**/
150 fGCanvas = new TGCompositeFrame(this);
151 fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,6,5,0,0));
152
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);
158 }
159
160 for(Int_t i=0; i<30; i++) {
161 fHistList[i] = 0;
162 }
163
164 AddFrame(fGCanvas);
165 /**/
166}
167
168//////////////////////////////////////////////////////////////////////////////////
169
170void AliTRDqaGuiBlackSM::SetQAFile(const char *filename) {
171 //
172 // Set the file with histograms
173 //
174
a73a87be 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};
36f55715 179
02f3bfcc 180 strncpy(fFileName,filename,256);
36f55715 181
182 for(int i=0; i<30; i++) {
183 if (fHistList[i]) delete fHistList[i];
184 }
185
186 TFile *file = new TFile(filename);
187
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));
193
194 Int_t s = i/6;
195 Int_t l = i%6;
196 Int_t pos = (5-l) * 5 + s;
197
198 fCanvasList[pos]->GetCanvas()->cd();
199 fCanvasList[pos]->GetCanvas()->SetLogy(kLogy[fIdxType]);
200
201 if (fHistList[i]) fHistList[i]->Draw(opt[fIdxType]);
202
a73a87be 203 if (fHistList[i] && (fIdxType == 6)) {
9b99c029 204 fHistList[i]->SetMinimum(0);
205 fHistList[i]->SetMaximum(2);
206 }
207
36f55715 208 if ( fHistList[i] && (fIdxType == 0) && fSetRangePed) {
209 fHistList[i]->SetMinimum(fRangePed[0]);
210 fHistList[i]->SetMaximum(fRangePed[1]);
211 }
212
213 if ( fHistList[i] && (fIdxType == 1) && fSetRangeNoise) {
214 fHistList[i]->SetMinimum(fRangeNoise[0]);
215 fHistList[i]->SetMaximum(fRangeNoise[1]);
216 }
217
218 fCanvasList[pos]->GetCanvas()->Update();
219 }
220}
221
222//////////////////////////////////////////////////////////////////////////////////
223
224void AliTRDqaGuiBlackSM::SetSM(Int_t idx) {
225 //
226 // Selects active super module
227 //
228
229 fIdx = idx;
230 fGSelect->Select(fIdx, 0);
a73a87be 231 SetQAFile(fFileName);
36f55715 232}
233
234//////////////////////////////////////////////////////////////////////////////////
235
236void AliTRDqaGuiBlackSM::SelectType(Int_t idx) {
237 //
238 // Selects data type
239 //
240
241 fIdxType = idx;
242 fGSelectType->Select(fIdxType, 0);
a73a87be 243 SetQAFile(fFileName);
36f55715 244}
245
246//////////////////////////////////////////////////////////////////////////////////
247/*
248void AliTRDqaGuiBlackSM::Play() {
249
250 SetSM(0);
251 for(Int_t i=0; i<18; i++) {
252 gSystem->Sleep(2 * 1e3);
253 NextSM();
254 }
255}
256*/
257//////////////////////////////////////////////////////////////////////////////////
258