]>
Commit | Line | Data |
---|---|---|
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 | ||
45 | ClassImp(AliTRDqaGuiBlackSM) | |
46 | ||
47 | ////////////////////////////////////////////////////////////////////////////////// | |
48 | ||
49 | AliTRDqaGuiBlackSM::AliTRDqaGuiBlackSM() | |
50 | : fIdx(0), | |
51 | fIdxType(0), | |
52 | fSetRangePed(0), | |
53 | fSetRangeNoise(0), | |
a73a87be | 54 | //fFileName(0), |
36f55715 | 55 | fGPanel(0), |
56 | fGCanvas(0), | |
57 | fGSelect(0), | |
58 | fGPrev(0), | |
59 | fGNext(0), | |
60 | fGSelectType(0) | |
61 | { | |
62 | } | |
63 | ||
64 | ////////////////////////////////////////////////////////////////////////////////// | |
65 | ||
66 | AliTRDqaGuiBlackSM::AliTRDqaGuiBlackSM(TGWindow *parent) | |
67 | : TGCompositeFrame(parent, 720, 500), | |
68 | fIdx(0), | |
69 | fIdxType(0), | |
70 | fSetRangePed(0), | |
71 | fSetRangeNoise(0), | |
a73a87be | 72 | //fFileName(0), |
36f55715 | 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); | |
a73a87be | 99 | fGSelect->Resize(100, (Int_t)(fGPrev->GetHeight()*1.4)); |
36f55715 | 100 | fGSelect->Select(fIdx,0); |
101 | ||
a73a87be | 102 | const char *textTypes[11] = { |
103 | "pedestals", "noise", "peak-peak", "pedestalDist", "noiseDist", "signal", | |
104 | "entries", "entriesDist", "entriesRM", "errorLocMCM", "errorLocADC" | |
36f55715 | 105 | }; |
106 | ||
107 | fGSelectType = new TGComboBox(fGPanel); | |
a73a87be | 108 | for(int i=0; i<11; i++) fGSelectType->AddEntry(textTypes[i], i); |
109 | fGSelectType->Resize(100, (Int_t)(fGPrev->GetHeight()*1.4)); | |
36f55715 | 110 | fGSelectType->Select(fIdxType, 0); |
111 | ||
112 | //fGPlay = new TGTextButton(fGPanel, "PLAY"); | |
113 | ||
114 | TGLayoutHints *hint = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5); | |
115 | ||
116 | // fGPanel->AddFrame(fGLabel, hint); | |
117 | fGPanel->AddFrame(fGPrev, hint); | |
118 | fGPanel->AddFrame(fGSelect, hint); | |
119 | fGPanel->AddFrame(fGNext, hint); | |
120 | //fGPanel->AddFrame(fGPlay, hint); | |
121 | fGPanel->AddFrame(fGSelectType, hint); | |
122 | ||
123 | AddFrame(fGPanel); | |
124 | ||
125 | // panel logic | |
126 | fGPrev->Connect("Clicked()", "AliTRDqaGuiBlackSM", this, "PreviusSM()"); | |
127 | fGNext->Connect("Clicked()", "AliTRDqaGuiBlackSM", this, "NextSM()"); | |
128 | fGSelect->Connect("Selected(Int_t)", "AliTRDqaGuiBlackSM", this, "SelectSM(Int_t)"); | |
129 | fGSelectType->Connect("Selected(Int_t)", "AliTRDqaGuiBlackSM", this, "SelectType(Int_t)"); | |
130 | //fGPlay->Connect("Clicked()", "AliTRDqaGuiBlackSM", this, "Play()"); | |
131 | ||
132 | // histograms | |
133 | /**/ | |
134 | fGCanvas = new TGCompositeFrame(this); | |
135 | fGCanvas->SetLayoutManager(new TGMatrixLayout(fGCanvas,6,5,0,0)); | |
136 | ||
137 | for(Int_t i=0; i<30; i++) { | |
138 | fCanvasList[i] = new TRootEmbeddedCanvas(Form("pos_%d", i), fGCanvas, 200, 120); | |
139 | fGCanvas->AddFrame(fCanvasList[i]); | |
140 | fCanvasList[i]->GetCanvas()->SetRightMargin(0.05); | |
141 | fCanvasList[i]->GetCanvas()->SetTopMargin(0.05); | |
142 | } | |
143 | ||
144 | for(Int_t i=0; i<30; i++) { | |
145 | fHistList[i] = 0; | |
146 | } | |
147 | ||
148 | AddFrame(fGCanvas); | |
149 | /**/ | |
150 | } | |
151 | ||
152 | ////////////////////////////////////////////////////////////////////////////////// | |
153 | ||
154 | void AliTRDqaGuiBlackSM::SetQAFile(const char *filename) { | |
155 | // | |
156 | // Set the file with histograms | |
157 | // | |
158 | ||
a73a87be | 159 | const char *names[11] = {"ped", "noise", "pp","pedDist", "noiseDist", "signal", |
160 | "entries", "entriesDist", "entriesRM", "errorLocMCM", "errorLocADC" }; | |
161 | const char *opt[11] = {"col", "col", "", "", "", "", "col", "", "col", "col", "col"}; | |
162 | const Int_t kLogy[11] = {0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0}; | |
36f55715 | 163 | |
a73a87be | 164 | strcpy(fFileName,filename); |
36f55715 | 165 | |
166 | for(int i=0; i<30; i++) { | |
167 | if (fHistList[i]) delete fHistList[i]; | |
168 | } | |
169 | ||
170 | TFile *file = new TFile(filename); | |
171 | ||
172 | for(int i=0; i<30; i++) { | |
173 | Int_t index = i + fIdx * 30; | |
174 | const char *nn = Form("%s_%d", names[fIdxType], index); | |
175 | //printf("%s\n", nn); | |
176 | fHistList[i] = (TH1*)file->Get(nn); //Form("%s_$d", names[fIdxType], index)); | |
177 | ||
178 | Int_t s = i/6; | |
179 | Int_t l = i%6; | |
180 | Int_t pos = (5-l) * 5 + s; | |
181 | ||
182 | fCanvasList[pos]->GetCanvas()->cd(); | |
183 | fCanvasList[pos]->GetCanvas()->SetLogy(kLogy[fIdxType]); | |
184 | ||
185 | if (fHistList[i]) fHistList[i]->Draw(opt[fIdxType]); | |
186 | ||
a73a87be | 187 | if (fHistList[i] && (fIdxType == 6)) { |
9b99c029 | 188 | fHistList[i]->SetMinimum(0); |
189 | fHistList[i]->SetMaximum(2); | |
190 | } | |
191 | ||
36f55715 | 192 | if ( fHistList[i] && (fIdxType == 0) && fSetRangePed) { |
193 | fHistList[i]->SetMinimum(fRangePed[0]); | |
194 | fHistList[i]->SetMaximum(fRangePed[1]); | |
195 | } | |
196 | ||
197 | if ( fHistList[i] && (fIdxType == 1) && fSetRangeNoise) { | |
198 | fHistList[i]->SetMinimum(fRangeNoise[0]); | |
199 | fHistList[i]->SetMaximum(fRangeNoise[1]); | |
200 | } | |
201 | ||
202 | fCanvasList[pos]->GetCanvas()->Update(); | |
203 | } | |
204 | } | |
205 | ||
206 | ////////////////////////////////////////////////////////////////////////////////// | |
207 | ||
208 | void AliTRDqaGuiBlackSM::SetSM(Int_t idx) { | |
209 | // | |
210 | // Selects active super module | |
211 | // | |
212 | ||
213 | fIdx = idx; | |
214 | fGSelect->Select(fIdx, 0); | |
a73a87be | 215 | SetQAFile(fFileName); |
36f55715 | 216 | } |
217 | ||
218 | ////////////////////////////////////////////////////////////////////////////////// | |
219 | ||
220 | void AliTRDqaGuiBlackSM::SelectType(Int_t idx) { | |
221 | // | |
222 | // Selects data type | |
223 | // | |
224 | ||
225 | fIdxType = idx; | |
226 | fGSelectType->Select(fIdxType, 0); | |
a73a87be | 227 | SetQAFile(fFileName); |
36f55715 | 228 | } |
229 | ||
230 | ////////////////////////////////////////////////////////////////////////////////// | |
231 | /* | |
232 | void AliTRDqaGuiBlackSM::Play() { | |
233 | ||
234 | SetSM(0); | |
235 | for(Int_t i=0; i<18; i++) { | |
236 | gSystem->Sleep(2 * 1e3); | |
237 | NextSM(); | |
238 | } | |
239 | } | |
240 | */ | |
241 | ////////////////////////////////////////////////////////////////////////////////// | |
242 |