add Channel Setting pannel, cannot not edit

This commit is contained in:
Ryan Tang 2022-03-30 18:48:58 -04:00
parent 77119d9a38
commit fc8b93c696
5 changed files with 199 additions and 1 deletions

View File

@ -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"

137
channelSetting.cpp Normal file
View File

@ -0,0 +1,137 @@
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGTableContainer.h>
#include <TGFileDialog.h>
#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(){
}

41
channelSetting.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef CHANNEL_SETTING_H
#define CHANNEL_SETTING_H
#include <TQObject.h>
#include <TGNumberEntry.h>
#include <TGComboBox.h>
#include <TGLabel.h>
#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

View File

@ -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 ) {

View File

@ -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;