9 #include <TRootEmbeddedCanvas.h>
11 #include <TGComboBox.h>
15 #include <TGButtonGroup.h>
16 #include <TGNumberEntry.h>
17 #include <TGListBox.h>
18 #include <TObjArray.h>
20 #include <TClonesArray.h>
21 #include <TSystemDirectory.h>
24 #include <TSpectrum.h>
32 #include <TApplication.h>
35 #include "TMethodCall.h"
58 : TGMainFrame(p, w, h, opt)
85 UInt_t mainx = xsize1 + xsize2;
88 gStyle->SetFrameBorderMode(1);
89 gStyle->SetFrameBorderSize(1);
90 gStyle->SetOptStat(0);
92 TGVerticalFrame* f1 =
new TGVerticalFrame(
this,xsize1,mainy,kVerticalFrame);
93 TGVerticalFrame* f2 =
new TGVerticalFrame(
this,xsize2,mainy,kVerticalFrame);
94 this->AddFrame(f1,
new TGLayoutHints(kLHintsLeft | kLHintsExpandY,5,5,5,5));
95 this->AddFrame(f2,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
96 TGVerticalFrame* f20 =
new TGVerticalFrame(f2,xsize2,mainy,kVerticalFrame);
97 f2->AddFrame(f20,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
98 TGHorizontalFrame* f21 =
new TGHorizontalFrame(f2,xsize2,80,kHorizontalFrame);
99 f2->AddFrame(f21,
new TGLayoutHints(kLHintsBottom ,5,5,5,5));
107 SetWindowName(
"HARPO Noise Monitor");
108 MoveResize(0,0,mainx,mainy);
132 printf (
"Int ERROR exiting ...\n");
136 printf (
"Initialized\n");
141 hAllCh[0] =
new TH1F(
"hAllChX",
";time [tb]",508,0,508);
142 h2D[0] =
new TH2F(
"h2DX",
";time [tb]; channel",508,0,508,304,0,304);
145 hFFTAllCh[0] =
new TH1F(
"hFFTAllChX",
";freq []",508,0,508);
146 hFFT2D[0] =
new TH2F(
"hFFT2DX",
";freq []; channel",508,0,508,304,0,304);
149 hPedAllCh[0] =
new TH1F(
"hPedAllChX",
";pedesteal [ADC]",100,-50,50);
150 hPed2D[0] =
new TH2F(
"hPed2DX",
";pedesteal [ADC]; channel",500,-250,250,304,0,304);
156 hAllCh[1] =
new TH1F(
"hAllChY",
";time [tb]",508,0,508);
157 h2D[1] =
new TH2F(
"h2DY",
";time [tb]; channel",508,0,508,304,0,304);
160 hFFTAllCh[1] =
new TH1F(
"hFFTAllChY",
";freq []",508,0,508);
161 hFFT2D[1] =
new TH2F(
"hFFT2DY",
";freq []; channel",508,0,508,304,0,304);
164 hPedAllCh[1] =
new TH1F(
"hPedAllChY",
";pedestal - 250 [ADC]",100,-50,50);
165 hPed2D[1] =
new TH2F(
"hPed2DY",
";pedestal - 250 [ADC]; channel",500,-250,250,304,0,304);
167 hNoise[0] =
new TH1F(
"h1EvNoiseX",
";noise [ADC]",500,-50,50);
168 hNoise2D[0] =
new TH2F(
"h1EvNoise2DX",
";noise [ADC]; channel",500,-50,50,304,0,304);
169 hNoise[1] =
new TH1F(
"h1EvNoiseY",
";noise [ADC]",500,-50,50);
170 hNoise2D[1] =
new TH2F(
"h1EvNoise2DY",
";noise [ADC]; channel",500,-50,50,304,0,304);
197 gApplication->Terminate(0);
207 UInt_t xsize2 = f20->GetWidth();
208 UInt_t mainy = f20->GetHeight();
212 f20->AddFrame(
fEventLabel,
new TGLayoutHints(kLHintsExpandX,5,5,5,5));
214 TGTab* fTab =
new TGTab(f20, xsize2, mainy);
216 TGCompositeFrame *tf = fTab->AddTab(
"Current Event");
217 ecTabEvent =
new TRootEmbeddedCanvas(
"ecTabEvent",tf,xsize2,mainy);
218 tf->AddFrame(
ecTabEvent,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
220 tf = fTab->AddTab(
"Cumulated data");
221 ecTabCumul =
new TRootEmbeddedCanvas(
"ecTabCumul",tf,xsize2,mainy);
222 tf->AddFrame(
ecTabCumul,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
232 f20->AddFrame(fTab,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5));
239 UInt_t xsize2 = f21->GetWidth();
240 UInt_t ysize = f21->GetHeight();
241 TGVerticalFrame* f211 =
new TGVerticalFrame(f21,xsize2/4,ysize,kVerticalFrame);
242 TGVerticalFrame* f212 =
new TGVerticalFrame(f21,xsize2/4,ysize,kVerticalFrame);
243 TGVerticalFrame* f213 =
new TGVerticalFrame(f21,xsize2/4,ysize,kVerticalFrame);
244 TGVerticalFrame* f214 =
new TGVerticalFrame(f21,xsize2/4,ysize,kVerticalFrame);
245 TGLayoutHints* fLayout3 =
new TGLayoutHints(kLHintsBottom ,5,5,5,5);
246 f21->AddFrame(f211,fLayout3);
247 f21->AddFrame(f212,fLayout3);
248 f21->AddFrame(f213,
new TGLayoutHints(kLHintsCenterX | kLHintsCenterY,5,5,5,5));
249 f21->AddFrame(f214,fLayout3);
256 UInt_t xsize1 = f1->GetWidth();
258 TGLayoutHints* fLayout1 =
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5);
260 TGLayoutHints* fLayout2 =
new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5);
264 TGHorizontalFrame* autorefreshFrame =
new TGHorizontalFrame(f1,xsize1,ysize,kHorizontalFrame);
265 TGLabel* fDelayLabel =
new TGLabel(f1,
"Delay [s]");
273 autorefreshFrame->AddFrame(fDelayLabel,fLayout2);
290 ecSideSummary =
new TRootEmbeddedCanvas(
"ecSideSummary",f1,xsize1,300);
296 f1->AddFrame(autorefreshFrame,fLayout2);
363 Info(
"DisplayEvent",
"%p",event);
365 if(event == 0)
return;
395 TLatex* latex =
new TLatex();
396 latex->SetTextFont(132);
397 latex->SetTextAlign(12);
398 latex->SetTextSize(0.08);
403 for(Int_t ndet=0;ndet<2;ndet++) {
409 Int_t color = ndet? kRed : kBlue;
410 latex->SetTextColor(color);
413 TH1F* h1EvAllCh =
new TH1F(
"h1EvAllCh",
";time [tb]",508,0,508);
414 TH2F* h1Ev2D =
new TH2F(
"h1Ev2D",
";time [tb]; channel",508,0,508,304,0,304);
417 TH1F* h1EvFFTAllCh =
new TH1F(
"h1EvFFTAllCh",
";freq []",508,0,508);
418 TH2F* h1EvFFT2D =
new TH2F(
"h1EvFFT2D",
";freq []; channel",508,0,508,304,0,304);
421 TH1F* h1EvPedAllCh =
new TH1F(
"h1EvPedAllCh",
";pedesteal [ADC]",100,-50,50);
422 TH2F* h1EvPed2D =
new TH2F(
"h1EvPed2D",
";pedesteal [ADC]; channel",500,-250,250,304,0,304);
425 TH1F* h1EvNoise =
new TH1F(
"h1EvNoise",
";noise [ADC]",500,-50,50);
426 TH2F* h1EvNoise2D =
new TH2F(
"h1EvNoise2D",
";noise [ADC]; channel",500,-250,250,304,0,304);
430 TH1F* hTmp =
new TH1F(
"hTmp",
"",508,0,508);
431 for(Int_t i=1;i<
NADC;i++){
434 for(Int_t j=0;j<
NCHAN;j++){
437 h2D[ndet]->SetBinContent(i+1,j+1,
h2D[ndet]->GetBinContent(i+1,j+1)+q);
438 h1Ev2D->SetBinContent(i+1,j+1,q);
445 hPed2D[ndet]->Fill(q-250,j);
446 h1EvPed2D->Fill(q-250,j);
450 hAllCh[ndet]->SetBinContent(i+1,
hAllCh[ndet]->GetBinContent(i+1)+qTotT/nChan);
451 h1EvAllCh->SetBinContent(i+1,qTotT/nChan);
452 hPedAllCh[ndet]->Fill(qTotT/nChan - 250);
453 h1EvPedAllCh->Fill(qTotT/nChan - 250);
454 hTmp->SetBinContent(i+1,qTotT/nChan);
455 for(Int_t j=0;j<nChan;j++){
457 hNoise[ndet]->Fill(q - qTotT/nChan);
458 hNoise2D[ndet]->Fill(j,q - qTotT/nChan);
459 h1EvNoise->Fill(q - qTotT/nChan);
460 h1EvNoise2D->Fill(j,q - qTotT/nChan);
464 hm1 = hTmp->FFT(hm1,
"MAG");
465 for(Int_t i=2;i<512;i++){
466 hFFTAllCh[ndet]->SetBinContent(i+1,
hFFTAllCh[ndet]->GetBinContent(i+1)+hm1->GetBinContent(i+1));
467 h1EvFFTAllCh->SetBinContent(i+1,hm1->GetBinContent(i+1));
472 for(Int_t j=0;j<
NCHAN;j++){
473 TH1F* hTmp =
new TH1F(
"hTmp",
"",508,0,508);
474 for(Int_t i=0;i<
NADC;i++){
476 hTmp->SetBinContent(i+1,q);
480 hm = hTmp->FFT(hm,
"MAG");
481 for(Int_t i=2;i<512;i++){
482 hFFT2D[ndet]->SetBinContent(i+1,j+1,
hFFT2D[ndet]->GetBinContent(i+1,j+1)+hm->GetBinContent(i+1));
483 h1EvFFT2D->SetBinContent(i+1,j+1,hm->GetBinContent(i+1));
495 hFFTAllCh[ndet]->GetXaxis()->SetRangeUser(-1,255);
496 hFFT2D[ndet]->GetXaxis()->SetRangeUser(-1,255);
498 h1EvFFTAllCh->GetXaxis()->SetRangeUser(-1,255);
499 h1EvFFT2D->GetXaxis()->SetRangeUser(-1,255);
555 h1EvAllCh->SetLineColor(color);
556 hAllCh[ndet]->SetLineColor(color);
557 h1EvFFTAllCh->SetLineColor(color);
559 h1EvPedAllCh->SetLineColor(color);
561 h1EvNoise->SetLineColor(color+2);
562 hNoise[ndet]->SetLineColor(color+2);
575 h2D[ndet]->DrawNormalized(
"colz",
h2D[ndet]->Integral()/
fNevt);
585 ymax = hDummy->GetMaximum();
587 TSpectrum* spectrum =
new TSpectrum(10,0.5);
588 spectrum->Search(hDummy,3,
"goff",0.3);
589 Int_t npeaks = spectrum->GetNPeaks();
590 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
591 Double_t *Xpeak = spectrum->GetPositionX();
592 Double_t *Ypeak = spectrum->GetPositionY();
594 Float_t *Xpeak = spectrum->GetPositionX();
595 Float_t *Ypeak = spectrum->GetPositionY();
597 for(Int_t i = 0; i<npeaks; i++)
598 cout <<
"*** " << Xpeak[i] <<
", " << Ypeak[i] << endl;
599 latex->DrawLatex(80,(0.8 - 0.2*ndet)*ymax,Form(
"%g %g",Ypeak[0], Ypeak[1]));
610 hDummy =
hPedAllCh[ndet]->DrawNormalized(
"same", 1);
612 hDummy =
hPedAllCh[ndet]->DrawNormalized(
"", 1);
613 hDummy =
hNoise[ndet]->DrawNormalized(
"same", 1);
614 ymax = hDummy->GetMaximum();
617 latex->DrawLatex(20,(0.8 - 0.2*ndet)*ymax,Form(
"FWHM = %g",
FindFWHM(
hPedAllCh[ndet])));
625 h1EvAllCh->DrawCopy(
"same");
627 h1EvAllCh->DrawCopy();
629 h1Ev2D->DrawCopy(
"colz");
635 hDummy = h1EvFFTAllCh->DrawCopy(
"same");
637 hDummy = h1EvFFTAllCh->DrawCopy();
638 ymax = hDummy->GetMaximum();
639 spectrum =
new TSpectrum(10,0.5);
640 spectrum->Search(hDummy,3,
"goff",0.3);
641 npeaks = spectrum->GetNPeaks();
642 Xpeak = spectrum->GetPositionX();
643 Ypeak = spectrum->GetPositionY();
644 for(Int_t i = 0; i<npeaks; i++)
645 cout <<
"*** " << Xpeak[i] <<
", " << Ypeak[i] << endl;
646 latex->DrawLatex(80,(0.8 - 0.2*ndet)*ymax,Form(
"%g %g",Ypeak[0], Ypeak[1]));
651 h1EvFFT2D->DrawCopy(
"colz");
658 hDummy = h1EvPedAllCh->DrawNormalized(
"same");
660 hDummy = h1EvPedAllCh->DrawNormalized();
661 hDummy = h1EvNoise->DrawNormalized(
"same", 1);
663 ymax = hDummy->GetMaximum();
664 latex->DrawLatex(20,(0.8 - 0.2*ndet)*ymax,Form(
"FWHM = %g",
FindFWHM(h1EvPedAllCh)));
666 h1EvPed2D->DrawCopy(
"colz");
684 h1EvFFTAllCh->Delete();
687 h1EvPedAllCh->Delete();
691 h1EvNoise2D->Delete();
697 std::cout <<
"No Data Map for plane " << std::endl;
755 for(Int_t i = 0; i<nEvents; i++){
800 switch(GET_MSG(msg)){
802 switch(GET_SUBMSG(msg)){
817 default: cout <<
"Unknown button" << endl;
break;
897 gStyle->SetTitleH(0.08);
898 gStyle->SetTitleW(0.78);
899 gStyle->SetTitleX(0.16);
900 gStyle->SetTitleY(0.99);
901 gStyle->SetTitleFont(132,
" ");
902 gStyle->SetTitleSize(0.09,
" ");
903 hist->SetTitleFont(132);
904 hist->SetTitleSize(0.09);
905 hist->GetXaxis()->SetTitleSize(0.07);
906 hist->GetYaxis()->SetTitleSize(0.07);
907 hist->GetXaxis()->SetTitleOffset(0.7);
908 hist->GetYaxis()->SetTitleOffset(0.7);
909 hist->GetXaxis()->SetTitleFont(132);
910 hist->GetYaxis()->SetTitleFont(132);
911 hist->GetXaxis()->SetLabelFont(132);
912 hist->GetYaxis()->SetLabelFont(132);
913 hist->GetXaxis()->SetLabelSize(0.06);
914 hist->GetYaxis()->SetLabelSize(0.06);
917 c1->SetLeftMargin(0.12);
918 c1->SetRightMargin(0.02);
919 c1->SetBottomMargin(0.12);
920 c1->SetTopMargin(0.09);
929 gStyle->SetTitleH(0.08);
930 gStyle->SetTitleW(0.78);
931 gStyle->SetTitleX(0.16);
932 gStyle->SetTitleY(0.99);
934 gStyle->SetTitleW(0.68);
935 gStyle->SetTitleFont(132,
" ");
936 gStyle->SetTitleSize(0.09,
" ");
938 hist->GetXaxis()->SetTitleSize(0.07);
939 hist->GetYaxis()->SetTitleSize(0.07);
940 hist->GetZaxis()->SetTitleSize(0.07);
941 hist->GetXaxis()->SetTitleOffset(0.7);
942 hist->GetYaxis()->SetTitleOffset(0.8);
943 hist->GetZaxis()->SetTitleOffset(0.8);
944 hist->GetXaxis()->SetTitleFont(132);
945 hist->GetYaxis()->SetTitleFont(132);
946 hist->GetZaxis()->SetTitleFont(132);
947 hist->GetXaxis()->SetLabelFont(132);
948 hist->GetYaxis()->SetLabelFont(132);
949 hist->GetZaxis()->SetLabelFont(132);
950 hist->GetXaxis()->SetLabelSize(0.06);
951 hist->GetYaxis()->SetLabelSize(0.06);
952 hist->GetZaxis()->SetLabelSize(0.06);
955 c1->SetLeftMargin(0.12);
957 c1->SetRightMargin(0.02);
959 c1->SetRightMargin(0.12);
960 c1->SetBottomMargin(0.12);
961 c1->SetTopMargin(0.09);
964 hist->DrawCopy(
"colz");
975 Int_t maxbin = h->GetMaximumBin();
976 Double_t max = h->GetBinContent(maxbin);
978 Int_t nbins = h->GetXaxis()->GetNbins();
979 Double_t x1 = 0, x2 = 0;
980 for(Int_t bin = 1; bin<=nbins; bin++){
981 if(h->GetBinContent(bin)<max*fact){
983 x1 = h->GetXaxis()->GetBinCenter(bin);
985 if(h->GetBinContent(bin)>=max*fact)
986 x2 = h->GetXaxis()->GetBinCenter(bin);
void BuildInfoFrame(TGHorizontalFrame *f)
Monitor noise in non-zerosuppressed data.
TRootEmbeddedCanvas * ecSideSummary
Long_t Find(Long_t eventNo)
Find raw event by event number.
Double_t FindFWHM(TH1F *h, Double_t fact=0.2)
TGTextButton * fNextEvent
void AddAnalyseFunction(HarpoAnalyse *func)
TGTextButton * fPrevEvent
HarpoAnalyseNoiseMonitor * fAna
TRootEmbeddedCanvas * ecTabEvent
Double_t GetData(Int_t i, Int_t j)
Set/Get Data Cell.
Bool_t Init(hReadMode mode=hSyncTime)
TRootEmbeddedCanvas * ecTabCumul
void BuildDisplayFrame(TGVerticalFrame *f)
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
A class which instantiate the real top level reader.
TGTextButton * fDisplayEvent
Int_t fCurrentEventNumber
void MakeNice2dHisto(TH2 *hist, TVirtualPad *c1, Bool_t colz=kTRUE)
TGNumberEntry * fChooseDelay
TGTextButton * fAutoRefreshButton
void LoopEvents(Int_t nEvents=1)
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
void MakeNice1dHisto(TH1 *hist, TVirtualPad *c1, const char *opt="")
virtual void CloseWindow()
void SetListOfRuns(TGComboBox *box, const char *dirname)
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
TGTextButton * fDisplayBox
TGNumberEntry * fChooseEvent
TGNumberEntry * fChooseNEvents
HarpoNoiseMonitorGui(const TGWindow *p, UInt_t w, UInt_t h, UInt_t opt, int argc, char **argv)
void print() const
Read config file in libconfig format.
A class store HARPO row event data and header. Provide access metods to the row event data...
void BuildButtonsFrame(TGVerticalFrame *f)
static hReaderType gHReaderType
Reader Type.
A class which keeps track of the entire configuration of the analysis.
R__EXTERN HarpoDetSet * gHDetSet