]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/scripts/SpectraMonitor.C
Fix some warnings.
[u/mrichter/AliRoot.git] / FMD / scripts / SpectraMonitor.C
CommitLineData
2eddac03 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//
7af3df7f 11
12void
13SpectraMonitor(const char* file="",
14 Int_t runno=0,
15 const char* cdbSrc="local://$ALICE_ROOT",
16 UShort_t over=0)
17{
18 gSystem->Load("libFMDutil.so");
19 // AliLog::SetModuleDebugLevel("FMD", 8);
20 TString fname(file);
21 if (fname.CompareTo("help", TString::kIgnoreCase) == 0) {
22 std::cout << "Usage: RunSpectraMonitor(<src>[,<runno>[,<cdb>[,<over>]]])\n"
23 << "\n"
24 << "Where:\n\n"
25 << " <src> Is a data source (online, file)\n"
26 << " <runno> Is the (optional) run number\n"
27 << " <cdb> Is the (optional) CDB storage\n"
28 << " <over> Is the (optional) over sampling rate\n\n"
29 << "Defaults are <runno>=0 and cdb=\"local://$ALICE_ROOT\"\n"
30 << "<over> allows one to override the CDB setting. Default\n"
31 << "is to use the CDB setting.\n\n"
32 << "Note: This script _must_ be compiled with ACLic"
33 << std::endl;
34 return;
35 }
36 AliCDBManager* cdb = AliCDBManager::Instance();
37 cdb->SetDefaultStorage(cdbSrc);
38 cdb->SetRun(runno);
39 UInt_t what = (AliFMDParameters::kPulseGain |
40 AliFMDParameters::kPedestal |
41 AliFMDParameters::kDeadMap |
42 AliFMDParameters::kZeroSuppression|
43 AliFMDParameters::kAltroMap |
44 AliFMDParameters::kStripRange);
45 if (over != 0) what |= AliFMDParameters::kSampleRate;
46 AliFMDParameters::Instance()->Init(kFALSE, what);
47 if (over != 0) AliFMDParameters::Instance()->SetSampleRate(over);
48
49 AliFMDSpectraDisplay* d = new AliFMDSpectraDisplay;
50 d->AddLoad(AliFMDInput::kRaw);
51 d->SetRawFile(file);
52 d->Run();
53}
54
55#if 0
2eddac03 56#include <AliCDBManager.h>
57#include <AliFMDParameters.h>
58#include <AliFMDHit.h>
59#include <AliFMDDigit.h>
60#include <AliFMDSDigit.h>
61#include <AliFMDRecPoint.h>
62#include <AliESDFMD.h>
63#include <AliFMDPattern.h>
64#include <TBrowser.h>
65#include <TDirectory.h>
66#include <TObjArray.h>
67#include <TH1.h>
68#include <TH2.h>
69#include <TH3.h>
70#include <TGraph.h>
71#include <TF1.h>
72#include <iostream>
73#include <TStyle.h>
74#include <TEnv.h>
75#include <TCanvas.h>
76#include <TGFrame.h>
77#include <TGCanvas.h>
78#include <TGListTree.h>
79#include <TGClient.h>
80#include <TSystem.h>
81#include <KeySymbols.h>
82#include <TClass.h>
83#include <RQ_OBJECT.h>
84#include <TSlider.h>
85
86namespace Spectra {
87 struct Top;
88 struct Detector;
89 struct Ring;
90 struct Sector;
91 struct Strip;
92
93 //__________________________________________________________________
94 struct Element : public TNamed
95 {
96 virtual ~Element() {}
97 virtual void Draw(Option_t* option, Double_t l, Double_t h);
98 virtual Top& GetTop() = 0;
99 virtual void MakeHistograms(TAxis* axis);
100 protected:
101 Element(const char* name, const char* title)
102 : TNamed(name, title), fFull(0), fCut(0)
103 {}
104 void DoFill(Double_t v);
105 TH1* fFull;
106 TH1* fCut;
107 };
108
109 //__________________________________________________________________
110 struct Top : public Element
111 {
112 RQ_OBJECT("Spectra::Top")
113 public:
114 Top(TGCompositeFrame& frame, TCanvas* canvas);
115 TGListTree& GetList() { return fList; }
116 Detector& GetOrAdd(UShort_t id);
117 void Fill(UShort_t d, Char_t ring,
118 UShort_t sec, UShort_t str, Double_t v);
119 TAxis* GetAxis() { return fAxis; }
120 void SetAxis(TAxis* a);
121 Top& GetTop() { return *this; }
122
123 /** Handle entries
124 @param e selected entry, if any
125 @param id Id of entry */
126 virtual void HandleEntry(TGListTreeItem* e, Int_t id);
127 /** Handle key strokes
128 @param f Item selected, if any
129 @param keysym Key symbol
130 @param mask Modifier mask */
131 virtual void HandleKey(TGListTreeItem* f, UInt_t keysym, UInt_t mask);
132 /** Handle Return
133 @param f Selected item, if any */
134 virtual void HandleReturn(TGListTreeItem* f);
135 /** Clear the list */
136 virtual void ClearList();
137 /** Clear the canvas */
138 virtual void ClearCanvas();
139 /** Update canvas */
140 virtual void UpdateCanvas();
141 /** Update canvas */
142 virtual void UpdateList();
143 /** Return the currently selected entry */
144 TGListTreeItem* CurrentEntry() const { return fCurrentEntry; }
145 /** @return the currently selected user data (possibly 0) */
146 TObject* Current() const;
147 /** Selection changed signal */
148 void SelectionChanged() { Emit("SelectionChanged()"); }//*SIGNAL*
149 /** Get Picture for 1D histogram */
150 const TGPicture* GetH1Pic() { return fHist1DIcon; }
151 /** 2D Histogram Icon */
152 const TGPicture* GetH2Pic() { return fHist2DIcon; }
153 /** 3D Histogram Icon */
154 const TGPicture* GetH3Pic() { return fHist3DIcon; }
155 /** Graph Icon */
156 const TGPicture* GetGPic() { return fGraphIcon; }
157 TGListTreeItem& GetEntry() { return fEntry; }
158 protected:
159 TGLayoutHints fHints;
160 TGCanvas fContainer;
161 TGListTree fList;
162 TObjArray fChildren;
163 TGListTreeItem* fCurrentEntry;
164 TCanvas* fCanvas;
165 /** 1D Histogram Icon */
166 const TGPicture* fHist1DIcon;
167 /** 2D Histogram Icon */
168 const TGPicture* fHist2DIcon;
169 /** 3D Histogram Icon */
170 const TGPicture* fHist3DIcon;
171 /** Graph Icon */
172 const TGPicture* fGraphIcon;
173 /** The axis to use */
174 TAxis* fAxis;
175 /** Top entry */
176 TGListTreeItem& fEntry;
177 };
178
179 //__________________________________________________________________
180 struct Detector : public Element
181 {
182 Detector(UShort_t det, Top& top);
183 UShort_t Id() const { return fId; }
184 Top& GetTop() { return fParent; }
185 Top& GetParent() { return fParent; }
186 Ring& GetOrAdd(Char_t id);
187 void Fill(Char_t ring, UShort_t sec, UShort_t str, Double_t v);
188 TGListTreeItem& GetEntry() { return fEntry; }
189 protected:
190 UShort_t fId;
191 Top& fParent;
192 TObjArray fChildren;
193 TGListTreeItem& fEntry;
194 };
195
196 //__________________________________________________________________
197 struct Ring : public Element
198 {
199 Ring(Char_t id, Detector& d);
200 Char_t Id() const { return fId; }
201 UShort_t DetectorId() { return fParent.Id(); }
202 Top& GetTop() { return fParent.GetTop(); }
203 Detector& GetDetector() { return GetParent(); }
204 Detector& GetParent() { return fParent; }
205 Sector& GetOrAdd(UShort_t id);
206 void Fill(UShort_t sec, UShort_t str, Double_t v);
207 TGListTreeItem& GetEntry() { return fEntry; }
208 protected:
209 Detector& fParent;
210 Char_t fId;
211 TObjArray fChildren;
212 TGListTreeItem& fEntry;
213 };
214
215 //__________________________________________________________________
216 struct Sector : public Element
217 {
218 Sector(UShort_t id, Ring& r);
219 UShort_t Id() const { return fId; }
220 UShort_t DetectorId() { return fParent.DetectorId(); }
221 Char_t RingId() { return fParent.Id(); }
222 Top& GetTop() { return fParent.GetTop(); }
223 Detector& GetDetector() { return fParent.GetDetector(); }
224 Ring& GetRing() { return fParent; }
225 Ring& GetParent() { return fParent; }
226 Strip& GetOrAdd(UShort_t id);
227 void Fill(UShort_t str, Double_t v);
228 TGListTreeItem& GetEntry() { return fEntry; }
229 protected:
230 Ring& fParent;
231 UShort_t fId;
232 TObjArray fChildren;
233 TGListTreeItem& fEntry;
234 };
235
236 //__________________________________________________________________
237 struct Strip : public Element
238 {
239 Strip(UShort_t id, Sector& s);
240 UShort_t Id() const { return fId; }
241 UShort_t DetectorId() { return fParent.DetectorId(); }
242 Char_t RingId() { return fParent.RingId(); }
243 UShort_t SectorId() { return fParent.Id(); }
244 Top& GetTop() { return fParent.GetTop(); }
245 Detector& GetDetector() { return fParent.GetDetector(); }
246 Ring& GetRing() { return fParent.GetRing(); }
247 Sector& GetSector() { return fParent; }
248 Sector& GetParent() { return fParent; }
249 void Fill(Double_t v);
250 TGListTreeItem& GetEntry() { return fEntry; }
251 protected:
252 Sector& fParent;
253 UShort_t fId;
254 TGListTreeItem& fEntry;
255 };
256
257 //==================================================================
258 void Element::MakeHistograms(TAxis* axis)
259 {
260 if (fFull) return;
261 if (axis->IsVariableBinSize()) {
262 fFull = new TH1F(Form("f_%s", GetName()), Form("%s spectra", GetName()),
263 axis->GetXbins()->fN, axis->GetXbins()->fArray);
264 fCut = new TH1F(Form("c_%s", GetName()),
265 Form("%s restricted spectra", GetName()),
266 axis->GetXbins()->fN, axis->GetXbins()->fArray);
267 }
268 else {
269 fFull = new TH1F(Form("f_%s", GetName()), Form("%s spectra", GetName()),
270 axis->GetNbins(), axis->GetXmin(), axis->GetXmax());
271 fCut = new TH1F(Form("c_%s", GetName()),
272 Form("%s restricted spectra", GetName()),
273 axis->GetNbins(), axis->GetXmin(), axis->GetXmax());
274 }
275 fFull->SetFillColor(kRed);
276 fFull->SetFillStyle(3001);
277 fCut->SetFillColor(kBlue);
278 fCut->SetFillStyle(3001);
279 }
280 //__________________________________________________________________
281 void Element::DoFill(Double_t v)
282 {
283 if (fFull) fFull->Fill(v);
284 }
285 //__________________________________________________________________
286 void Element::Draw(Option_t* option, Double_t l, Double_t h)
287 {
288 if (!fFull) return;
289 if (fFull->GetMinimum() < 0) gPad->SetLogy(kFALSE);
290 fFull->Draw(option);
291 Double_t lx = fFull->GetXaxis()->GetXmin();
292 Double_t hx = fFull->GetXaxis()->GetXmax();
293 Double_t rr = (hx-lx);
294 Double_t ll = rr * l + lx;
295 Double_t hh = rr * h + lx;
296 for (Int_t i = 1; i <= fFull->GetNbinsX(); i++) {
297 if (fFull->GetBinCenter(i) <= ll ||
298 fFull->GetBinCenter(i) > hh) {
299 fCut->SetBinContent(i, 0);
300 continue;
301 }
302 fCut->SetBinContent(i, fFull->GetBinContent(i));
303 }
304 fCut->Draw(Form("%s same", option));
305 }
306 //==================================================================
307 Top::Top(TGCompositeFrame& frame, TCanvas* canvas)
308 : Element("All", "Everything"),
309 fHints(kLHintsExpandX|kLHintsExpandY,3, 3, 3, 3),
310 fContainer(&frame, 200, 350),
311 fList(&fContainer, kHorizontalFrame),
312 fChildren(0),
313 fCurrentEntry(0),
314 fCanvas(canvas),
315 fHist1DIcon(gClient->GetPicture("h1_t.xpm")),
316 fHist2DIcon(gClient->GetPicture("h2_t.xpm")),
317 fHist3DIcon(gClient->GetPicture("h3_t.xpm")),
318 fGraphIcon(gClient->GetPicture("graph.xpm")),
319 fEntry(*(fList.AddItem(0, GetName(), this)))
320 {
321 fContainer.AddFrame(&fList, &fHints);
322 frame.AddFrame(&fContainer, &fHints);
323
324 fList.Connect("Clicked(TGListTreeItem*,Int_t)", "Spectra::Top", this,
325 "HandleEntry(TGListTreeItem*,Int_t)");
326 fList.Connect("KeyPressed(TGListTreeItem*,ULong_t,ULong_t)",
327 "Spectra::Top", this,
328 "HandleKey(TGListTreeItem*,UInt_t,UInt_t)");
329 fList.Connect("ReturnPressed(TGListTreeItem*)", "Spectra::Top", this,
330 "HandleReturn(TGListTreeItem*)");
331 }
332 //____________________________________________________________________
333 void
334 Top::SetAxis(TAxis* axis)
335 {
336 fAxis = axis;
337 MakeHistograms(axis);
338 }
339 //____________________________________________________________________
340 void
341 Top::ClearCanvas()
342 {
343 if (!fCanvas) return;
344 fCanvas->Clear();
345 }
346
347 //____________________________________________________________________
348 void
349 Top::ClearList()
350 {
351 fList.DeleteItem(fList.GetFirstItem());
352 UpdateList();
353 }
354
355
356 //____________________________________________________________________
357 void
358 Top::HandleReturn(TGListTreeItem * f)
359 {
360
361 if (!f) {
362 fList.UnselectAll(kFALSE);
363 fList.SetSelected(0);
364 return;
365 }
366 fList.ToggleItem(f);
367 UpdateList();
368 }
369
370
371 //____________________________________________________________________
372 void
373 Top::HandleKey(TGListTreeItem * f, UInt_t keysym, UInt_t /*mask*/)
374 {
375 if (!f) {
376 fList.UnselectAll(kFALSE);
377 fList.SetSelected(0);
378 return;
379 }
380 TGListTreeItem* next = 0;
381 switch (keysym) {
382 case kKey_Up:
383 next = f->GetPrevSibling();
384 if (!next) {
385 next = f->GetParent();
386 if (next) fList.CloseItem(next);
387 }
388 break;
389 case kKey_Down:
390 next = f->GetNextSibling();
391 if (!next && f->GetParent()) {
392 next = f->GetParent()->GetNextSibling();
393 fList.CloseItem(f->GetParent());
394 }
395 break;
396 case kKey_Left:
397 next = f->GetParent();
398 if (next) fList.CloseItem(next);
399 break;
400 case kKey_Right:
401 next = f->GetFirstChild();
402 if (next) fList.OpenItem(f);
403 break;
404 case kKey_PageUp:
405 fList.PageUp(kTRUE);
406 next = fList.GetSelected();
407 break;
408 case kKey_PageDown:
409 fList.PageDown(kTRUE);
410 next = fList.GetSelected();
411 break;
412 }
413 if (next) gClient->NeedRedraw(&fList);
414 if (next && next != f) {
415 fList.ClearHighlighted();
416 fList.SetSelected(next);
417 HandleEntry(next,0);
418 }
419 }
420
421 //____________________________________________________________________
422 void
423 Top::HandleEntry(TGListTreeItem* entry, Int_t /*id*/)
424 {
425 TGListTreeItem* old = fCurrentEntry;
426 if (entry) {
427 if (!entry->GetUserData()) return;
428 fCurrentEntry = entry;
429 }
430 else {
431 fCurrentEntry = 0;
432 ClearCanvas();
433 }
434 if (old != fCurrentEntry && fCanvas) fCanvas->cd();
435 SelectionChanged();
436 }
437
438 //____________________________________________________________________
439 void
440 Top::UpdateList()
441 {
442 gClient->NeedRedraw(&fList);
443 }
444
445 //____________________________________________________________________
446 void
447 Top::UpdateCanvas()
448 {
449 if (!fCanvas) return;
450 fCanvas->Modified();
451 fCanvas->Update();
452 fCanvas->cd();
453 }
454 //____________________________________________________________________
455 TObject* Top::Current() const
456 {
457 if (!fCurrentEntry) return 0;
458 if (!fCurrentEntry->GetUserData()) return 0;
459 return static_cast<TObject*>(fCurrentEntry->GetUserData());
460 }
461
462 //__________________________________________________________________
463 Detector& Top::GetOrAdd(UShort_t id)
464 {
465 Int_t idx = id - 1;
466 Detector* d = 0;
467 if (fChildren.GetEntriesFast() <= idx ||
468 !(d = static_cast<Detector*>(fChildren.At(idx)))) {
469 d = new Detector(id, *this);
470 fChildren.AddAtAndExpand(d, idx);
471 // fList.SortChildren(&fEntry);
472 }
473 return *d;
474 }
475 //__________________________________________________________________
476 void Top::Fill(UShort_t det, Char_t ring,
477 UShort_t sec, UShort_t str, Double_t v)
478 {
479 Detector& d = GetOrAdd(det);
480 d.Fill(ring, sec, str, v);
481 DoFill(v);
482 }
483 //==================================================================
484 Detector::Detector(UShort_t det, Top& tree)
485 : Element(Form("FMD%d", det), "FMD Sub-detector"),
486 fId(det),
487 fParent(tree),
488 fChildren(0),
489 fEntry(*(tree.GetList().AddItem(&(tree.GetEntry()), GetName())))
490 {
491 fEntry.SetUserData(this);
492 if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis());
493 }
494 //__________________________________________________________________
495 Ring& Detector::GetOrAdd(Char_t id)
496 {
497 Int_t idx = (id == 'I' || id == 'i') ? 0 : 1;
498 Ring* r = 0;;
499 if (fChildren.GetEntriesFast() <= idx ||
500 !(r = static_cast<Ring*>(fChildren.At(idx)))) {
501 r = new Ring(id, *this);
502 fChildren.AddAtAndExpand(r, idx);
503 // GetTop().GetList().SortChildren(&fEntry);
504 }
505 return *r;
506 }
507 //__________________________________________________________________
508 void Detector::Fill(Char_t ring, UShort_t sec, UShort_t str, Double_t v)
509 {
510 Ring& r = GetOrAdd(ring);
511 r.Fill(sec, str, v);
512 DoFill(v);
513 }
514 //==================================================================
515 Ring::Ring(Char_t id, Detector& d)
516 : Element(Form("FMD%d%c", d.Id(), id), "FMD Ring"),
517 fParent(d),
518 fId(id),
519 fChildren(0),
520 fEntry(*(GetTop().GetList().AddItem(&(d.GetEntry()), GetName(), this)))
521 {
522 if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis());
523 }
524 //__________________________________________________________________
525 Sector& Ring::GetOrAdd(UShort_t id)
526 {
527 Sector* s = 0;
528 if (fChildren.GetEntriesFast() <= id ||
529 !(s = static_cast<Sector*>(fChildren.At(id)))) {
530 s = new Sector(id, *this);
531 fChildren.AddAtAndExpand(s, id);
532 // GetTop().GetList().SortChildren(&fEntry);
533 }
534 return *s;
535 }
536 //__________________________________________________________________
537 void Ring::Fill(UShort_t sec, UShort_t str, Double_t v)
538 {
539 Sector& s = GetOrAdd(sec);
540 s.Fill(str, v);
541 DoFill(v);
542 }
543 //==================================================================
544 Sector::Sector(UShort_t id, Ring& r)
545 : Element(Form("FMD%d%c_%02d", r.DetectorId(), r.Id(), id), "FMD Sector"),
546 fParent(r),
547 fId(id),
548 fChildren(0),
549 fEntry(*(GetTop().GetList().AddItem(&(r.GetEntry()), GetName(), this)))
550 {
551 if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis());
552 }
553 //__________________________________________________________________
554 Strip& Sector::GetOrAdd(UShort_t id)
555 {
556 Strip* s = 0;
557 if (fChildren.GetEntriesFast() <= id ||
558 !(s = static_cast<Strip*>(fChildren.At(id)))) {
559 s = new Strip(id, *this);
560 fChildren.AddAtAndExpand(s, id);
561 // GetTop().GetList().SortChildren(&fEntry);
562 }
563 return *s;
564 }
565 //__________________________________________________________________
566 void Sector::Fill(UShort_t str, Double_t v)
567 {
568 Strip& s = GetOrAdd(str);
569 s.Fill(v);
570 DoFill(v);
571 }
572 //==================================================================
573 Strip::Strip(UShort_t id, Sector& s)
574 : Element(Form("FMD%d%c_%02d_%03d", s.DetectorId(), s.RingId(),
575 s.Id(), id), "FMD Strip"),
576 fParent(s),
577 fId(id),
578 fEntry(*(GetTop().GetList().AddItem(&(s.GetEntry()), GetName(), this)))
579 {
580 fEntry.SetPictures(GetTop().GetH1Pic(), GetTop().GetH1Pic());
581 if (GetTop().GetAxis()) MakeHistograms(GetTop().GetAxis());
582 }
583 //__________________________________________________________________
584 void Strip::Fill(Double_t v)
585 {
586 DoFill(v);
587 }
588}
589
590
591//====================================================================
592class SpectraMonitor : public AliFMDPattern
593{
594private:
595 TGMainFrame fSelector;
596 Spectra::Top fTop;
597public:
598 SpectraMonitor()
599 : AliFMDPattern(),
600 fSelector(gClient->GetRoot(), 100, 100),
601 fTop(fSelector, fAux)
602 {
603 AddLoad(AliFMDInput::kRaw);
604 SetName("RAW");
605 SetTitle("RAW");
606
607 fTop.Connect("SelectionChanged()", "SpectraMonitor", this, "HandleDraw()");
608
609 fSelector.MapSubwindows();
610 fSelector.Resize(fSelector.GetDefaultSize());
611 fSelector.MapWindow();
612 }
613 // void SetAxis(TAxis* axis) { fTop.SetAxis(axis); }
614 Bool_t HandleDraw()
615 {
616 TObject* user = fTop.Current();
617 if (!user) return kFALSE;
618 if (!user->InheritsFrom(Spectra::Element::Class())) {
619 Warning("HandleDraw", "%s does not inherit from Spectra::Element",
620 user->GetName());
621 return kFALSE;
622 }
623 fAux->cd();
624 Spectra::Element* e = static_cast<Spectra::Element*>(user);
625 e->Draw("hist", fSlider->GetMinimum(), fSlider->GetMaximum());
626 fAux->Modified();
627 fAux->Update();
628 fAux->cd();
629 return kTRUE;
630 }
631 void MakeAux()
632 {
633 AliFMDPattern::MakeAux();
634 if (!fAux) return;
635 fTop.SetAxis(fSpec->GetXaxis());
636 }
637 void DrawAux()
638 {
639 // Draw in the Aux the canvas
640 // For example draw the spectra
641 // or such stuff
642 if (fTop.Current() != &fTop && HandleDraw()) return;
643 AliFMDPattern::DrawAux();
644 }
645 Bool_t ProcessHit(AliFMDHit* hit, TParticle* p)
646 {
647 fTop.Fill(hit->Detector(),
648 hit->Ring(),
649 hit->Sector(),
650 hit->Strip(),
651 hit->Edep());
652 return AliFMDPattern::ProcessHit(hit, p);
653 }
654 Bool_t ProcessDigit(AliFMDDigit* digit)
655 {
656 fTop.Fill(digit->Detector(),
657 digit->Ring(),
658 digit->Sector(),
659 digit->Strip(),
660 digit->Counts());
661 return AliFMDDisplay::ProcessDigit(digit);
662 }
663 Bool_t ProcessSDigit(AliFMDSDigit* sdigit)
664 {
665 fTop.Fill(sdigit->Detector(),
666 sdigit->Ring(),
667 sdigit->Sector(),
668 sdigit->Strip(),
669 sdigit->Counts());
670 return AliFMDDisplay::ProcessSDigit(sdigit);
671 }
672 Bool_t ProcessRawDigit(AliFMDDigit* digit)
673 {
674 return ProcessDigit(digit);
675 }
676 Bool_t ProcessRecPoint(AliFMDRecPoint* recpoint)
677 {
678 fTop.Fill(recpoint->Detector(),
679 recpoint->Ring(),
680 recpoint->Sector(),
681 recpoint->Strip(),
682 recpoint->Particles());
683 return AliFMDDisplay::ProcessRecPoint(recpoint);
684 }
685 Bool_t ProcessESD(UShort_t det, Char_t rng, UShort_t sec, UShort_t str,
686 Float_t x, Float_t mult)
687 {
688 fTop.Fill(det, rng, sec, str, mult);
689 return AliFMDDisplay::ProcessESD(det, rng, sec, str, x, mult);
690 }
691};
692
693void
22ccadbc 694RunSpectraMonitor(const char* file="",
695 Int_t runno=0,
696 const char* cdbSrc="local://$ALICE_ROOT",
697 UShort_t over=0)
2eddac03 698{
699 // AliLog::SetModuleDebugLevel("FMD", 8);
22ccadbc 700 TString fname(file);
701 if (fname.CompareTo("help", TString::kIgnoreCase) == 0) {
702 std::cout << "Usage: RunSpectraMonitor(<src>[,<runno>[,<cdb>[,<over>]]])\n"
703 << "\n"
704 << "Where:\n\n"
705 << " <src> Is a data source (online, file)\n"
706 << " <runno> Is the (optional) run number\n"
707 << " <cdb> Is the (optional) CDB storage\n"
708 << " <over> Is the (optional) over sampling rate\n\n"
709 << "Defaults are <runno>=0 and cdb=\"local://$ALICE_ROOT\"\n"
710 << "<over> allows one to override the CDB setting. Default\n"
711 << "is to use the CDB setting.\n\n"
712 << "Note: This script _must_ be compiled with ACLic"
713 << std::endl;
714 return;
715 }
2eddac03 716 AliCDBManager* cdb = AliCDBManager::Instance();
22ccadbc 717 cdb->SetDefaultStorage(cdbSrc);
718 cdb->SetRun(runno);
2eddac03 719 UInt_t what = (AliFMDParameters::kPulseGain |
720 AliFMDParameters::kPedestal |
721 AliFMDParameters::kDeadMap |
722 AliFMDParameters::kZeroSuppression|
723 AliFMDParameters::kAltroMap |
724 AliFMDParameters::kStripRange);
725 if (over != 0) what |= AliFMDParameters::kSampleRate;
726 AliFMDParameters::Instance()->Init(kFALSE, what);
727 if (over != 0) AliFMDParameters::Instance()->SetSampleRate(over);
728
729 SpectraMonitor* d = new SpectraMonitor;
730 d->AddLoad(AliFMDInput::kRaw);
731 d->SetRawFile(file);
732 d->Run();
733}
7af3df7f 734#endif
2eddac03 735
736
737
738//____________________________________________________________________
739//
740// EOF
741//