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: AliTRDqaGuiBlackChamber.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 "AliTRDqaGuiBlackChamber.h" |
33 | |
34 | #include "TH1D.h" |
35 | #include "TH2D.h" |
36 | #include "TH3D.h" |
37 | #include "TFile.h" |
38 | #include "TCanvas.h" |
39 | #include "TString.h" |
40 | #include "TSystem.h" |
41 | |
42 | #include "TPaveText.h" |
43 | #include "TGLabel.h" |
44 | #include "TGComboBox.h" |
45 | #include "TGButton.h" |
46 | #include "TRootEmbeddedCanvas.h" |
47 | |
48 | ClassImp(AliTRDqaGuiBlackChamber) |
49 | |
50 | const Int_t AliTRDqaGuiBlackChamber::fgknSM = 18; |
51 | const Int_t AliTRDqaGuiBlackChamber::fgknChamber = 30; |
52 | //const Int_t AliTRDqaGuiBlackChamber::fgknCh = 6; |
53 | |
54 | ////////////////////////////////////////////////////////////////////////////////// |
55 | |
56 | AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber() |
9b99c029 |
57 | : fView(0), |
58 | fSetRangePed(0), |
36f55715 |
59 | fSetRangeNoise(0), |
60 | fIdxSM(0), |
61 | fIdxChamber(0), |
62 | fGPanel(0), |
63 | fGCanvas(0), |
64 | fGCanvasUp(0), |
65 | fGCanvasDown(0), |
66 | fGSelectSM(0), |
67 | fGSelectChamber(0), |
68 | fGPrevSM(0), |
69 | fGPrevChamber(0), |
70 | fGNextSM(0), |
71 | fGNextChamber(0) |
72 | { |
73 | } |
74 | |
75 | ////////////////////////////////////////////////////////////////////////////////// |
76 | |
9b99c029 |
77 | AliTRDqaGuiBlackChamber::AliTRDqaGuiBlackChamber(TGWindow *parent) |
36f55715 |
78 | : TGCompositeFrame(parent, 720, 500), |
9b99c029 |
79 | fView(0), |
36f55715 |
80 | fSetRangePed(0), |
81 | fSetRangeNoise(0), |
82 | fIdxSM(0), |
83 | fIdxChamber(0), |
84 | fGPanel(0), |
85 | fGCanvas(0), |
86 | fGCanvasUp(0), |
87 | fGCanvasDown(0), |
88 | fGSelectSM(0), |
89 | fGSelectChamber(0), |
90 | fGPrevSM(0), |
91 | fGPrevChamber(0), |
92 | fGNextSM(0), |
93 | fGNextChamber(0) |
94 | { |
95 | // |
96 | // main constructor |
97 | // |
98 | |
9b99c029 |
99 | // steering panel |
36f55715 |
100 | |
101 | SetLayoutManager(new TGVerticalLayout(this)); |
36f55715 |
102 | fGPanel = new TGHorizontalFrame(this); |
103 | |
104 | // fGLabel = new TGLabel(fGPanel, "Current Chamber: "); |
105 | fGPrevSM = new TGTextButton(fGPanel, "Prev SM"); |
106 | fGPrevChamber = new TGTextButton(fGPanel, "Prev Chamber"); |
107 | |
108 | fGNextSM = new TGTextButton(fGPanel, "Next SM"); |
109 | fGNextChamber = new TGTextButton(fGPanel, "Next Chamber"); |
110 | |
111 | fGSelectSM = new TGComboBox(fGPanel); |
112 | for(int i=0; i<fgknSM; i++) fGSelectSM->AddEntry(Form("SM %d", i), i); |
113 | fGSelectSM->Resize(100, fGPrevSM->GetHeight()); |
114 | fGSelectSM->Select(fIdxSM); |
115 | |
116 | fGSelectChamber = new TGComboBox(fGPanel); |
117 | for(int i=0; i<fgknChamber; i++) fGSelectChamber->AddEntry(Form("Chamber %d", i), i); |
118 | fGSelectChamber->Resize(100, fGPrevSM->GetHeight()); |
119 | fGSelectChamber->Select(fIdxChamber); |
120 | |
9b99c029 |
121 | // vew |
122 | fGSelectView = new TGComboBox(fGPanel); |
123 | fGSelectView->AddEntry("pedestals",0); |
124 | fGSelectView->AddEntry("entiries", 1); |
125 | fGSelectView->Resize(150, fGPrevSM->GetHeight()); |
126 | fGSelectView->Select(0); |
127 | |
128 | |
36f55715 |
129 | //fGPlay = new TGTextButton(fGPanel, "PLAY"); |
130 | |
131 | TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5); |
132 | |
133 | // fGPanel->AddFrame(fGLabel, hint); |
134 | fGPanel->AddFrame(fGPrevSM, hint); |
135 | fGPanel->AddFrame(fGPrevChamber, hint); |
136 | |
137 | fGPanel->AddFrame(fGSelectSM, hint); |
138 | fGPanel->AddFrame(fGSelectChamber, hint); |
139 | |
140 | fGPanel->AddFrame(fGNextChamber, hint); |
141 | fGPanel->AddFrame(fGNextSM, hint); |
142 | |
9b99c029 |
143 | fGPanel->AddFrame(fGSelectView, hint); |
36f55715 |
144 | //fGPanel->AddFrame(fGPlay, hint); |
145 | |
146 | AddFrame(fGPanel); |
147 | |
148 | // panel logic |
149 | fGPrevChamber->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "PreviusChamber()"); |
150 | fGNextChamber->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "NextChamber()"); |
151 | fGPrevSM->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "PreviusSM()"); |
152 | fGNextSM->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "NextSM()"); |
153 | |
154 | fGSelectSM->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectSM(Int_t)"); |
155 | fGSelectChamber->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectChamber(Int_t)"); |
156 | |
9b99c029 |
157 | fGSelectView->Connect("Selected(Int_t)", "AliTRDqaGuiBlackChamber", this, "SelectView(Int_t)"); |
158 | |
36f55715 |
159 | //fGPlay->Connect("Clicked()", "AliTRDqaGuiBlackChamber", this, "Play()"); |
160 | |
161 | // histograms |
162 | |
163 | // fGCanvas = new TGCompositeFrame(this); |
164 | // fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,2,2,0,0)); |
165 | |
166 | //for(Int_t i=0; i<4; i++) { |
167 | // fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvas, 480, 300); |
168 | // fGCanvas->AddFrame(fCanvasList[i]); |
169 | // } |
170 | |
171 | |
172 | fGCanvasUp = new TGCompositeFrame(this); |
173 | fGCanvasUp->SetLayoutManager(new TGMatrixLayout(fGCanvasUp,1,2,1,1)); |
174 | |
175 | for(Int_t i=0; i<2; i++) { |
176 | fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvasUp, 480, 400); |
177 | fGCanvasUp->AddFrame(fCanvasList[i]); |
178 | fCanvasList[i]->GetCanvas()->SetTopMargin(0.05); |
179 | fCanvasList[i]->GetCanvas()->SetRightMargin(0.15); |
180 | fCanvasList[i]->GetCanvas()->SetBottomMargin(0.05); |
181 | } |
182 | |
183 | |
184 | fGCanvasDown = new TGCompositeFrame(this); |
185 | fGCanvasDown->SetLayoutManager(new TGMatrixLayout(fGCanvasDown, 1,3,1,1)); |
186 | |
187 | for(Int_t i=2; i<5; i++) { |
188 | fCanvasList[i] = new TRootEmbeddedCanvas(Form("L%d",i), fGCanvasDown, 320, 300); |
189 | fGCanvasDown->AddFrame(fCanvasList[i]); |
190 | fCanvasList[i]->GetCanvas()->SetTopMargin(0.05); |
191 | fCanvasList[i]->GetCanvas()->SetRightMargin(0.05); |
192 | } |
193 | |
194 | for(Int_t i=0; i<5; i++) { |
195 | fHistList[i] = 0; |
196 | } |
197 | |
198 | AddFrame(fGCanvasUp); |
199 | AddFrame(fGCanvasDown); |
200 | |
201 | } |
202 | |
203 | ////////////////////////////////////////////////////////////////////////////////// |
204 | |
205 | void AliTRDqaGuiBlackChamber::SetQAFile(const char *filename) { |
206 | // |
207 | // sets a file with histograms |
208 | // |
209 | |
210 | |
9b99c029 |
211 | //const char *names[5] = {"ped", "noise", "pedDist", "noiseDist", "signal"}; |
212 | const char *names[10] = { |
213 | "ped", "noise", "pedDist", "noiseDist", "signal", |
214 | "entries", "", "entriesDist", "", "" |
215 | }; |
216 | const char *opt[10] = {"colz", "colz", "", "", "", "colz", "colz", "", "", ""}; |
217 | const Int_t kLogy[10] = {0, 0, 1, 1, 1, 0, 0, 1, 1,1}; |
36f55715 |
218 | |
219 | strcpy(fFileName, filename); |
220 | |
221 | for(int i=0; i<5; i++) { |
222 | if (fHistList[i]) delete fHistList[i]; |
223 | } |
224 | |
225 | TFile *file = new TFile(filename); |
226 | |
227 | // printf("%d %lf %lf\n", fSetRangePed, fRangePed[0], fRangePed[1]); |
228 | //printf("%d %lf %lf\n", fSetRangeNoise, fRangeNoise[0], fRangeNoise[1]); |
229 | |
230 | for(Int_t i=0; i<5; i++) { |
231 | |
232 | Int_t index = fIdxSM * 30 + fIdxChamber; |
9b99c029 |
233 | const char *nn = Form("%s_%d", names[i+5*fView], index); |
36f55715 |
234 | //printf("%s\n", nn); |
235 | fHistList[i] = (TH1*)file->Get(nn); //Form("%s_$d", names[fIdxType], index)); |
236 | if (!fHistList[i]) continue; |
9b99c029 |
237 | |
238 | if ( (fView == 1) && (i == 0)) { |
239 | fHistList[i]->SetMinimum(0); |
240 | fHistList[i]->SetMaximum(2); |
241 | } |
242 | |
243 | if ( (fView == 0) && (i == 0) && fSetRangePed) { |
36f55715 |
244 | fHistList[i]->SetMinimum(fRangePed[0]); |
245 | fHistList[i]->SetMaximum(fRangePed[1]); |
246 | } |
247 | |
9b99c029 |
248 | if ( (fView == 0) && (i == 1) && fSetRangeNoise) { |
36f55715 |
249 | fHistList[i]->SetMinimum(fRangeNoise[0]); |
250 | fHistList[i]->SetMaximum(fRangeNoise[1]); |
251 | } |
252 | |
253 | |
254 | fCanvasList[i]->GetCanvas()->cd(); |
9b99c029 |
255 | fCanvasList[i]->GetCanvas()->SetLogy(kLogy[i+5*fView]); |
256 | if (fHistList[i]) fHistList[i]->Draw(opt[i+5*fView]); |
257 | //fCanvasList[i]->GetCanvas()->Update(); |
36f55715 |
258 | } |
9b99c029 |
259 | |
260 | for(Int_t i=0; i<5; i++) |
261 | fCanvasList[i]->GetCanvas()->Update(); |
36f55715 |
262 | } |
263 | |
264 | ////////////////////////////////////////////////////////////////////////////////// |
265 | |
266 | void AliTRDqaGuiBlackChamber::SetChamber(Int_t idxChamber) { |
267 | // |
268 | // sets active chamber |
269 | // |
270 | |
271 | fIdxChamber = idxChamber; |
272 | fGSelectSM->Select(fIdxSM, 0); |
273 | fGSelectChamber->Select(fIdxChamber, 0); |
274 | SetQAFile(fFileName); |
275 | } |
276 | |
277 | ////////////////////////////////////////////////////////////////////////////////// |
278 | |
279 | void AliTRDqaGuiBlackChamber::SetSM(Int_t idxSM) { |
280 | // |
281 | // sets active supermodule |
282 | // |
283 | |
284 | fIdxSM = idxSM; |
285 | fGSelectSM->Select(fIdxSM, 0); |
286 | fGSelectChamber->Select(fIdxChamber, 0); |
287 | SetQAFile(fFileName); |
288 | } |
289 | |
290 | ////////////////////////////////////////////////////////////////////////////////// |
9b99c029 |
291 | |
292 | void AliTRDqaGuiBlackChamber::SetView(Int_t idxView) { |
293 | // |
294 | // sets active view |
295 | // |
296 | |
297 | fView = idxView; |
298 | fGSelectView->Select(idxView); |
299 | SetQAFile(fFileName); |
300 | } |
301 | ////////////////////////////////////////////////////////////////////////////////// |