]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/qaGui/AliTRDqaGuiBlackSM.cxx
Updated QA version (Sylwester)
[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),
54 fFileName(0),
55 fGPanel(0),
56 fGCanvas(0),
57 fGSelect(0),
58 fGPrev(0),
59 fGNext(0),
60 fGSelectType(0)
61{
62}
63
64//////////////////////////////////////////////////////////////////////////////////
65
66AliTRDqaGuiBlackSM::AliTRDqaGuiBlackSM(TGWindow *parent)
67 : TGCompositeFrame(parent, 720, 500),
68 fIdx(0),
69 fIdxType(0),
70 fSetRangePed(0),
71 fSetRangeNoise(0),
72 fFileName(0),
73 fGPanel(0),
74 fGCanvas(0),
75 fGSelect(0),
76 fGPrev(0),
77 fGNext(0),
78 fGSelectType(0)
79{
80 //
81 // Main constructor
82 //
83
84 fIdx = 0;
85 fIdxType = 0;
86
87 // steering panel
88
89 SetLayoutManager(new TGVerticalLayout(this));
90
91 fGPanel = new TGHorizontalFrame(this);
92
93 // fGLabel = new TGLabel(fGPanel, "Current SM: ");
94 fGPrev = new TGTextButton(fGPanel, "Prev SM");
95 fGNext = new TGTextButton(fGPanel, "Next SM");
96
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);
101
9b99c029 102 const char *textTypes[7] = {
103 "pedestals", "noise", "pedestalDist", "noiseDist", "signal", "entries", "entriesDist"
36f55715 104 };
105
106 fGSelectType = new TGComboBox(fGPanel);
9b99c029 107 for(int i=0; i<7; i++) fGSelectType->AddEntry(textTypes[i], i);
36f55715 108 fGSelectType->Resize(100, fGPrev->GetHeight());
109 fGSelectType->Select(fIdxType, 0);
110
111 //fGPlay = new TGTextButton(fGPanel, "PLAY");
112
113 TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5);
114
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);
121
122 AddFrame(fGPanel);
123
124 // panel logic
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()");
130
131 // histograms
132 /**/
133 fGCanvas = new TGCompositeFrame(this);
134 fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,6,5,0,0));
135
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);
141 }
142
143 for(Int_t i=0; i<30; i++) {
144 fHistList[i] = 0;
145 }
146
147 AddFrame(fGCanvas);
148 /**/
149}
150
151//////////////////////////////////////////////////////////////////////////////////
152
153void AliTRDqaGuiBlackSM::SetQAFile(const char *filename) {
154 //
155 // Set the file with histograms
156 //
157
9b99c029 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};
36f55715 161
162 fFileName = filename;
163
164 for(int i=0; i<30; i++) {
165 if (fHistList[i]) delete fHistList[i];
166 }
167
168 TFile *file = new TFile(filename);
169
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));
175
176 Int_t s = i/6;
177 Int_t l = i%6;
178 Int_t pos = (5-l) * 5 + s;
179
180 fCanvasList[pos]->GetCanvas()->cd();
181 fCanvasList[pos]->GetCanvas()->SetLogy(kLogy[fIdxType]);
182
183 if (fHistList[i]) fHistList[i]->Draw(opt[fIdxType]);
184
9b99c029 185 if (fHistList[i] && (fIdxType == 5)) {
186 fHistList[i]->SetMinimum(0);
187 fHistList[i]->SetMaximum(2);
188 }
189
36f55715 190 if ( fHistList[i] && (fIdxType == 0) && fSetRangePed) {
191 fHistList[i]->SetMinimum(fRangePed[0]);
192 fHistList[i]->SetMaximum(fRangePed[1]);
193 }
194
195 if ( fHistList[i] && (fIdxType == 1) && fSetRangeNoise) {
196 fHistList[i]->SetMinimum(fRangeNoise[0]);
197 fHistList[i]->SetMaximum(fRangeNoise[1]);
198 }
199
200 fCanvasList[pos]->GetCanvas()->Update();
201 }
202}
203
204//////////////////////////////////////////////////////////////////////////////////
205
206void AliTRDqaGuiBlackSM::SetSM(Int_t idx) {
207 //
208 // Selects active super module
209 //
210
211 fIdx = idx;
212 fGSelect->Select(fIdx, 0);
213 SetQAFile(fFileName.Data());
214}
215
216//////////////////////////////////////////////////////////////////////////////////
217
218void AliTRDqaGuiBlackSM::SelectType(Int_t idx) {
219 //
220 // Selects data type
221 //
222
223 fIdxType = idx;
224 fGSelectType->Select(fIdxType, 0);
225 SetQAFile(fFileName.Data());
226}
227
228//////////////////////////////////////////////////////////////////////////////////
229/*
230void AliTRDqaGuiBlackSM::Play() {
231
232 SetSM(0);
233 for(Int_t i=0; i<18; i++) {
234 gSystem->Sleep(2 * 1e3);
235 NextSM();
236 }
237}
238*/
239//////////////////////////////////////////////////////////////////////////////////
240