]>
Commit | Line | Data |
---|---|---|
ee13fa25 | 1 | #ifndef __CINT__ |
2 | #include <AliCDBManager.h> | |
989ef56a | 3 | #include <AliCDBStorage.h> |
ee13fa25 | 4 | #include <AliFMDCalibDrawer.h> |
5 | #include <TSystem.h> | |
6 | #include <TGFrame.h> | |
7 | #include <TGButton.h> | |
8 | #include <TGLayout.h> | |
9 | #include <TGButtonGroup.h> | |
10 | #include <TGNumberEntry.h> | |
11 | #include <TGTextEntry.h> | |
12 | #include <TCanvas.h> | |
13 | #include <TError.h> | |
14 | #include <TGLabel.h> | |
15 | #else | |
16 | class TGMainFrame; | |
17 | class TGNumberEntry; | |
18 | class TGTextEntry; | |
19 | class TGHButtonGroup; | |
ca20eb4a | 20 | class TGVButtonGroup; |
ee13fa25 | 21 | class TGCheckButton; |
22 | class TGTextButton; | |
23 | class TGLayoutHints; | |
24 | class TCanvas; | |
25 | class TGLabel; | |
26 | class TGHorizontalFrame; | |
27 | class AliFMDCalibDrawer; | |
28 | class TGGroupFrame; | |
ca20eb4a | 29 | |
ee13fa25 | 30 | #endif |
31 | ||
32 | ||
33 | class Menu | |
34 | { | |
35 | public: | |
36 | TGMainFrame fMain; | |
37 | TGGroupFrame fSetup; | |
38 | TGLabel fLRun; | |
39 | TGNumberEntry fRun; | |
40 | TGLabel fLOCDB; | |
41 | TGTextEntry fOCDB; | |
42 | TGTextButton fInit; | |
ca20eb4a | 43 | TGHorizontalFrame fBottom; |
44 | TGGroupFrame fWhere; | |
ee13fa25 | 45 | TGHorizontalFrame fFDet; |
46 | TGLabel fLDet; | |
47 | TGNumberEntry fDet; | |
48 | TGHorizontalFrame fFRing; | |
49 | TGLabel fLRing; | |
50 | TGTextEntry fRing; | |
51 | TGHorizontalFrame fFSec; | |
52 | TGLabel fLSec; | |
53 | TGNumberEntry fSec; | |
54 | TGHorizontalFrame fFStr; | |
55 | TGLabel fLStr; | |
56 | TGNumberEntry fStr; | |
ca20eb4a | 57 | TGVButtonGroup fSelection; |
ee13fa25 | 58 | TGCheckButton fPedestal; |
59 | TGCheckButton fNoise; | |
60 | TGCheckButton fGain; | |
61 | TGCheckButton fDead; | |
62 | TGCheckButton fRate; | |
63 | TGCheckButton fRange; | |
64 | TGCheckButton fThreshold; | |
65 | TGTextButton fDraw; | |
66 | TGLayoutHints fLayout; | |
67 | ||
68 | AliFMDCalibDrawer fCD; | |
69 | TCanvas* fCPedestal; | |
70 | TCanvas* fCNoise; | |
71 | TCanvas* fCGain; | |
72 | TCanvas* fCDead; | |
73 | TCanvas* fCRate; | |
74 | TCanvas* fCRange; | |
75 | TCanvas* fCThreshold; | |
76 | ||
ca20eb4a | 77 | Menu(const Menu&) |
78 | : fMain(gClient->GetRoot()), | |
79 | fSetup(&fMain, "Setup", kHorizontalFrame), | |
80 | fLRun(&fSetup, "Run: "), | |
81 | fRun(&fSetup, 0, 8, -1, TGNumberFormat::kNESInteger, | |
82 | TGNumberFormat::kNEAAnyNumber), | |
83 | fLOCDB(&fSetup, "OCDB:"), | |
84 | fOCDB(&fSetup, "run"), | |
85 | fInit(&fSetup, "Init"), | |
86 | fBottom(&fMain), | |
87 | fWhere(&fBottom, "From where", kVerticalFrame), | |
88 | fFDet(&fWhere), | |
89 | fLDet(&fFDet, "Detector:"), | |
90 | fDet(&fFDet, -1, 1, -1, TGNumberFormat::kNESInteger, | |
91 | TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, | |
92 | -1, 3), | |
93 | fFRing(&fWhere), | |
94 | fLRing(&fFRing,"Ring:"), | |
95 | fRing(&fFRing, ""), | |
96 | fFSec(&fWhere), | |
97 | fLSec(&fFSec,"Sector:"), | |
98 | fSec(&fFSec, -1, 1, -1, TGNumberFormat::kNESInteger, | |
99 | TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, | |
100 | -1, 39), | |
101 | fFStr(&fWhere), | |
102 | fLStr(&fFStr,"Strip:"), | |
103 | fStr(&fFStr, -1, 1, -1, TGNumberFormat::kNESInteger, | |
104 | TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, | |
105 | -1, 511), | |
106 | fSelection(&fBottom, "what"), | |
107 | fPedestal(&fSelection, "Pedestal"), | |
108 | fNoise(&fSelection, "Noise"), | |
109 | fGain(&fSelection, "Gain"), | |
110 | fDead(&fSelection, "Dead"), | |
111 | fRate(&fSelection, "Rate"), | |
112 | fRange(&fSelection, "Range"), | |
113 | fThreshold(&fSelection, "Threshold"), | |
114 | fDraw(&fMain, "Draw"), | |
115 | fLayout(kLHintsExpandX, 2, 2, 2, 2), | |
116 | fCPedestal(0), | |
117 | fCNoise(0), | |
118 | fCGain(0), | |
119 | fCDead(0), | |
120 | fCRate(0), | |
121 | fCRange(0), | |
122 | fCThreshold(0) | |
123 | {} | |
124 | Menu& operator=(const Menu&) { return *this; } | |
125 | ||
126 | ||
127 | Menu(Int_t runNo=0) | |
ee13fa25 | 128 | : fMain(gClient->GetRoot()), |
129 | fSetup(&fMain, "Setup", kHorizontalFrame), | |
130 | fLRun(&fSetup, "Run: "), | |
131 | fRun(&fSetup, runNo, 8, -1, TGNumberFormat::kNESInteger, | |
132 | TGNumberFormat::kNEAAnyNumber), | |
133 | fLOCDB(&fSetup, "OCDB:"), | |
ca20eb4a | 134 | fOCDB(&fSetup, "run"), |
ee13fa25 | 135 | fInit(&fSetup, "Init"), |
ca20eb4a | 136 | fBottom(&fMain), |
137 | fWhere(&fBottom, "From where", kVerticalFrame), | |
138 | fFDet(&fWhere), | |
ee13fa25 | 139 | fLDet(&fFDet, "Detector:"), |
140 | fDet(&fFDet, -1, 1, -1, TGNumberFormat::kNESInteger, | |
141 | TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, | |
142 | -1, 3), | |
ca20eb4a | 143 | fFRing(&fWhere), |
ee13fa25 | 144 | fLRing(&fFRing,"Ring:"), |
145 | fRing(&fFRing, ""), | |
ca20eb4a | 146 | fFSec(&fWhere), |
ee13fa25 | 147 | fLSec(&fFSec,"Sector:"), |
148 | fSec(&fFSec, -1, 1, -1, TGNumberFormat::kNESInteger, | |
149 | TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, | |
150 | -1, 39), | |
ca20eb4a | 151 | fFStr(&fWhere), |
ee13fa25 | 152 | fLStr(&fFStr,"Strip:"), |
153 | fStr(&fFStr, -1, 1, -1, TGNumberFormat::kNESInteger, | |
154 | TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, | |
155 | -1, 511), | |
ca20eb4a | 156 | fSelection(&fBottom, "what"), |
ee13fa25 | 157 | fPedestal(&fSelection, "Pedestal"), |
158 | fNoise(&fSelection, "Noise"), | |
159 | fGain(&fSelection, "Gain"), | |
160 | fDead(&fSelection, "Dead"), | |
161 | fRate(&fSelection, "Rate"), | |
162 | fRange(&fSelection, "Range"), | |
163 | fThreshold(&fSelection, "Threshold"), | |
164 | fDraw(&fMain, "Draw"), | |
989ef56a | 165 | fLayout(kLHintsExpandX, 2, 2, 2, 2), |
166 | fCPedestal(0), | |
167 | fCNoise(0), | |
168 | fCGain(0), | |
169 | fCDead(0), | |
170 | fCRate(0), | |
171 | fCRange(0), | |
172 | fCThreshold(0) | |
ee13fa25 | 173 | { |
174 | fSetup.AddFrame(&fLRun, &fLayout); | |
175 | fSetup.AddFrame(&fRun, &fLayout); | |
176 | fSetup.AddFrame(&fLOCDB, &fLayout); | |
177 | fSetup.AddFrame(&fOCDB, &fLayout); | |
178 | fSetup.AddFrame(&fInit, &fLayout); | |
179 | ||
180 | fFDet.AddFrame(&fLDet, &fLayout); | |
181 | fFDet.AddFrame(&fDet, &fLayout); | |
182 | fFRing.AddFrame(&fLRing,&fLayout); | |
183 | fFRing.AddFrame(&fRing, &fLayout); | |
184 | fFSec.AddFrame(&fLSec, &fLayout); | |
185 | fFSec.AddFrame(&fSec, &fLayout); | |
186 | fFStr.AddFrame(&fLStr, &fLayout); | |
187 | fFStr.AddFrame(&fStr, &fLayout); | |
188 | ||
ca20eb4a | 189 | fWhere.AddFrame(&fFDet, &fLayout); |
190 | fWhere.AddFrame(&fFRing, &fLayout); | |
191 | fWhere.AddFrame(&fFSec, &fLayout); | |
192 | fWhere.AddFrame(&fFStr, &fLayout); | |
193 | ||
194 | fBottom.AddFrame(&fWhere, &fLayout); | |
195 | fBottom.AddFrame(&fSelection, &fLayout); | |
196 | ||
ee13fa25 | 197 | fMain.AddFrame(&fSetup, &fLayout); |
ca20eb4a | 198 | fMain.AddFrame(&fBottom, &fLayout); |
ee13fa25 | 199 | fMain.AddFrame(&fDraw, &fLayout); |
200 | ||
201 | fRing.SetAlignment(kTextRight); | |
202 | fRing.SetInsertMode(TGTextEntry::kReplace); | |
203 | fRing.SetMaxLength(1); | |
204 | ||
205 | fMain.MapSubwindows(); | |
206 | fMain.Resize(fMain.GetDefaultSize()); | |
207 | fMain.MapWindow(); | |
208 | ||
209 | fDraw.Connect("Clicked()", "Menu", this, "Handle()"); | |
210 | fInit.Connect("Clicked()", "Menu", this, "Init()"); | |
211 | ||
989ef56a | 212 | AliCDBManager* cdb = AliCDBManager::Instance(); |
213 | if (cdb->GetDefaultStorage()) | |
214 | fOCDB.SetText(cdb->GetDefaultStorage()->GetURI().Data()); | |
ee13fa25 | 215 | fCD.Init(runNo); |
216 | } | |
217 | TCanvas* MakeCanvas(const char* name, const char* title) | |
218 | { | |
219 | TCanvas* ret = new TCanvas(name, title, 1200, 900); | |
220 | ret->SetFillColor(0); | |
221 | ret->SetFillStyle(0); | |
222 | ret->SetBorderMode(0); | |
223 | ret->SetBorderSize(0); | |
224 | return ret; | |
225 | } | |
226 | void ClearCanvas(TCanvas* c) | |
227 | { | |
228 | c->Clear(); | |
229 | c->SetTopMargin(0.02); | |
230 | c->SetRightMargin(0.02); | |
231 | c->SetBottomMargin(0.10); | |
232 | c->SetLeftMargin(0.10); | |
233 | c->cd(); | |
234 | } | |
235 | void Init() | |
236 | { | |
237 | const Char_t* ocdb = fOCDB.GetText(); | |
238 | Int_t run = fRun.GetIntNumber(); | |
239 | Info("Init", "Initialising for run %d, OCDB @ %s", run, ocdb); | |
240 | fCD.Init(run, ocdb); | |
241 | } | |
242 | void Handle() | |
243 | { | |
989ef56a | 244 | // static Short_t oD; |
245 | // static Char_t oR; | |
246 | // static Short_t oS; | |
247 | // static Short_t oT; | |
ee13fa25 | 248 | Short_t d = fDet.GetIntNumber(); |
249 | Char_t r = fRing.GetText()[0]; | |
250 | Short_t s = fSec.GetIntNumber(); | |
251 | Short_t t = fStr.GetIntNumber(); | |
252 | Info("Handle", "D=%d, R=%c, S=%d, T=%d", d, (r == '\0' ? '-' : r), s, t); | |
253 | if (fPedestal.IsOn()) { | |
254 | Info("Handle", "Will draw pedestals"); | |
255 | if (!fCPedestal) fCPedestal = MakeCanvas("peds", "Pedestals"); | |
256 | ClearCanvas(fCPedestal); | |
257 | fCD.DrawPedestals(d, r, s, t); | |
258 | } | |
259 | if (fNoise.IsOn()) { | |
260 | Info("Handle", "Will draw noises"); | |
261 | if (!fCNoise) fCNoise = MakeCanvas("noises", "Noises"); | |
262 | ClearCanvas(fCNoise); | |
263 | fCD.DrawNoise(d, r, s, t); | |
264 | } | |
265 | if (fGain.IsOn()) { | |
266 | Info("Handle", "Will draw gains"); | |
267 | if (!fCGain) fCGain = MakeCanvas("gains", "Gains"); | |
268 | ClearCanvas(fCGain); | |
269 | fCD.DrawGains(d, r, s, t); | |
270 | } | |
271 | if (fDead.IsOn()) { | |
272 | Info("Handle", "Will draw deads"); | |
273 | if (!fCDead) fCDead = MakeCanvas("deads", "Deads"); | |
274 | ClearCanvas(fCDead); | |
275 | fCD.DrawDead(d, r, s, t); | |
276 | } | |
277 | if (fRate.IsOn()) { | |
278 | Info("Handle", "Will draw rates"); | |
279 | if (!fCRate) fCRate = MakeCanvas("rates", "Rates"); | |
280 | fCRate->Clear(); | |
281 | fCRate->cd(); | |
282 | fCD.DrawRates(d, r, s, t); | |
283 | } | |
284 | if (fRange.IsOn()) { | |
285 | Info("Handle", "Will draw ranges"); | |
286 | if (!fCRange) fCRange = MakeCanvas("ranges", "Ranges"); | |
287 | fCRange->Clear(); | |
288 | fCRange->cd(); | |
289 | fCD.DrawRanges(d, r, s, t); | |
290 | } | |
291 | if (fThreshold.IsOn()) { | |
292 | Info("Handle", "Will draw thresholds"); | |
293 | if (!fCThreshold) fCThreshold = MakeCanvas("thresholds", "Thresholds"); | |
294 | fCThreshold->Clear(); | |
295 | fCThreshold->cd(); | |
296 | fCD.DrawThresholds(d, r, s, t); | |
297 | } | |
298 | } | |
299 | }; | |
300 | ||
301 | ||
302 | void | |
ca20eb4a | 303 | DrawCalib(Long_t runNo=145167, const char* store=0) |
ee13fa25 | 304 | { |
305 | #ifdef __CINT__ | |
306 | gSystem->Load("libFMDutil"); | |
307 | #endif | |
308 | ||
309 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
ca20eb4a | 310 | if (!store || store[0] == '\0') cdb->SetDefaultStorageFromRun(runNo); |
311 | else cdb->SetDefaultStorage(store); | |
312 | cdb->SetRun(runNo); | |
ee13fa25 | 313 | |
ca20eb4a | 314 | Menu* m = new Menu(runNo); |
ee13fa25 | 315 | // cd->DrawPedestals(d,r,s,t); |
316 | } | |
ca20eb4a | 317 | #ifdef __MAKECINT__ |
318 | #pragma link C++ class Menu; | |
319 | #endif | |
320 | ||
321 | #ifndef __CINT__ | |
322 | #include <TApplication.h> | |
323 | #include <cstdlib> | |
324 | /* | |
325 | To compile: | |
326 | ||
327 | g++ -c `root-config --cflags --glibs` -L$ALICE_ROOT/lib/tgt_${ALICE_TARGET} \ | |
328 | -I${ALICE_ROOT}/include -I../ -lGeom -lMinuit -lPhysics -lVMC -lXMLParser \ | |
329 | -lProofPlayer -lSTEERBase -lSTEER -lCDB -lESD -lRAWDatabase -lRAWDatarec \ | |
330 | -lANALYSIS -lFMDbase -lFMDrec -lFMDutil DrawCalib.C | |
331 | */ | |
332 | ||
333 | int main(int argc, char** argv) { | |
334 | int runNo = 145167; | |
335 | if (argc > 1) runNo = atoi(argv[1]); | |
336 | ||
337 | TApplication app("app", 0, 0); | |
338 | ||
339 | DrawCalib(runNo); | |
340 | ||
341 | app.Run(); | |
342 | ||
343 | return 0; | |
344 | } | |
345 | #endif | |
346 | ||
347 |