From fc8b93c69690340179b9cbf791d86b75667b3686 Mon Sep 17 00:00:00 2001 From: "Ryan@Debain10" Date: Wed, 30 Mar 2022 18:48:58 -0400 Subject: [PATCH] add Channel Setting pannel, cannot not edit --- Makefile | 8 ++- channelSetting.cpp | 137 +++++++++++++++++++++++++++++++++++++++++++++ channelSetting.h | 41 ++++++++++++++ pixieDAQ.cpp | 12 ++++ pixieDAQ.h | 2 + 5 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 channelSetting.cpp create mode 100644 channelSetting.h diff --git a/Makefile b/Makefile index 12ba8cc..a8db252 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ APIBASE = /usr/opt/xia/PixieSDK/lib/ LIBS = $(APIBASE)libPixie16Api.so $(APIBASE)libPixieSDK.a $(PLXBASE)PlxApi.a -OBJS = pixieDAQ.o Pixie16Class.o settingsSummary.o scalarPanel.o moduleSetting.o +OBJS = pixieDAQ.o Pixie16Class.o settingsSummary.o scalarPanel.o moduleSetting.o channelSetting.o all: testing/test testing/example pixieDAQ @@ -64,6 +64,12 @@ moduleSetting.o : moduleSetting.cpp moduleSetting.h @echo "--------- creating moduleSetting.o" $(CC) $(CFLAGS) $(PIXIE_LIB_PATH) moduleSetting.cpp $(ROOT_FLAG) +channelSetting.o : channelSetting.cpp channelSetting.h + @echo "--------- creating channelSetting.o" + $(CC) $(CFLAGS) $(PIXIE_LIB_PATH) channelSetting.cpp $(ROOT_FLAG) + + + #-------------------------- testing/example : testing/example.o @echo "-------- making example" diff --git a/channelSetting.cpp b/channelSetting.cpp new file mode 100644 index 0000000..3963f28 --- /dev/null +++ b/channelSetting.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "channelSetting.h" + + +ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){ + + this->pixie = pixie; + + fMain = new TGMainFrame(p,w,h); + fMain->SetWindowName("Pixie16 Channel Settings "); + fMain->Connect("CloseWindow()", "ChannelSetting", this, "CloseWindow()"); + + TGVerticalFrame * vframe = new TGVerticalFrame(fMain); + fMain->AddFrame(vframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); + + + ///==========Module choose + TGHorizontalFrame *hframe0 = new TGHorizontalFrame(vframe, w, 50 ); + vframe->AddFrame(hframe0, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); + + TGLabel * lb0 = new TGLabel(hframe0, "Module ID :"); + hframe0->AddFrame(lb0, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); + + modIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); + modIDEntry->SetWidth(50); + modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1); + modIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeMod()"); + hframe0->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + TGLabel * lb1 = new TGLabel(hframe0, "Channel :"); + hframe0->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); + + chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); + chIDEntry->SetWidth(50); + chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, MAXCH); + chIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeCh()"); + hframe0->AddFrame(chIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + int modID = modIDEntry->GetNumber(); + int ch = chIDEntry->GetNumber(); + + TString settingName[NUM_CHANNEL_SETTING] = { + "TRIGGER_RISETIME", + "TRIGGER_FLATTOP", + "TRIGGER_THRESHOLD", + "ENERGY_RISETIME", + "ENERGY_FLATTOP", + "TAU", + "TRACE_LENGTH", + "TRACE_DELAY", + "VOFFSET", + "XDT", + "BASELINE_PERCENT", + "BASELINE_AVERAGE", + "BLCUT", + "EMIN", + "QDCLen0", + "QDCLen1", + "QDCLen2", + "QDCLen3", + "QDCLen4", + "QDCLen5", + "QDCLen6", + "QDCLen7", + "MultiplicityMaskL", + "MultiplicityMaskH", + "CHANNEL_CSRA", + }; + + TGHorizontalFrame *hframe[NUM_CHANNEL_SETTING]; + TGLabel * lb[NUM_CHANNEL_SETTING]; + + for( int i = 0 ; i < NUM_CHANNEL_SETTING; i++){ + hframe[i] = new TGHorizontalFrame(vframe, 50, 50 ); + vframe->AddFrame(hframe[i], new TGLayoutHints(kLHintsRight, 2,2,2,2)); + + double temp = pixie->GetChannelSetting(settingName[i].Data(), modID, ch, false); + entry[i] = new TGTextEntry(hframe[i], new TGTextBuffer(1)); + //if( i < 2 || i == NUM_CHANNEL_SETTING -1 ) entry[i]->SetEnabled(false); + entry[i]->SetEnabled(false); + + entry[i]->SetText( Form("%f", temp) ); + + hframe[i]->AddFrame(entry[i], new TGLayoutHints(kLHintsRight, 5,5,3,4)); + + lb[i] = new TGLabel(hframe[i], settingName[i]); + hframe[i]->AddFrame(lb[i], new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 3, 4)); + + } + + + fMain->MapSubwindows(); + fMain->Resize(fMain->GetDefaultSize()); + fMain->MapWindow(); + + isOpened = true; +} + + +ChannelSetting::~ChannelSetting(){ + + isOpened = false; + + delete modIDEntry; + + for ( int i = 0; i < NUM_CHANNEL_SETTING; i++){ + delete entry[i]; + } + + + /// fMain must be delete last; + fMain->Cleanup(); + delete fMain; + +} + + +void ChannelSetting::ChangeMod(){ + + + +} + +void ChannelSetting::ChangeCh(){ + + + +} diff --git a/channelSetting.h b/channelSetting.h new file mode 100644 index 0000000..b3cc2f6 --- /dev/null +++ b/channelSetting.h @@ -0,0 +1,41 @@ +#ifndef CHANNEL_SETTING_H +#define CHANNEL_SETTING_H + +#include +#include +#include +#include + +#include "Pixie16Class.h" + +class TGWindow; +class TGMainFrame; + +#define MAXCH 16 +#define NUM_CHANNEL_SETTING 25 + +class ChannelSetting{ +private: + TGMainFrame * fMain; + + TGNumberEntry * modIDEntry, * chIDEntry; + + TGTextEntry * entry[NUM_CHANNEL_SETTING]; + + Pixie16 * pixie; + +public: + ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie); + virtual ~ChannelSetting(); + + void CloseWindow() { printf("close window\n"); delete this; } + + void ChangeMod(); + void ChangeCh(); + + bool isOpened; + +}; + + +#endif diff --git a/pixieDAQ.cpp b/pixieDAQ.cpp index 2c80cc2..220164b 100644 --- a/pixieDAQ.cpp +++ b/pixieDAQ.cpp @@ -180,6 +180,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { settingsSummary = NULL; moduleSetting = NULL; + channelSetting = NULL; scalarPanel = NULL; bStopRun->SetEnabled(false); @@ -220,6 +221,17 @@ void MainWindow::HandleMenu(Int_t id){ } }break; + case M_CH_SETTING:{ + if( channelSetting == NULL ) { + channelSetting = new ChannelSetting(gClient->GetRoot(), 600, 600, pixie); + }else{ + if( !channelSetting->isOpened ) { + channelSetting = new ChannelSetting(gClient->GetRoot(), 600, 600, pixie); + } + } + + }break; + ///========================= Module setting case M_MODULE_SETTINGS:{ if( moduleSetting == NULL ) { diff --git a/pixieDAQ.h b/pixieDAQ.h index 53ee4d1..2c0c4f4 100644 --- a/pixieDAQ.h +++ b/pixieDAQ.h @@ -12,6 +12,7 @@ #include "settingsSummary.h" #include "scalarPanel.h" #include "moduleSetting.h" +#include "channelSetting.h" class TGWindow; class TGMainFrame; @@ -38,6 +39,7 @@ private: SettingsSummary * settingsSummary; ModuleSetting * moduleSetting; + ChannelSetting * channelSetting; ScalarPanel * scalarPanel; TThread * thread;