124 if (gROOT->IsBatch())
126 printf(
" *%-s::ExplorePanel* ExplorePanel() can not be invoked in batch mode. \n",ClassName());
140 printf(
" ********************************************************************************* \n");
141 printf(
" * Welcome to the %-s GUI facility to explore RNO-G event data *\n",ClassName());
142 printf(
" * After window closure, the GUI panel can be re-opened via invoking ShowPanel() * \n");
143 printf(
" ********************************************************************************* \n");
147 fExpPanel=
new TGMainFrame(gClient->GetRoot());
149 fExpPanel->Connect(
"CloseWindow()",ClassName(),
this,
"ExpClose()");
151 TGCompositeFrame* frames[4]={0,0,0,0};
152 TGLayoutHints* layouts[4]={0,0,0,0};
155 frames[0]=
new TGCompositeFrame(
fExpPanel,1,1,kHorizontalFrame|kSunkenFrame);
156 layouts[0]=
new TGLayoutHints(kLHintsExpandX,border,border,0,0);
160 frames[1]=
new TGCompositeFrame(
fExpPanel,1,1,kHorizontalFrame|kSunkenFrame);
161 layouts[1]=
new TGLayoutHints(kLHintsExpandX,border,border,0,0);
165 frames[2]=
new TGCompositeFrame(
fExpPanel,1,1,kHorizontalFrame|kSunkenFrame);
166 layouts[2]=
new TGLayoutHints(kLHintsExpandX,border,border,0,0);
170 frames[3]=
new TGCompositeFrame(
fExpPanel,1,1,kHorizontalFrame|kSunkenFrame);
171 layouts[3]=
new TGLayoutHints(kLHintsExpandX,border,border,0,0);
175 for (Int_t i=0; i<4; i++)
177 if (frames[i])
fExpPanel->AddFrame(frames[i],layouts[i]);
194 TGGroupFrame* files=
new TGGroupFrame(frame,
"Input filename e.g. $(HOME)/my-data/*.rnopack",kHorizontalFrame);
195 files->SetTitlePos(TGGroupFrame::kCenter);
196 frame->AddFrame(files);
197 fFiles=
new TGTextEntry(files);
198 fFiles->SetAlignment(kTextLeft);
202 TGTextButton* add=
new TGTextButton(files,
"AddFile");
203 add->Connect(
"Clicked()",ClassName(),
this,
"FileAdd()");
204 add->SetToolTipText(
"Add the specified file to the input data chain");
205 TGLayoutHints* Ladd=
new TGLayoutHints(kLHintsLeft,10,0,0,-5);
206 files->AddFrame(add,Ladd);
209 TGGroupFrame* entries=
new TGGroupFrame(frame,
"# Entries",kHorizontalFrame);
210 entries->SetTitlePos(TGGroupFrame::kCenter);
211 frame->AddFrame(entries);
218 TGGroupFrame* session=
new TGGroupFrame(frame,
"Window / Session",kHorizontalFrame);
219 session->SetTitlePos(TGGroupFrame::kCenter);
220 TGLayoutHints* Lsession=
new TGLayoutHints(kLHintsRight,0,0,0,0);
221 frame->AddFrame(session,Lsession);
223 TGTextButton* close=
new TGTextButton(session,
"Close");
224 close->Connect(
"Clicked()",ClassName(),
this,
"ExpClose()");
225 close->SetToolTipText(
"Close this panel window");
226 TGLayoutHints* Lclose=
new TGLayoutHints(kLHintsCenterX,0,6,3,-5);
227 session->AddFrame(close,Lclose);
229 TGTextButton* exit=
new TGTextButton(session,
"Exit");
230 exit->Connect(
"Clicked()",ClassName(),
this,
"ExpExit()");
231 exit->SetToolTipText(
"Exit this ROOT session");
232 TGLayoutHints* Lexit=
new TGLayoutHints(kLHintsCenterX,6,0,3,-5);
233 session->AddFrame(exit,Lexit);
287 TGGroupFrame* entry=
new TGGroupFrame(frame,
"Entry",kHorizontalFrame);
288 entry->SetTitlePos(TGGroupFrame::kCenter);
289 frame->AddFrame(entry);
290 fEntry=
new TGTextEntry(entry);
291 fEntry->SetAlignment(kTextRight);
295 TGTextButton* getentry=
new TGTextButton(entry,
"LoadEntry");
296 getentry->Connect(
"Clicked()",ClassName(),
this,
"LoadEntry()");
297 getentry->SetToolTipText(
"Load the specified entry (0=first)");
298 TGLayoutHints* Lgetentry=
new TGLayoutHints(kLHintsLeft,10,0,0,-5);
299 entry->AddFrame(getentry,Lgetentry);
302 TGGroupFrame* ts=
new TGGroupFrame(frame,
"Date/Time",kHorizontalFrame);
303 ts->SetTitlePos(TGGroupFrame::kCenter);
305 fHead[0]=
new TGTextEntry(ts);
306 fHead[0]->SetAlignment(kTextRight);
307 fHead[0]->Resize(225,20);
308 ts->AddFrame(
fHead[0]);
311 TGGroupFrame* station=
new TGGroupFrame(frame,
"Station",kHorizontalFrame);
312 station->SetTitlePos(TGGroupFrame::kCenter);
313 frame->AddFrame(station);
314 fHead[1]=
new TGTextEntry(station);
315 fHead[1]->SetAlignment(kTextRight);
316 fHead[1]->Resize(30,20);
317 station->AddFrame(
fHead[1]);
320 TGGroupFrame* run=
new TGGroupFrame(frame,
"Run",kHorizontalFrame);
321 run->SetTitlePos(TGGroupFrame::kCenter);
322 frame->AddFrame(run);
323 fHead[2]=
new TGTextEntry(run);
324 fHead[2]->SetAlignment(kTextRight);
325 fHead[2]->Resize(80,20);
326 run->AddFrame(
fHead[2]);
329 TGGroupFrame*
event=
new TGGroupFrame(frame,
"Event",kHorizontalFrame);
330 event->SetTitlePos(TGGroupFrame::kCenter);
331 frame->AddFrame(event);
332 fHead[3]=
new TGTextEntry(event);
333 fHead[3]->SetAlignment(kTextRight);
334 fHead[3]->Resize(80,20);
335 event->AddFrame(
fHead[3]);
337 TGTextButton* getevent=
new TGTextButton(event,
"LoadEvent");
338 getevent->Connect(
"Clicked()",ClassName(),
this,
"LoadEvent()");
339 getevent->SetToolTipText(
"Load the specified (run,event)");
340 TGLayoutHints* Lgetevent=
new TGLayoutHints(kLHintsLeft,10,0,0,-5);
341 event->AddFrame(getevent,Lgetevent);
466 TGGroupFrame* samplings=
new TGGroupFrame(frame,
"Input selection",kHorizontalFrame);
467 samplings->SetTitlePos(TGGroupFrame::kCenter);
468 frame->AddFrame(samplings);
471 TGNumberEntryField* channel=
new TGNumberEntryField(samplings,-1,-1,TGNumberFormat::kNESInteger);
472 channel->SetToolTipText(
"Channel number (-1=all)");
473 channel->Connect(
"TextChanged(const char*)",ClassName(),
this,
"ExpChannel(const char*)");
474 channel->Resize(30,20);
475 samplings->AddFrame(channel);
478 TGComboBox* mode=
new TGComboBox(samplings);
479 mode->Connect(
"Selected(Int_t)",ClassName(),
this,
"ExpMode(Int_t)");
480 mode->AddEntry(
"ADC(s)",1);
481 mode->AddEntry(
"ADC(t)",2);
482 mode->AddEntry(
"Store1",3);
483 mode->AddEntry(
"Store2",4);
484 mode->AddEntry(
"Store3",5);
486 TGLayoutHints* Lmode=
new TGLayoutHints(kLHintsLeft,10,0,0,-5);
487 samplings->AddFrame(mode,Lmode);
488 mode->Select(1,kTRUE);
490 TGGroupFrame* operations=
new TGGroupFrame(frame,
"Operation selection Parameter values",kHorizontalFrame);
491 operations->SetTitlePos(TGGroupFrame::kCenter);
492 frame->AddFrame(operations);
495 TGComboBox* opsmode=
new TGComboBox(operations);
496 opsmode->Connect(
"Selected(Int_t)",ClassName(),
this,
"ExpOpsMode(Int_t)");
497 opsmode->AddEntry(
"None",1);
498 opsmode->AddEntry(
"Convert ADC-->mV",2);
499 opsmode->AddEntry(
"DFT Time-->Frequency",3);
500 opsmode->AddEntry(
"DFT Frequency-->Time",4);
501 opsmode->AddEntry(
"Add FilterBand [f1,f2]",5);
502 opsmode->AddEntry(
"Show BandFilterKernel",6);
503 opsmode->AddEntry(
"BandFilter",7);
504 opsmode->AddEntry(
"Show MovingAvgKernel",8);
505 opsmode->AddEntry(
"MovingAvgFilter",9);
506 opsmode->AddEntry(
"Blocks of n samples",10);
507 opsmode->AddEntry(
"Bayesian FPR nrms ntrig",11);
508 opsmode->AddEntry(
"Bayesian FPR f(y) ntrig",12);
509 opsmode->AddEntry(
"Subtract",13);
510 opsmode->AddEntry(
"Correlate",14);
511 opsmode->AddEntry(
"Get SNR",15);
512 opsmode->Resize(170,20);
513 operations->AddFrame(opsmode);
514 opsmode->Select(1,kTRUE);
518 fParams[0]=
new TGTextEntry(operations);
519 fParams[0]->SetAlignment(kTextRight);
520 fParams[0]->Connect(
"TextChanged(const char*)",ClassName(),
this,
"ExpOpsPar1(const char*)");
522 operations->AddFrame(
fParams[0]);
525 fParams[1]=
new TGTextEntry(operations);
526 fParams[1]->SetAlignment(kTextRight);
527 fParams[1]->Connect(
"TextChanged(const char*)",ClassName(),
this,
"ExpOpsPar2(const char*)");
529 operations->AddFrame(
fParams[1]);
532 fParams[2]=
new TGTextEntry(operations);
533 fParams[2]->SetAlignment(kTextRight);
534 fParams[2]->Connect(
"TextChanged(const char*)",ClassName(),
this,
"ExpOpsPar3(const char*)");
536 operations->AddFrame(
fParams[2]);
538 TGGroupFrame* storedraw=
new TGGroupFrame(frame,
"Output Store&Draw",kHorizontalFrame);
539 storedraw->SetTitlePos(TGGroupFrame::kCenter);
540 frame->AddFrame(storedraw);
543 TGComboBox* execmode=
new TGComboBox(storedraw);
544 execmode->Connect(
"Selected(Int_t)",ClassName(),
this,
"ExpExecMode(Int_t)");
545 execmode->AddEntry(
"Store1",1);
546 execmode->AddEntry(
"Store2",2);
547 execmode->AddEntry(
"Store3",3);
548 execmode->Resize(65,20);
549 storedraw->AddFrame(execmode);
550 execmode->Select(1,kTRUE);
553 TGTextButton* execute=
new TGTextButton(storedraw,
"Exec");
554 execute->Connect(
"Clicked()",ClassName(),
this,
"ExpExecute()");
555 execute->SetToolTipText(
"Execute the selected actions for the requested channel(s)");
556 TGLayoutHints* Lexecute=
new TGLayoutHints(kLHintsLeft,10,0,0,-2);
557 storedraw->AddFrame(execute,Lexecute);
945 if (!
fMode.Contains(
"Store"))
947 for (Int_t i=0; i<24; i++)
953 if (!
fEvt || jstore<1 || jstore>3)
return;
984 TF1 adc2mV(
"adc2mV",
fFmV);
987 str.ReplaceAll(
"Store",
"");
988 Int_t StoreIn=str.Atoi();
990 str.ReplaceAll(
"Store",
"");
991 Int_t jch2=str.Atoi();
993 str.ReplaceAll(
"Store",
"");
994 Int_t StoreIn2=str.Atoi();
1013 for (Int_t jch=jstart; jch<=jstop; jch++)
1015 if (StoreIn>0 && StoreIn<4)
1019 else if (
fMode.Contains(
"ADC"))
1027 Gin.GetPoint(0,xfirst,y);
1028 Gin.GetPoint(npoints-1,xlast,y);
1033 Hin.SetBins(nbins,xmin,xmax);
1034 if (
fMode.Contains(
"(t)"))
1039 for (Int_t i=0; i<npoints; i++)
1041 Gin.GetPoint(i,x,y);
1044 Gin.SetPoint(i,x,y);
1045 Hin.SetBinContent(i+1,y);
1049 htitle=Gin.GetTitle();
1051 if (
fMode.Contains(
"(t)")) xtitle=
"Time in seconds";
1053 str.Form(
"%-s;%-s;%-s",htitle.Data(),xtitle.Data(),ytitle.Data());
1056 Hin.SetStats(kFALSE);
1059 if (
fMode.Contains(
"Store"))
1062 npoints=Hin.GetNbinsX();
1063 for (Int_t i=0; i<npoints; i++)
1065 x=Hin.GetBinCenter(i+1);
1066 y=Hin.GetBinContent(i+1);
1067 Gin.SetPoint(i,x,y);
1071 htitle=Hin.GetTitle();
1072 axis=Hin.GetXaxis();
1073 xtitle=axis->GetTitle();
1074 axis=Hin.GetYaxis();
1075 ytitle=axis->GetTitle();
1076 str.Form(
"%-s;%-s;%-s",htitle.Data(),xtitle.Data(),ytitle.Data());
1085 if (!(ytitle.Contains(
"ADC")) || ytitle.Contains(
"mV"))
1087 printf(
"\n *** This is not an ADC sampling ==> No conversion performed *** \n");
1092 npoints=Hin.GetNbinsX();
1093 for (Int_t i=0; i<npoints; i++)
1095 x=Hin.GetBinCenter(i+1);
1096 y=Hin.GetBinContent(i+1);
1098 Hin.SetBinContent(i+1,y);
1099 Gin.SetPoint(i,x,y);
1101 ytitle.Form(
"mV=[%-s]",(adc2mV.GetExpFormula(
"p")).Data());
1102 ytitle.ReplaceAll(
"x",
"ADC");
1103 str.Form(
"%-s;%-s;%-s",htitle.Data(),xtitle.Data(),ytitle.Data());
1113 if (
fOpsMode==
"DFT" && !(ytitle.Contains(
"ADC")) && !(ytitle.Contains(
"mV")))
1115 printf(
"\n *** This is not a time domain ==> No DFT performed *** \n");
1118 else if (
fOpsMode==
"IDFT" && (StoreIn<1 || StoreIn>3))
1120 printf(
"\n *** No Store%-i data available ==> No Inverse DFT performed *** \n",StoreIn);
1123 else if (
fOpsMode==
"IDFT" && (ytitle.Contains(
"ADC") || ytitle.Contains(
"mV")))
1125 printf(
"\n *** This is not a frequency domain ==> No inverse DFT performed *** \n");
1139 if (DFTsel.Contains(
"Hz")) freq=
fSample;
1140 fDSP.Load((TH1*)&Hin,freq);
1141 fDSP.Fourier(
"R2C",&Hout,DFTsel);
1142 fReArr[jstore-1][jch]=
fDSP.GetData(
"RE out");
1143 fImArr[jstore-1][jch]=
fDSP.GetData(
"IM out");
1149 if (DFTsel.Contains(
"t")) freq=
fSample;
1151 fDSP.Fourier(
"C2R",&Hout,DFTsel);
1152 axis=Hout.GetYaxis();
1154 axis->SetTitle(str);
1157 htitle=Hin.GetTitle();
1158 axis=Hout.GetXaxis();
1159 xtitle=axis->GetTitle();
1160 axis=Hout.GetYaxis();
1161 ytitle=axis->GetTitle();
1162 str.Form(
"%-s;%-s;%-s",htitle.Data(),xtitle.Data(),ytitle.Data());
1163 Hout.SetTitle(htitle);
1169 axis=Hin.GetXaxis();
1170 str=axis->GetTitle();
1171 axis=
fHistos[StoreIn2-1][jch2].GetXaxis();
1172 str2=axis->GetTitle();
1173 if (str.Contains(str2) || str2.Contains(str))
1175 fBB.Add(&Hin,&
fHistos[StoreIn2-1][jch2],&Hout,kFALSE,-1);
1179 printf(
"\n *** Units on the X-axes don't match ==> No action performed *** \n");
1186 axis=Hin.GetXaxis();
1187 str=axis->GetTitle();
1189 if (str.Contains(
"Time")) freq=
fSample;
1190 fDSP.Load((TH1*)&Hin,freq);
1192 fBB.Rebin(&
fHistos[StoreIn2-1][jch2],&htemp,kFALSE);
1193 fDSP.SetWaveform((TH1*)&htemp);
1199 sample.
Load((TH1*)&Hin);
1200 snr=sample.
GetSNR(1,snrmode,kFALSE);
1201 if (snr>0) snrdb=10.*log10(snr);
1202 if (jch==jstart) printf(
"\n");
1203 printf(
" *** Ch%-i in Store%-i : SNR=%-g (%-g dB) *** \n",jch,StoreIn,snr,snrdb);
1211 if (jch==jstart) printf(
"\n");
1212 printf(
" *** No FilterBands specified for channel %-i *** \n",jch);
1217 if (BW>0) nkernel=4./BW;
1220 fDSP.SetSamplingFrequency(freq);
1224 fReArr[jstore-1][jch]=
fDSP.GetData(
"RE out");
1225 fImArr[jstore-1][jch]=
fDSP.GetData(
"IM out");
1235 if (!(ytitle.Contains(
"ADC")) && !(ytitle.Contains(
"mV")))
1237 printf(
"\n *** This is not a time domain ==> No filtering performed *** \n");
1242 if (jch==jstart) printf(
"\n");
1243 printf(
" *** No FilterBands specified for channel %-i *** \n",jch);
1248 if (BW>0) nkernel=4./BW;
1251 fDSP.Load((TH1*)&Hin,freq);
1255 fReArr[jstore-1][jch]=
fDSP.GetData(
"RE out");
1256 fImArr[jstore-1][jch]=
fDSP.GetData(
"IM out");
1261 axis=Hout.GetYaxis();
1262 axis->SetTitle(ytitle);
1270 if (jch==jstart) printf(
"\n");
1271 printf(
" *** Invalid noise reduction factor : %-g *** \n",MW);
1275 nkernel=TMath::Nint(pow(MW,2));
1278 fDSP.SetSamplingFrequency(freq);
1281 fDSP.GetMovingAverageKernel(nkernel,&Hout);
1282 fReArr[jstore-1][jch]=
fDSP.GetData(
"RE out");
1283 fImArr[jstore-1][jch]=
fDSP.GetData(
"IM out");
1287 fDSP.GetMovingAverageKernel(nkernel,0,0,&Hout);
1293 if (!(ytitle.Contains(
"ADC")) && !(ytitle.Contains(
"mV")))
1295 printf(
"\n *** This is not a time domain ==> No filtering performed *** \n");
1300 if (jch==jstart) printf(
"\n");
1301 printf(
" *** Invalid noise reduction factor : %-g *** \n",MW);
1305 nkernel=TMath::Nint(pow(MW,2));
1308 fDSP.Load((TH1*)&Hin,freq);
1311 fDSP.FilterMovingAverage(nkernel,
"conv",0,0,0,&Hout,kTRUE);
1312 fReArr[jstore-1][jch]=
fDSP.GetData(
"RE out");
1313 fImArr[jstore-1][jch]=
fDSP.GetData(
"IM out");
1317 fDSP.FilterMovingAverage(nkernel,
"conv",&Hout);
1318 axis=Hout.GetYaxis();
1319 axis->SetTitle(ytitle);
1327 if (
fOpsPars[1]==
"Mean")
fBB.GetBlocks(&Gin,&Hout,n,0);
1328 if (
fOpsPars[1]==
"Median")
fBB.GetBlocks(&Gin,&Hout,n,1);
1329 if (
fOpsPars[1]==
"RMS")
fBB.GetBlocks(&Gin,&Hout,n,2);
1330 str.Form(
"%-s Fixed Blocks grouped in %-i consecutive samples",htitle.Data(),n);
1334 if (jch==jstart) printf(
"\n *** Bayesian Blocks processing in progress .... \n");
1338 fBB.GetBlocks(Gin,nrms,fpr,&Hout,ntrig);
1339 str.Form(
"%-s Bayesian Blocks with FPR=%-.3g and nrms=%-.3g",htitle.Data(),fpr,nrms);
1343 fBB.GetBlocks(Gin,fyerr,fpr,&Hout,ntrig);
1344 str.Form(
"%-s Bayesian Blocks with FPR=%-.3g and input errors: %-s",htitle.Data(),fpr,fyerr.Data());
1345 str.ReplaceAll(
"x",
"y");
1348 if (jch==jstart) printf(
"\n *** Bayesian Blocks processing completed *** \n");
1352 str+=
";Blocked samplings";
1353 if (xtitle.Contains(
"seconds")) str+=
" in seconds";
1354 if (xtitle.Contains(
"Hz")) str+=
" in Hz";
1362 axis=Hout.GetYaxis();
1363 str2=axis->GetTitle();
1366 Hout.SetStats(kFALSE);
1373 npoints=Hout.GetNbinsX();
1374 for (Int_t i=0; i<npoints; i++)
1376 x=Hout.GetBinCenter(i+1);
1377 y=Hout.GetBinContent(i+1);
1378 Gout.SetPoint(i,x,y);
1380 htitle=Hout.GetTitle();
1381 axis=Hout.GetXaxis();
1382 xtitle=axis->GetTitle();
1383 axis=Hout.GetYaxis();
1384 ytitle=axis->GetTitle();
1385 str.Form(
"%-s;%-s;%-s",htitle.Data(),xtitle.Data(),ytitle.Data());
1501 TGGroupFrame* listings=
new TGGroupFrame(frame,
"Event Listings",kHorizontalFrame);
1502 listings->SetTitlePos(TGGroupFrame::kCenter);
1503 frame->AddFrame(listings);
1506 TGTextButton* date=
new TGTextButton(listings,
"Date/Time");
1507 date->Connect(
"Clicked()",ClassName(),
this,
"ListDate()");
1508 date->SetToolTipText(
"List the detailed event date/time info");
1509 listings->AddFrame(date);
1511 TGTextButton* daq=
new TGTextButton(listings,
"DAQ");
1512 daq->Connect(
"Clicked()",ClassName(),
this,
"ListDAQ()");
1513 daq->SetToolTipText(
"Listing of the DAQ status");
1514 TGLayoutHints* Ldaq=
new TGLayoutHints(kLHintsLeft,5,0,0,-5);
1515 listings->AddFrame(daq,Ldaq);
1517 TGTextButton* triggers=
new TGTextButton(listings,
"Triggers");
1518 triggers->Connect(
"Clicked()",ClassName(),
this,
"ListTriggers()");
1519 triggers->SetToolTipText(
"Listing of the event trigger data");
1520 TGLayoutHints* Ltriggers=
new TGLayoutHints(kLHintsLeft,5,0,0,-5);
1521 listings->AddFrame(triggers,Ltriggers);
1523 TGTextButton* tags=
new TGTextButton(listings,
"Tags");
1524 tags->Connect(
"Clicked()",ClassName(),
this,
"ListTags()");
1525 tags->SetToolTipText(
"Listing of the event tag data");
1526 TGLayoutHints* Ltags=
new TGLayoutHints(kLHintsLeft,5,0,0,-5);
1527 listings->AddFrame(tags,Ltags);
1530 TGTextEntry* devname=
new TGTextEntry(listings,
"*");
1531 devname->SetAlignment(kTextRight);
1532 devname->Connect(
"TextChanged(const char*)",ClassName(),
this,
"ExpDevName(const char*)");
1533 devname->SetToolTipText(
"Device (class) name (*=all)");
1534 devname->Resize(80,20);
1535 TGLayoutHints* Ldevname=
new TGLayoutHints(kLHintsLeft,5,0,0,-5);
1536 listings->AddFrame(devname,Ldevname);
1538 TGTextButton* devs=
new TGTextButton(listings,
"Device(s)");
1539 devs->Connect(
"Clicked()",ClassName(),
this,
"ListDevices()");
1540 devs->SetToolTipText(
"List the selected device (class)");
1541 TGLayoutHints* Ldevs=
new TGLayoutHints(kLHintsLeft,5,0,0,-5);
1542 listings->AddFrame(devs,Ldevs);