From bb9923c06517393198f8a63fec247f02cd0fa69d Mon Sep 17 00:00:00 2001 From: "Ryan@Debain10" Date: Wed, 13 Apr 2022 16:22:10 -0400 Subject: [PATCH] added Utility Menu, add channels scalar histogram --- channelSetting.cpp | 1 + moduleSetting.cpp | 2 ++ pixieDAQ.cpp | 45 +++++++++++++++++++++++++++++++++++++++------ pixieDAQ.h | 6 +++++- settingsSummary.cpp | 1 + test_ryan.set | 2 +- 6 files changed, 49 insertions(+), 8 deletions(-) diff --git a/channelSetting.cpp b/channelSetting.cpp index c3fede9..fbef314 100644 --- a/channelSetting.cpp +++ b/channelSetting.cpp @@ -78,6 +78,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * modIDEntry->SetWidth(50); modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1); modIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeMod()"); + if( pixie->GetNumModule() == 1 ) modIDEntry->SetState(false); hframe0->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); TGLabel * lb1 = new TGLabel(hframe0, "Channel :"); diff --git a/moduleSetting.cpp b/moduleSetting.cpp index 5fb1c0a..475f695 100644 --- a/moduleSetting.cpp +++ b/moduleSetting.cpp @@ -48,6 +48,8 @@ ModuleSetting::ModuleSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pi modIDEntry->SetWidth(50); modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1); modIDEntry->Connect("Modified()", "ModuleSetting", this, "ChangeMod()"); + if( pixie->GetNumModule() == 1 ) modIDEntry->SetState(false); + hframe0->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); int modID = modIDEntry->GetNumber(); diff --git a/pixieDAQ.cpp b/pixieDAQ.cpp index efc95fe..9b1a944 100644 --- a/pixieDAQ.cpp +++ b/pixieDAQ.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -27,7 +26,9 @@ enum MenuIdentifiers{ M_EXIT, M_CH_SETTINGS_SUMMARY, M_CH_SETTING, - M_MODULE_SETTINGS + M_MODULE_SETTINGS, + M_FINDPEAKS, + M_SHOW_CHANNELS_RATE }; @@ -40,6 +41,7 @@ TRootEmbeddedCanvas * MainWindow::fEcanvas = NULL; TGNumberEntry * MainWindow::modIDEntry = NULL; TGNumberEntry * MainWindow::chEntry = NULL; TH1F * MainWindow::hEnergy[MAXMOD][MAXCH]={NULL}; +TH1F * MainWindow::hChannel[MAXMOD]={NULL}; bool MainWindow::isEnergyHistFilled = false; MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { @@ -57,6 +59,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { for( int j = 0; j < MAXCH ; j++){ hEnergy[i][j] = new TH1F(Form("hEnergy%02d_%02d", i, j), Form("Energy mod:%2d ch:%02d (down scaled)", i, j), 200, 0, 160000); } + hChannel[i] = new TH1F(Form("hChannel%02d", i), Form("Channel Stat. mod:%2d (down scaled)", i), MAXCH, 0, MAXCH); } /// Create a main frame @@ -64,15 +67,14 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { ///fMain->SetWMPosition(500, 500); //does not work fMain->Connect("CloseWindow()", "MainWindow", this, "GoodBye()"); - ///menu + ///======================= menu fMenuBar = new TGMenuBar(fMain, 1, 1, kHorizontalFrame); fMain->AddFrame(fMenuBar, new TGLayoutHints(kLHintsTop | kLHintsExpandX)); fMenuFile = new TGPopupMenu(gClient->GetRoot()); - fMenuFile->AddEntry("&Open...", M_FILE_OPEN); + fMenuFile->AddEntry("&Open Pixie16.config", M_FILE_OPEN); fMenuFile->AddSeparator(); fMenuFile->AddEntry("E&xit", M_EXIT); - fMenuFile->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)"); fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0)); @@ -81,10 +83,15 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { fMenuSettings->AddEntry("&Channel Setting", M_CH_SETTING); fMenuSettings->AddSeparator(); fMenuSettings->AddEntry("Digitizer &Settings", M_MODULE_SETTINGS); - fMenuSettings->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)"); fMenuBar->AddPopup("&Settings", fMenuSettings, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0)); + fMenuUtility = new TGPopupMenu(gClient->GetRoot()); + fMenuUtility->AddEntry("Plot Channels Rate", M_SHOW_CHANNELS_RATE); + fMenuSettings->AddSeparator(); + fMenuUtility->AddEntry("Find &Peaks", M_FINDPEAKS); + fMenuUtility->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)"); + fMenuBar->AddPopup("&Utility", fMenuUtility, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0)); TGLayoutHints * uniLayoutHints = new TGLayoutHints(kLHintsNormal, 2,2,10,0); ///left, right, top, bottom @@ -106,6 +113,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { modIDEntry->SetWidth(50); modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1); modIDEntry->Connect("Modified()", "MainWindow", this, "ChangeMod()"); + if( pixie->GetNumModule() == 1 ) modIDEntry->SetState(false); hframe1->AddFrame(modIDEntry, uniLayoutHints); TGLabel * lb2 = new TGLabel(hframe1, "Ch :"); @@ -252,6 +260,8 @@ MainWindow::~MainWindow() { delete gTrace; + delete configEditor; + /// Clean up used widgets: frames, buttons, layout hints fMain->Cleanup(); delete fMain; @@ -264,6 +274,8 @@ void MainWindow::HandleMenu(Int_t id){ ///========================= File Open case M_FILE_OPEN:{ + configEditor = new TGTextEditor("Pixie16.config", gClient->GetRoot(), 1200); + }break; ///========================= Exit @@ -303,6 +315,24 @@ void MainWindow::HandleMenu(Int_t id){ }break; + ///====================== Show channel rate; + case M_SHOW_CHANNELS_RATE:{ + + int modID = modIDEntry->GetNumber(); + fEcanvas->GetCanvas()->cd(); + hChannel[modID]->Draw(); + fEcanvas->GetCanvas()->Update(); + + }break; + + + ///====================== Fit Gaussian + case M_FINDPEAKS:{ + + LogMsg("[Find Peaks] Not impelmented"); + + }break; + } } @@ -326,6 +356,7 @@ void MainWindow::GetADCTrace() { } gTrace->GetXaxis()->SetTitle("time [us]"); gTrace->GetXaxis()->SetRangeUser(0, pixie->GetADCTraceLength()*dt); + gTrace->SetTitle(Form("Trace mod:%d ch:%0d", modID, ch)); fEcanvas->GetCanvas()->cd(); gTrace->Draw("APL"); @@ -351,6 +382,7 @@ void MainWindow::GetBaseLine(){ gTrace->SetPoint(i, baselineTime[i]*1000, baseline[i]); } gTrace->GetXaxis()->SetTitle("time [ns]"); + gTrace->SetTitle(Form("Baseline mod:%d ch:%0d", modID, ch)); fEcanvas->GetCanvas()->cd(); gTrace->Draw("APL"); @@ -699,6 +731,7 @@ void * MainWindow::FillHistogram(void *ptr){ for( unsigned int i = 0; i < nData; i++){ ///printf("%3u| %2u, %3u, %7u, %llu \n", i, mods[i], channels[i], energies[i], timestamps[i]); hEnergy[mods[i]][channels[i]]->Fill(energies[i]); + hChannel[mods[i]]->Fill(channels[i]); } isEnergyHistFilled = true; pixie->SetFIFOisUsed(true); diff --git a/pixieDAQ.h b/pixieDAQ.h index 740f289..c8ed858 100644 --- a/pixieDAQ.h +++ b/pixieDAQ.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "Pixie16Class.h" #include "global_macro.h" @@ -30,7 +31,7 @@ private: static TRootEmbeddedCanvas *fEcanvas; TGMenuBar *fMenuBar; - TGPopupMenu *fMenuFile, *fMenuSettings; + TGPopupMenu *fMenuFile, *fMenuSettings, *fMenuUtility; static TGNumberEntry * modIDEntry, *chEntry; @@ -55,9 +56,12 @@ private: TThread * fillHistThread; static TH1F * hEnergy[MAXMOD][MAXCH]; + static TH1F * hChannel[MAXMOD]; static bool isEnergyHistFilled; TGraph * gTrace; + + TGTextEditor * configEditor; public: diff --git a/settingsSummary.cpp b/settingsSummary.cpp index 71bad3e..41ef5d9 100644 --- a/settingsSummary.cpp +++ b/settingsSummary.cpp @@ -35,6 +35,7 @@ SettingsSummary::SettingsSummary(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 modIDEntry->SetWidth(50); modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1); modIDEntry->Connect("Modified()", "SettingsSummary", this, "ChangeMod()"); + if( pixie->GetNumModule() == 1 ) modIDEntry->SetState(false); hframe->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); TGLabel * lb2 = new TGLabel(hframe, "Setting File :"); diff --git a/test_ryan.set b/test_ryan.set index 5d13e86..aa912b2 100644 --- a/test_ryan.set +++ b/test_ryan.set @@ -1016,7 +1016,7 @@ "ChanNum": 0, "CoincPattern": 0, "CoincWait": 0, - "ControlTask": 5, + "ControlTask": 23, "CrateID": 0, "FIFOLength": 8188, "FastFilterRange": 0,