]>
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; | |
20 | class TGCheckButton; | |
21 | class TGTextButton; | |
22 | class TGLayoutHints; | |
23 | class TCanvas; | |
24 | class TGLabel; | |
25 | class TGHorizontalFrame; | |
26 | class AliFMDCalibDrawer; | |
27 | class TGGroupFrame; | |
28 | #endif | |
29 | ||
30 | ||
31 | class Menu | |
32 | { | |
33 | public: | |
34 | TGMainFrame fMain; | |
35 | TGGroupFrame fSetup; | |
36 | TGLabel fLRun; | |
37 | TGNumberEntry fRun; | |
38 | TGLabel fLOCDB; | |
39 | TGTextEntry fOCDB; | |
40 | TGTextButton fInit; | |
41 | TGHorizontalFrame fFDet; | |
42 | TGLabel fLDet; | |
43 | TGNumberEntry fDet; | |
44 | TGHorizontalFrame fFRing; | |
45 | TGLabel fLRing; | |
46 | TGTextEntry fRing; | |
47 | TGHorizontalFrame fFSec; | |
48 | TGLabel fLSec; | |
49 | TGNumberEntry fSec; | |
50 | TGHorizontalFrame fFStr; | |
51 | TGLabel fLStr; | |
52 | TGNumberEntry fStr; | |
53 | TGHButtonGroup fSelection; | |
54 | TGCheckButton fPedestal; | |
55 | TGCheckButton fNoise; | |
56 | TGCheckButton fGain; | |
57 | TGCheckButton fDead; | |
58 | TGCheckButton fRate; | |
59 | TGCheckButton fRange; | |
60 | TGCheckButton fThreshold; | |
61 | TGTextButton fDraw; | |
62 | TGLayoutHints fLayout; | |
63 | ||
64 | AliFMDCalibDrawer fCD; | |
65 | TCanvas* fCPedestal; | |
66 | TCanvas* fCNoise; | |
67 | TCanvas* fCGain; | |
68 | TCanvas* fCDead; | |
69 | TCanvas* fCRate; | |
70 | TCanvas* fCRange; | |
71 | TCanvas* fCThreshold; | |
72 | ||
73 | Menu(Int_t runNo) | |
74 | : fMain(gClient->GetRoot()), | |
75 | fSetup(&fMain, "Setup", kHorizontalFrame), | |
76 | fLRun(&fSetup, "Run: "), | |
77 | fRun(&fSetup, runNo, 8, -1, TGNumberFormat::kNESInteger, | |
78 | TGNumberFormat::kNEAAnyNumber), | |
79 | fLOCDB(&fSetup, "OCDB:"), | |
80 | fOCDB(&fSetup, ""), | |
81 | fInit(&fSetup, "Init"), | |
82 | fFDet(&fMain), | |
83 | fLDet(&fFDet, "Detector:"), | |
84 | fDet(&fFDet, -1, 1, -1, TGNumberFormat::kNESInteger, | |
85 | TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, | |
86 | -1, 3), | |
87 | fFRing(&fMain), | |
88 | fLRing(&fFRing,"Ring:"), | |
89 | fRing(&fFRing, ""), | |
90 | fFSec(&fMain), | |
91 | fLSec(&fFSec,"Sector:"), | |
92 | fSec(&fFSec, -1, 1, -1, TGNumberFormat::kNESInteger, | |
93 | TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, | |
94 | -1, 39), | |
95 | fFStr(&fMain), | |
96 | fLStr(&fFStr,"Strip:"), | |
97 | fStr(&fFStr, -1, 1, -1, TGNumberFormat::kNESInteger, | |
98 | TGNumberFormat::kNEAAnyNumber, TGNumberFormat::kNELLimitMinMax, | |
99 | -1, 511), | |
100 | fSelection(&fMain, "what"), | |
101 | fPedestal(&fSelection, "Pedestal"), | |
102 | fNoise(&fSelection, "Noise"), | |
103 | fGain(&fSelection, "Gain"), | |
104 | fDead(&fSelection, "Dead"), | |
105 | fRate(&fSelection, "Rate"), | |
106 | fRange(&fSelection, "Range"), | |
107 | fThreshold(&fSelection, "Threshold"), | |
108 | fDraw(&fMain, "Draw"), | |
989ef56a | 109 | fLayout(kLHintsExpandX, 2, 2, 2, 2), |
110 | fCPedestal(0), | |
111 | fCNoise(0), | |
112 | fCGain(0), | |
113 | fCDead(0), | |
114 | fCRate(0), | |
115 | fCRange(0), | |
116 | fCThreshold(0) | |
ee13fa25 | 117 | { |
118 | fSetup.AddFrame(&fLRun, &fLayout); | |
119 | fSetup.AddFrame(&fRun, &fLayout); | |
120 | fSetup.AddFrame(&fLOCDB, &fLayout); | |
121 | fSetup.AddFrame(&fOCDB, &fLayout); | |
122 | fSetup.AddFrame(&fInit, &fLayout); | |
123 | ||
124 | fFDet.AddFrame(&fLDet, &fLayout); | |
125 | fFDet.AddFrame(&fDet, &fLayout); | |
126 | fFRing.AddFrame(&fLRing,&fLayout); | |
127 | fFRing.AddFrame(&fRing, &fLayout); | |
128 | fFSec.AddFrame(&fLSec, &fLayout); | |
129 | fFSec.AddFrame(&fSec, &fLayout); | |
130 | fFStr.AddFrame(&fLStr, &fLayout); | |
131 | fFStr.AddFrame(&fStr, &fLayout); | |
132 | ||
133 | fMain.AddFrame(&fSetup, &fLayout); | |
134 | fMain.AddFrame(&fFDet, &fLayout); | |
135 | fMain.AddFrame(&fFRing, &fLayout); | |
136 | fMain.AddFrame(&fFSec, &fLayout); | |
137 | fMain.AddFrame(&fFStr, &fLayout); | |
138 | fMain.AddFrame(&fSelection, &fLayout); | |
139 | fMain.AddFrame(&fDraw, &fLayout); | |
140 | ||
141 | fRing.SetAlignment(kTextRight); | |
142 | fRing.SetInsertMode(TGTextEntry::kReplace); | |
143 | fRing.SetMaxLength(1); | |
144 | ||
145 | fMain.MapSubwindows(); | |
146 | fMain.Resize(fMain.GetDefaultSize()); | |
147 | fMain.MapWindow(); | |
148 | ||
149 | fDraw.Connect("Clicked()", "Menu", this, "Handle()"); | |
150 | fInit.Connect("Clicked()", "Menu", this, "Init()"); | |
151 | ||
989ef56a | 152 | AliCDBManager* cdb = AliCDBManager::Instance(); |
153 | if (cdb->GetDefaultStorage()) | |
154 | fOCDB.SetText(cdb->GetDefaultStorage()->GetURI().Data()); | |
ee13fa25 | 155 | fCD.Init(runNo); |
156 | } | |
157 | TCanvas* MakeCanvas(const char* name, const char* title) | |
158 | { | |
159 | TCanvas* ret = new TCanvas(name, title, 1200, 900); | |
160 | ret->SetFillColor(0); | |
161 | ret->SetFillStyle(0); | |
162 | ret->SetBorderMode(0); | |
163 | ret->SetBorderSize(0); | |
164 | return ret; | |
165 | } | |
166 | void ClearCanvas(TCanvas* c) | |
167 | { | |
168 | c->Clear(); | |
169 | c->SetTopMargin(0.02); | |
170 | c->SetRightMargin(0.02); | |
171 | c->SetBottomMargin(0.10); | |
172 | c->SetLeftMargin(0.10); | |
173 | c->cd(); | |
174 | } | |
175 | void Init() | |
176 | { | |
177 | const Char_t* ocdb = fOCDB.GetText(); | |
178 | Int_t run = fRun.GetIntNumber(); | |
179 | Info("Init", "Initialising for run %d, OCDB @ %s", run, ocdb); | |
180 | fCD.Init(run, ocdb); | |
181 | } | |
182 | void Handle() | |
183 | { | |
989ef56a | 184 | // static Short_t oD; |
185 | // static Char_t oR; | |
186 | // static Short_t oS; | |
187 | // static Short_t oT; | |
ee13fa25 | 188 | Short_t d = fDet.GetIntNumber(); |
189 | Char_t r = fRing.GetText()[0]; | |
190 | Short_t s = fSec.GetIntNumber(); | |
191 | Short_t t = fStr.GetIntNumber(); | |
192 | Info("Handle", "D=%d, R=%c, S=%d, T=%d", d, (r == '\0' ? '-' : r), s, t); | |
193 | if (fPedestal.IsOn()) { | |
194 | Info("Handle", "Will draw pedestals"); | |
195 | if (!fCPedestal) fCPedestal = MakeCanvas("peds", "Pedestals"); | |
196 | ClearCanvas(fCPedestal); | |
197 | fCD.DrawPedestals(d, r, s, t); | |
198 | } | |
199 | if (fNoise.IsOn()) { | |
200 | Info("Handle", "Will draw noises"); | |
201 | if (!fCNoise) fCNoise = MakeCanvas("noises", "Noises"); | |
202 | ClearCanvas(fCNoise); | |
203 | fCD.DrawNoise(d, r, s, t); | |
204 | } | |
205 | if (fGain.IsOn()) { | |
206 | Info("Handle", "Will draw gains"); | |
207 | if (!fCGain) fCGain = MakeCanvas("gains", "Gains"); | |
208 | ClearCanvas(fCGain); | |
209 | fCD.DrawGains(d, r, s, t); | |
210 | } | |
211 | if (fDead.IsOn()) { | |
212 | Info("Handle", "Will draw deads"); | |
213 | if (!fCDead) fCDead = MakeCanvas("deads", "Deads"); | |
214 | ClearCanvas(fCDead); | |
215 | fCD.DrawDead(d, r, s, t); | |
216 | } | |
217 | if (fRate.IsOn()) { | |
218 | Info("Handle", "Will draw rates"); | |
219 | if (!fCRate) fCRate = MakeCanvas("rates", "Rates"); | |
220 | fCRate->Clear(); | |
221 | fCRate->cd(); | |
222 | fCD.DrawRates(d, r, s, t); | |
223 | } | |
224 | if (fRange.IsOn()) { | |
225 | Info("Handle", "Will draw ranges"); | |
226 | if (!fCRange) fCRange = MakeCanvas("ranges", "Ranges"); | |
227 | fCRange->Clear(); | |
228 | fCRange->cd(); | |
229 | fCD.DrawRanges(d, r, s, t); | |
230 | } | |
231 | if (fThreshold.IsOn()) { | |
232 | Info("Handle", "Will draw thresholds"); | |
233 | if (!fCThreshold) fCThreshold = MakeCanvas("thresholds", "Thresholds"); | |
234 | fCThreshold->Clear(); | |
235 | fCThreshold->cd(); | |
236 | fCD.DrawThresholds(d, r, s, t); | |
237 | } | |
238 | } | |
239 | }; | |
240 | ||
241 | ||
242 | void | |
243 | DrawCalib() | |
244 | { | |
245 | #ifdef __CINT__ | |
246 | gSystem->Load("libFMDutil"); | |
247 | #endif | |
248 | ||
249 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
989ef56a | 250 | // cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
251 | // cdb->SetSpecificStorage("FMD/Calib/Pedestal", "local:///mnt/hitachi/ocdb/2011"); | |
252 | // cdb->SetSpecificStorage("FMD/Calib/PulseGain", | |
253 | // "local:///mnt/hitachi/ocdb/2011"); | |
254 | cdb->SetDefaultStorage("local:///mnt/hitachi/ocdb/2011"); | |
ee13fa25 | 255 | |
256 | Menu* m = new Menu(145167); | |
257 | // cd->DrawPedestals(d,r,s,t); | |
258 | } |