]>
Commit | Line | Data |
---|---|---|
7af3df7f | 1 | // |
2 | //____________________________________________________________________ | |
3 | // | |
4 | // $Id: DrawHits.C 22496 2007-11-26 13:50:44Z cholm $ | |
5 | // | |
6 | // Script that contains a class to draw hits, using the | |
7 | // AliFMDInputHits class in the util library. | |
8 | // | |
9 | // Use the script `Compile.C' to compile this class using ACLic. | |
10 | // | |
11 | #include <AliCDBManager.h> | |
12 | #include <AliFMDParameters.h> | |
13 | #include <AliFMDHit.h> | |
14 | #include <AliFMDDigit.h> | |
15 | #include <AliFMDSDigit.h> | |
16 | #include <AliFMDRecPoint.h> | |
17 | #include <AliESDFMD.h> | |
18 | #include <AliFMDPattern.h> | |
19 | #include <AliFMDSpectraDisplay.h> | |
20 | #include <TBrowser.h> | |
21 | #include <TDirectory.h> | |
22 | #include <TObjArray.h> | |
23 | #include <TH1.h> | |
24 | #include <TH2.h> | |
25 | #include <TH3.h> | |
26 | #include <TGraph.h> | |
27 | #include <TF1.h> | |
28 | #include <iostream> | |
29 | #include <TStyle.h> | |
30 | #include <TEnv.h> | |
31 | #include <TCanvas.h> | |
32 | #include <TGFrame.h> | |
33 | #include <TGCanvas.h> | |
34 | #include <TGListTree.h> | |
35 | #include <TGClient.h> | |
36 | #include <TSystem.h> | |
37 | #include <KeySymbols.h> | |
38 | #include <TClass.h> | |
39 | #include <RQ_OBJECT.h> | |
40 | #include <TSlider.h> | |
c6b36280 | 41 | #define NESTED(X) AliFMDSpectraDisplay::AliFMDSpectraDisplay # X |
7af3df7f | 42 | |
43 | //================================================================== | |
09b6c804 | 44 | void |
45 | AliFMDSpectraDisplay::AliFMDSpectraDisplayElement::MakeHistograms(const | |
46 | TAxis* | |
47 | axis) | |
7af3df7f | 48 | { |
c6b36280 | 49 | // Create the |
50 | // needed histograms | |
51 | // for this element | |
7af3df7f | 52 | if (fFull) return; |
53 | if (axis->IsVariableBinSize()) { | |
54 | fFull = new TH1F(Form("f_%s", GetName()), Form("%s spectra", GetName()), | |
55 | axis->GetXbins()->fN, axis->GetXbins()->fArray); | |
56 | fCut = new TH1F(Form("c_%s", GetName()), | |
57 | Form("%s restricted spectra", GetName()), | |
58 | axis->GetXbins()->fN, axis->GetXbins()->fArray); | |
59 | } | |
60 | else { | |
61 | fFull = new TH1F(Form("f_%s", GetName()), Form("%s spectra", GetName()), | |
62 | axis->GetNbins(), axis->GetXmin(), axis->GetXmax()); | |
63 | fCut = new TH1F(Form("c_%s", GetName()), | |
64 | Form("%s restricted spectra", GetName()), | |
65 | axis->GetNbins(), axis->GetXmin(), axis->GetXmax()); | |
66 | } | |
67 | fFull->SetFillColor(kRed); | |
68 | fFull->SetFillStyle(3001); | |
69 | fCut->SetFillColor(kBlue); | |
70 | fCut->SetFillStyle(3001); | |
71 | } | |
72 | //__________________________________________________________________ | |
c6b36280 | 73 | void AliFMDSpectraDisplay::AliFMDSpectraDisplayElement::DoFill(Double_t v) |
7af3df7f | 74 | { |
c6b36280 | 75 | // Fill into histograms |
7af3df7f | 76 | if (fFull) fFull->Fill(v); |
77 | } | |
78 | //__________________________________________________________________ | |
c6b36280 | 79 | void AliFMDSpectraDisplay::AliFMDSpectraDisplayElement::Show(Option_t* option, |
7af3df7f | 80 | Double_t l, Double_t h) |
81 | { | |
c6b36280 | 82 | // Show this element |
83 | // | |
7af3df7f | 84 | if (!fFull) return; |
85 | gPad->SetLogy(fFull->GetMaximum() > 10); | |
86 | fFull->Draw(option); | |
87 | Double_t lx = fFull->GetXaxis()->GetXmin(); | |
88 | Double_t hx = fFull->GetXaxis()->GetXmax(); | |
89 | Double_t rr = (hx-lx); | |
90 | Double_t ll = rr * l + lx; | |
91 | Double_t hh = rr * h + lx; | |
92 | for (Int_t i = 1; i <= fFull->GetNbinsX(); i++) { | |
93 | if (fFull->GetBinCenter(i) <= ll || | |
94 | fFull->GetBinCenter(i) > hh) { | |
95 | fCut->SetBinContent(i, 0); | |
96 | continue; | |
97 | } | |
98 | fCut->SetBinContent(i, fFull->GetBinContent(i)); | |
99 | } | |
100 | fCut->Draw(Form("%s same", option)); | |
101 | } | |
102 | ||
103 | //__________________________________________________________________ | |
104 | Int_t | |
c6b36280 | 105 | AliFMDSpectraDisplay::AliFMDSpectraDisplayElement::Compare(const TObject*) const |
7af3df7f | 106 | { |
107 | return -1; | |
108 | } | |
109 | ||
110 | ||
111 | //================================================================== | |
c6b36280 | 112 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::AliFMDSpectraDisplayTop(TGCompositeFrame& frame, |
7af3df7f | 113 | TCanvas* canvas) |
114 | : AliFMDSpectraDisplayElement("All", "Everything"), | |
115 | fHints(kLHintsExpandX|kLHintsExpandY,3, 3, 3, 3), | |
116 | fContainer(&frame, 200, 350), | |
117 | fList(&fContainer, kHorizontalFrame), | |
118 | fChildren(0), | |
119 | fCurrentEntry(0), | |
120 | fCanvas(canvas), | |
c6b36280 | 121 | fkHist1DIcon(gClient->GetPicture("h1_t.xpm")), |
122 | fkHist2DIcon(gClient->GetPicture("h2_t.xpm")), | |
123 | fkHist3DIcon(gClient->GetPicture("h3_t.xpm")), | |
124 | fkGraphIcon(gClient->GetPicture("graph.xpm")), | |
7af3df7f | 125 | fAxis(0), |
126 | fEntry(*(fList.AddItem(0, GetName(), this))) | |
127 | { | |
c6b36280 | 128 | // Constructor |
129 | // Parameters: | |
130 | // frame PArent frame | |
131 | // canvas Canvas to draw in | |
7af3df7f | 132 | fContainer.AddFrame(&fList, &fHints); |
133 | frame.AddFrame(&fContainer, &fHints); | |
134 | ||
135 | fList.Connect("Clicked(TGListTreeItem*,Int_t)", | |
c6b36280 | 136 | "AliFMDSpectraDisplay::AliFMDSpectraDisplayTop", this, |
7af3df7f | 137 | "HandleEntry(TGListTreeItem*,Int_t)"); |
138 | fList.Connect("KeyPressed(TGListTreeItem*,ULong_t,ULong_t)", | |
c6b36280 | 139 | "AliFMDSpectraDisplay::AliFMDSpectraDisplayTop", this, |
7af3df7f | 140 | "HandleKey(TGListTreeItem*,UInt_t,UInt_t)"); |
141 | fList.Connect("ReturnPressed(TGListTreeItem*)", | |
c6b36280 | 142 | "AliFMDSpectraDisplay::AliFMDSpectraDisplayTop", this, |
7af3df7f | 143 | "HandleReturn(TGListTreeItem*)"); |
144 | } | |
145 | //____________________________________________________________________ | |
146 | void | |
c6b36280 | 147 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::SetAxis(TAxis* axis) |
7af3df7f | 148 | { |
c6b36280 | 149 | // Set the axis of histograms |
7af3df7f | 150 | fAxis = axis; |
151 | MakeHistograms(axis); | |
152 | } | |
153 | //____________________________________________________________________ | |
154 | void | |
c6b36280 | 155 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::ClearCanvas() |
7af3df7f | 156 | { |
c6b36280 | 157 | // Clear the canvas |
7af3df7f | 158 | if (!fCanvas) return; |
159 | fCanvas->Clear(); | |
160 | } | |
161 | ||
162 | //____________________________________________________________________ | |
163 | void | |
c6b36280 | 164 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::ClearList() |
7af3df7f | 165 | { |
c6b36280 | 166 | // Clear the lsit |
7af3df7f | 167 | fList.DeleteItem(fList.GetFirstItem()); |
168 | UpdateList(); | |
169 | } | |
170 | ||
171 | ||
172 | //____________________________________________________________________ | |
173 | void | |
c6b36280 | 174 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::HandleReturn(TGListTreeItem * f) |
7af3df7f | 175 | { |
c6b36280 | 176 | // HAndle when return is pressed |
7af3df7f | 177 | if (!f) { |
178 | fList.UnselectAll(kFALSE); | |
179 | fList.SetSelected(0); | |
180 | return; | |
181 | } | |
182 | fList.ToggleItem(f); | |
183 | UpdateList(); | |
184 | } | |
185 | ||
186 | ||
187 | //____________________________________________________________________ | |
188 | void | |
c6b36280 | 189 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::HandleKey(TGListTreeItem * f, UInt_t keysym, UInt_t) |
7af3df7f | 190 | { |
c6b36280 | 191 | // Handle a key stroke |
7af3df7f | 192 | if (!f) { |
193 | fList.UnselectAll(kFALSE); | |
194 | fList.SetSelected(0); | |
195 | return; | |
196 | } | |
197 | TGListTreeItem* next = 0; | |
198 | switch (keysym) { | |
199 | case kKey_Up: | |
200 | next = f->GetPrevSibling(); | |
201 | if (!next) { | |
202 | next = f->GetParent(); | |
203 | if (next) fList.CloseItem(next); | |
204 | } | |
205 | break; | |
206 | case kKey_Down: | |
207 | next = f->GetNextSibling(); | |
208 | if (!next && f->GetParent()) { | |
209 | next = f->GetParent()->GetNextSibling(); | |
210 | fList.CloseItem(f->GetParent()); | |
211 | } | |
212 | break; | |
213 | case kKey_Left: | |
214 | next = f->GetParent(); | |
215 | if (next) fList.CloseItem(next); | |
216 | break; | |
217 | case kKey_Right: | |
218 | next = f->GetFirstChild(); | |
219 | if (next) fList.OpenItem(f); | |
220 | break; | |
221 | case kKey_PageUp: | |
222 | fList.PageUp(kTRUE); | |
223 | next = fList.GetSelected(); | |
224 | break; | |
225 | case kKey_PageDown: | |
226 | fList.PageDown(kTRUE); | |
227 | next = fList.GetSelected(); | |
228 | break; | |
229 | } | |
230 | // if (next) gClient->NeedRedraw(&fList); | |
231 | if (next && next != f) { | |
232 | fList.ClearHighlighted(); | |
233 | fList.SetSelected(next); | |
234 | HandleEntry(next,0); | |
235 | } | |
236 | if (next) gClient->NeedRedraw(&fList); | |
237 | } | |
238 | ||
239 | //____________________________________________________________________ | |
240 | void | |
c6b36280 | 241 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::HandleEntry(TGListTreeItem* entry, Int_t /*id*/) |
7af3df7f | 242 | { |
c6b36280 | 243 | // Handle selection of entries |
7af3df7f | 244 | TGListTreeItem* old = fCurrentEntry; |
245 | if (entry) { | |
246 | if (!entry->GetUserData()) return; | |
247 | fCurrentEntry = entry; | |
248 | } | |
249 | else { | |
250 | fCurrentEntry = 0; | |
251 | ClearCanvas(); | |
252 | } | |
253 | if (old != fCurrentEntry && fCanvas) fCanvas->cd(); | |
254 | SelectionChanged(); | |
255 | } | |
256 | ||
257 | //____________________________________________________________________ | |
258 | void | |
c6b36280 | 259 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::UpdateList() |
7af3df7f | 260 | { |
c6b36280 | 261 | // Update list |
7af3df7f | 262 | gClient->NeedRedraw(&fList); |
263 | } | |
264 | ||
265 | //____________________________________________________________________ | |
266 | void | |
c6b36280 | 267 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::UpdateCanvas() |
7af3df7f | 268 | { |
c6b36280 | 269 | // update canvas |
7af3df7f | 270 | if (!fCanvas) return; |
271 | fCanvas->Modified(); | |
272 | fCanvas->Update(); | |
273 | fCanvas->cd(); | |
274 | } | |
275 | //____________________________________________________________________ | |
c6b36280 | 276 | TObject* AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::Current() const |
7af3df7f | 277 | { |
c6b36280 | 278 | // Get currently selected entry if any |
7af3df7f | 279 | if (!fCurrentEntry) return 0; |
280 | if (!fCurrentEntry->GetUserData()) return 0; | |
281 | return static_cast<TObject*>(fCurrentEntry->GetUserData()); | |
282 | } | |
283 | ||
284 | //__________________________________________________________________ | |
c6b36280 | 285 | AliFMDSpectraDisplay::AliFMDSpectraDisplayDetector& |
286 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::GetOrAdd(UShort_t id) | |
7af3df7f | 287 | { |
c6b36280 | 288 | // Get or add a sub-element |
7af3df7f | 289 | Int_t idx = id - 1; |
290 | AliFMDSpectraDisplayDetector* d = 0; | |
291 | if (fChildren.GetEntriesFast() <= idx || | |
292 | !(d = static_cast<AliFMDSpectraDisplayDetector*>(fChildren.At(idx)))) { | |
293 | d = new AliFMDSpectraDisplayDetector(id, *this); | |
294 | fChildren.AddAtAndExpand(d, idx); | |
295 | // GetTop().GetList().SortChildren(&fEntry); | |
296 | // GetTop().GetList().Sort(&(d->GetEntry())); | |
297 | } | |
298 | return *d; | |
299 | } | |
300 | //__________________________________________________________________ | |
c6b36280 | 301 | void |
302 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::Fill(UShort_t det, Char_t ring, | |
303 | UShort_t sec, UShort_t str, | |
304 | Double_t v) | |
7af3df7f | 305 | { |
306 | AliFMDSpectraDisplayDetector& d = GetOrAdd(det); | |
307 | d.Fill(ring, sec, str, v); | |
308 | DoFill(v); | |
309 | } | |
310 | //__________________________________________________________________ | |
311 | Int_t | |
c6b36280 | 312 | AliFMDSpectraDisplay::AliFMDSpectraDisplayTop::Compare(const TObject*) const |
7af3df7f | 313 | { |
c6b36280 | 314 | // Compare to another object |
7af3df7f | 315 | return -1; |
316 | } | |
317 | //================================================================== | |
c6b36280 | 318 | AliFMDSpectraDisplay::AliFMDSpectraDisplayDetector::AliFMDSpectraDisplayDetector(UShort_t det, |
7af3df7f | 319 | AliFMDSpectraDisplayTop& tree) |
320 | : AliFMDSpectraDisplayElement(Form("FMD%d", det), "FMD Sub-detector"), | |
321 | fId(det), | |
322 | fParent(tree), | |
323 | fChildren(0), | |
324 | fEntry(*(tree.GetList().AddItem(&(tree.GetEntry()), GetName()))) | |
325 | { | |
c6b36280 | 326 | // Constructor |
7af3df7f | 327 | fEntry.SetUserData(this); |
328 | fEntry.SetText(GetName()); | |
329 | if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis()); | |
330 | } | |
331 | //__________________________________________________________________ | |
c6b36280 | 332 | AliFMDSpectraDisplay::AliFMDSpectraDisplayRing& |
333 | AliFMDSpectraDisplay::AliFMDSpectraDisplayDetector::GetOrAdd(Char_t id) | |
7af3df7f | 334 | { |
c6b36280 | 335 | // Get or add an element |
7af3df7f | 336 | Int_t idx = (id == 'I' || id == 'i') ? 0 : 1; |
337 | AliFMDSpectraDisplayRing* r = 0;; | |
338 | if (fChildren.GetEntriesFast() <= idx || | |
339 | !(r = static_cast<AliFMDSpectraDisplayRing*>(fChildren.At(idx)))) { | |
340 | r = new AliFMDSpectraDisplayRing(id, *this); | |
341 | fChildren.AddAtAndExpand(r, idx); | |
342 | // GetTop().GetList().SortChildren(&fEntry); | |
343 | // GetTop().GetList().Sort(&(r->GetEntry())); | |
344 | } | |
345 | return *r; | |
346 | } | |
347 | //__________________________________________________________________ | |
c6b36280 | 348 | void |
349 | AliFMDSpectraDisplay::AliFMDSpectraDisplayDetector::Fill(Char_t ring, | |
350 | UShort_t sec, | |
351 | UShort_t str, | |
352 | Double_t v) | |
7af3df7f | 353 | { |
c6b36280 | 354 | // Fill values |
7af3df7f | 355 | AliFMDSpectraDisplayRing& r = GetOrAdd(ring); |
356 | r.Fill(sec, str, v); | |
357 | DoFill(v); | |
358 | } | |
359 | //__________________________________________________________________ | |
360 | Int_t | |
c6b36280 | 361 | AliFMDSpectraDisplay::AliFMDSpectraDisplayDetector::Compare(const TObject* o) const |
7af3df7f | 362 | { |
c6b36280 | 363 | // Compare to other element |
7af3df7f | 364 | std::cout << "Comparing detector to a " << o->ClassName() << std::endl; |
c6b36280 | 365 | if (o->IsA() == AliFMDSpectraDisplay::AliFMDSpectraDisplayDetector::Class()) { |
7af3df7f | 366 | const AliFMDSpectraDisplayDetector* ro = |
367 | static_cast<const AliFMDSpectraDisplayDetector*>(o); | |
368 | return (Id() < ro->Id() ? -1 : | |
369 | Id() == ro->Id() ? 0 : 1); | |
370 | } | |
371 | return -1; | |
372 | } | |
373 | //================================================================== | |
c6b36280 | 374 | AliFMDSpectraDisplay::AliFMDSpectraDisplayRing::AliFMDSpectraDisplayRing(Char_t id, |
7af3df7f | 375 | AliFMDSpectraDisplayDetector& d) |
376 | : AliFMDSpectraDisplayElement(Form("FMD%d%c", d.Id(), id), "FMD Ring"), | |
377 | fParent(d), | |
378 | fId(id), | |
379 | fChildren(0), | |
380 | fEntry(*(GetTop().GetList().AddItem(&(d.GetEntry()), GetName(), this))) | |
381 | { | |
c6b36280 | 382 | // Constructor |
7af3df7f | 383 | fEntry.SetText(GetName()); |
384 | if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis()); | |
385 | } | |
386 | //__________________________________________________________________ | |
c6b36280 | 387 | AliFMDSpectraDisplay::AliFMDSpectraDisplaySector& |
388 | AliFMDSpectraDisplay::AliFMDSpectraDisplayRing::GetOrAdd(UShort_t id) | |
7af3df7f | 389 | { |
c6b36280 | 390 | // Get or add another element |
7af3df7f | 391 | AliFMDSpectraDisplaySector* s = 0; |
392 | if (fChildren.GetEntriesFast() <= id || | |
393 | !(s = static_cast<AliFMDSpectraDisplaySector*>(fChildren.At(id)))) { | |
394 | s = new AliFMDSpectraDisplaySector(id, *this); | |
395 | fChildren.AddAtAndExpand(s, id); | |
396 | // GetTop().GetList().SortChildren(&fEntry); | |
397 | // GetTop().GetList().Sort(&(s->GetEntry())); | |
398 | } | |
399 | return *s; | |
400 | } | |
401 | //__________________________________________________________________ | |
c6b36280 | 402 | void |
403 | AliFMDSpectraDisplay::AliFMDSpectraDisplayRing::Fill(UShort_t sec, | |
404 | UShort_t str, | |
405 | Double_t v) | |
7af3df7f | 406 | { |
c6b36280 | 407 | // Fill values |
7af3df7f | 408 | AliFMDSpectraDisplaySector& s = GetOrAdd(sec); |
409 | s.Fill(str, v); | |
410 | DoFill(v); | |
411 | } | |
412 | //__________________________________________________________________ | |
413 | Int_t | |
c6b36280 | 414 | AliFMDSpectraDisplay::AliFMDSpectraDisplayRing::Compare(const TObject* o) const |
7af3df7f | 415 | { |
c6b36280 | 416 | // Compare to other element |
7af3df7f | 417 | std::cout << "Comparing ring to a " << o->ClassName() << std::endl; |
c6b36280 | 418 | if (o->IsA() == AliFMDSpectraDisplay::AliFMDSpectraDisplayRing::Class()) { |
7af3df7f | 419 | const AliFMDSpectraDisplayRing* ro = |
420 | static_cast<const AliFMDSpectraDisplayRing*>(o); | |
421 | return (Id() < ro->Id() ? -1 : | |
422 | Id() == ro->Id() ? 0 : 1); | |
423 | } | |
424 | return -1; | |
425 | } | |
426 | //================================================================== | |
c6b36280 | 427 | AliFMDSpectraDisplay::AliFMDSpectraDisplaySector::AliFMDSpectraDisplaySector(UShort_t id, |
7af3df7f | 428 | AliFMDSpectraDisplayRing& r) |
429 | : AliFMDSpectraDisplayElement(Form("FMD%d%c_%02d",r.DetectorId(),r.Id(),id), | |
430 | "FMD Sector"), | |
431 | fParent(r), | |
432 | fId(id), | |
433 | fChildren(0), | |
434 | fEntry(*(GetTop().GetList().AddItem(&(r.GetEntry()), GetName(), this))) | |
435 | { | |
c6b36280 | 436 | // Constructor |
7af3df7f | 437 | fEntry.SetText(GetName()); |
438 | if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis()); | |
439 | } | |
440 | //__________________________________________________________________ | |
c6b36280 | 441 | AliFMDSpectraDisplay::AliFMDSpectraDisplayStrip& |
442 | AliFMDSpectraDisplay::AliFMDSpectraDisplaySector::GetOrAdd(UShort_t id) | |
7af3df7f | 443 | { |
c6b36280 | 444 | // Get or add another element |
7af3df7f | 445 | AliFMDSpectraDisplayStrip* s = 0; |
446 | if (fChildren.GetEntriesFast() <= id || | |
447 | !(s = static_cast<AliFMDSpectraDisplayStrip*>(fChildren.At(id)))) { | |
448 | s = new AliFMDSpectraDisplayStrip(id, *this); | |
449 | fChildren.AddAtAndExpand(s, id); | |
450 | // GetTop().GetList().SortChildren(&fEntry); | |
451 | // GetTop().GetList().Sort(&(s->GetEntry())); | |
452 | } | |
453 | return *s; | |
454 | } | |
455 | //__________________________________________________________________ | |
c6b36280 | 456 | void |
457 | AliFMDSpectraDisplay::AliFMDSpectraDisplaySector::Fill(UShort_t str, | |
458 | Double_t v) | |
7af3df7f | 459 | { |
c6b36280 | 460 | // Fill values |
7af3df7f | 461 | AliFMDSpectraDisplayStrip& s = GetOrAdd(str); |
462 | s.Fill(v); | |
463 | DoFill(v); | |
464 | } | |
465 | //__________________________________________________________________ | |
466 | Int_t | |
c6b36280 | 467 | AliFMDSpectraDisplay::AliFMDSpectraDisplaySector::Compare(const TObject* o) const |
7af3df7f | 468 | { |
c6b36280 | 469 | // Compare to another elemnt |
7af3df7f | 470 | std::cout << "Comparing sector to a " << o->ClassName() << std::endl; |
c6b36280 | 471 | if (o->IsA() == AliFMDSpectraDisplay::AliFMDSpectraDisplaySector::Class()) { |
7af3df7f | 472 | const AliFMDSpectraDisplaySector* ro = |
473 | static_cast<const AliFMDSpectraDisplaySector*>(o); | |
474 | return (Id() < ro->Id() ? -1 : | |
475 | Id() == ro->Id() ? 0 : 1); | |
476 | } | |
477 | return -1; | |
478 | } | |
479 | //================================================================== | |
c6b36280 | 480 | AliFMDSpectraDisplay::AliFMDSpectraDisplayStrip::AliFMDSpectraDisplayStrip(UShort_t id, |
7af3df7f | 481 | AliFMDSpectraDisplaySector& s) |
482 | : AliFMDSpectraDisplayElement(Form("FMD%d%c_%02d_%03d", | |
483 | s.DetectorId(), s.RingId(), | |
484 | s.Id(), id), "FMD Strip"), | |
485 | fParent(s), | |
486 | fId(id), | |
487 | fEntry(*(GetTop().GetList().AddItem(&(s.GetEntry()), GetName(), this))) | |
488 | { | |
c6b36280 | 489 | // Constructor |
7af3df7f | 490 | fEntry.SetText(GetName()); |
491 | fEntry.SetPictures(GetTop().GetH1Pic(), GetTop().GetH1Pic()); | |
492 | if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis()); | |
493 | } | |
494 | //__________________________________________________________________ | |
c6b36280 | 495 | void |
496 | AliFMDSpectraDisplay::AliFMDSpectraDisplayStrip::Fill(Double_t v) | |
7af3df7f | 497 | { |
c6b36280 | 498 | // Fill values |
7af3df7f | 499 | DoFill(v); |
500 | } | |
501 | //__________________________________________________________________ | |
502 | Int_t | |
c6b36280 | 503 | AliFMDSpectraDisplay::AliFMDSpectraDisplayStrip::Compare(const TObject* o) const |
7af3df7f | 504 | { |
c6b36280 | 505 | // Compare to another element |
7af3df7f | 506 | std::cout << "Comparing strip to a " << o->ClassName() << std::endl; |
c6b36280 | 507 | if (o->IsA() == AliFMDSpectraDisplay::AliFMDSpectraDisplayStrip::Class()) { |
7af3df7f | 508 | const AliFMDSpectraDisplayStrip* ro = |
509 | static_cast<const AliFMDSpectraDisplayStrip*>(o); | |
510 | return (Id() < ro->Id() ? -1 : | |
511 | Id() == ro->Id() ? 0 : 1); | |
512 | } | |
513 | return -1; | |
514 | } | |
515 | ||
516 | //================================================================== | |
517 | AliFMDSpectraDisplay::AliFMDSpectraDisplay() | |
518 | : AliFMDPattern(), | |
519 | fSelector(gClient->GetRoot(), 100, 100), | |
520 | fTop(fSelector, fAux) | |
521 | { | |
c6b36280 | 522 | // Constructor |
523 | // AddLoad(AliFMDInput::kRaw); | |
7af3df7f | 524 | SetName("RAW"); |
525 | SetTitle("RAW"); | |
526 | ||
527 | fTop.Connect("SelectionChanged()", | |
528 | "AliFMDSpectraDisplay", this, "HandleDraw()"); | |
529 | ||
530 | fSelector.MapSubwindows(); | |
531 | fSelector.Resize(fSelector.GetDefaultSize()); | |
532 | fSelector.MapWindow(); | |
533 | } | |
534 | ||
535 | //__________________________________________________________________ | |
536 | Bool_t | |
537 | AliFMDSpectraDisplay::HandleDraw() | |
538 | { | |
c6b36280 | 539 | // Handle draw request |
7af3df7f | 540 | TObject* user = fTop.Current(); |
541 | if (!user) return kFALSE; | |
c6b36280 | 542 | if (!user->InheritsFrom(AliFMDSpectraDisplay::AliFMDSpectraDisplayElement::Class())) { |
7af3df7f | 543 | Warning("HandleDraw", "%s does not inherit from Spectra::Element", |
544 | user->GetName()); | |
545 | return kFALSE; | |
546 | } | |
547 | fAux->cd(); | |
548 | AliFMDSpectraDisplayElement* e | |
549 | = static_cast<AliFMDSpectraDisplayElement*>(user); | |
550 | e->Show("hist", fSlider->GetMinimum(), fSlider->GetMaximum()); | |
551 | fAux->Modified(); | |
552 | fAux->Update(); | |
553 | fAux->cd(); | |
554 | return kTRUE; | |
555 | } | |
556 | //__________________________________________________________________ | |
557 | void | |
558 | AliFMDSpectraDisplay::MakeAux() | |
559 | { | |
c6b36280 | 560 | // MAke auxilary canvas |
7af3df7f | 561 | AliFMDPattern::MakeAux(); |
562 | if (!fAux) return; | |
563 | fTop.SetAxis(fSpec->GetXaxis()); | |
564 | } | |
565 | //__________________________________________________________________ | |
566 | void | |
567 | AliFMDSpectraDisplay::DrawAux() | |
568 | { | |
569 | // Draw in the Aux the canvas | |
570 | // For example draw the spectra | |
571 | // or such stuff | |
572 | if (fTop.Current() != &fTop && HandleDraw()) return; | |
573 | AliFMDPattern::DrawAux(); | |
574 | } | |
575 | //__________________________________________________________________ | |
576 | Bool_t | |
577 | AliFMDSpectraDisplay::ProcessHit(AliFMDHit* hit, TParticle* p) | |
578 | { | |
c6b36280 | 579 | // Process a hit |
7af3df7f | 580 | fTop.Fill(hit->Detector(), |
581 | hit->Ring(), | |
582 | hit->Sector(), | |
583 | hit->Strip(), | |
584 | hit->Edep()); | |
585 | return AliFMDPattern::ProcessHit(hit, p); | |
586 | } | |
587 | //__________________________________________________________________ | |
588 | Bool_t | |
589 | AliFMDSpectraDisplay::ProcessDigit(AliFMDDigit* digit) | |
590 | { | |
c6b36280 | 591 | // Process a digit |
7af3df7f | 592 | fTop.Fill(digit->Detector(), |
593 | digit->Ring(), | |
594 | digit->Sector(), | |
595 | digit->Strip(), | |
596 | digit->Counts()); | |
597 | return AliFMDDisplay::ProcessDigit(digit); | |
598 | } | |
599 | //__________________________________________________________________ | |
600 | Bool_t | |
601 | AliFMDSpectraDisplay::ProcessSDigit(AliFMDSDigit* sdigit) | |
602 | { | |
c6b36280 | 603 | // Process a summable digit |
7af3df7f | 604 | fTop.Fill(sdigit->Detector(), |
605 | sdigit->Ring(), | |
606 | sdigit->Sector(), | |
607 | sdigit->Strip(), | |
608 | sdigit->Counts()); | |
609 | return AliFMDDisplay::ProcessSDigit(sdigit); | |
610 | } | |
611 | //__________________________________________________________________ | |
612 | Bool_t | |
613 | AliFMDSpectraDisplay::ProcessRawDigit(AliFMDDigit* digit) | |
614 | { | |
c6b36280 | 615 | // Process a raw digit |
7af3df7f | 616 | return ProcessDigit(digit); |
617 | } | |
618 | //__________________________________________________________________ | |
619 | Bool_t | |
620 | AliFMDSpectraDisplay::ProcessRecPoint(AliFMDRecPoint* recpoint) | |
621 | { | |
c6b36280 | 622 | // Process a rec-point |
7af3df7f | 623 | fTop.Fill(recpoint->Detector(), |
624 | recpoint->Ring(), | |
625 | recpoint->Sector(), | |
626 | recpoint->Strip(), | |
627 | recpoint->Particles()); | |
628 | return AliFMDDisplay::ProcessRecPoint(recpoint); | |
629 | } | |
630 | //__________________________________________________________________ | |
631 | Bool_t | |
632 | AliFMDSpectraDisplay::ProcessESD(UShort_t det, Char_t rng, UShort_t sec, | |
633 | UShort_t str, Float_t x, Float_t mult) | |
634 | { | |
c6b36280 | 635 | // Process ESD entry |
7af3df7f | 636 | fTop.Fill(det, rng, sec, str, mult); |
637 | return AliFMDDisplay::ProcessESD(det, rng, sec, str, x, mult); | |
638 | } | |
639 | //__________________________________________________________________ | |
640 | // | |
641 | // EOF | |
642 | // |