finished MainSetting display

This commit is contained in:
Ryan Tang 2022-03-16 16:13:18 -04:00
parent f8fb0a04ed
commit 757464f2b7
5 changed files with 133 additions and 33 deletions

View File

@ -54,8 +54,6 @@ mainSettings.o : mainSettings.cpp mainSettings.h
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) Pixie16Class.o mainSettings.cpp $(ROOT_FLAG) $(CC) $(CFLAGS) $(PIXIE_LIB_PATH) Pixie16Class.o mainSettings.cpp $(ROOT_FLAG)
#-------------------------- #--------------------------
testing/example : testing/example.o testing/example : testing/example.o
@echo "-------- making example" @echo "-------- making example"

View File

@ -216,6 +216,9 @@ int Pixie16::CheckError(std::string operation){
if( retval < 0 ){ if( retval < 0 ){
printf("\033[1;31m*ERROR* \033[1;33m%s\033[m failed, retval = %d\n", operation.c_str(), retval); printf("\033[1;31m*ERROR* \033[1;33m%s\033[m failed, retval = %d\n", operation.c_str(), retval);
char msg[300];
PixieGetReturnCodeText(retval, msg, 300);
printf(" error massge : %s \n", msg );
return -1; return -1;
} }

View File

@ -9,6 +9,7 @@
#include <TGNumberEntry.h> #include <TGNumberEntry.h>
#include <TGComboBox.h> #include <TGComboBox.h>
#include <TGComboBox.h> #include <TGComboBox.h>
#include <TGTableContainer.h>
#include "mainSettings.h" #include "mainSettings.h"
@ -27,7 +28,6 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
TGLabel * lb1 = new TGLabel(hframe, "Module ID : "); TGLabel * lb1 = new TGLabel(hframe, "Module ID : ");
//lb1->SetWidth(50); lb1->ChangeOptions( kFixedSize);
hframe->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); hframe->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
TGNumberEntry * modIDEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); TGNumberEntry * modIDEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
@ -35,68 +35,153 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1); modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1);
hframe->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); hframe->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
///Show Setting TGTextButton * bSave = new TGTextButton(hframe,"&Save");
TGVerticalFrame *hframeSettings = new TGVerticalFrame(fMain, w, 600 ); bSave->Connect("Clicked()","MainSettings",this, "kaka()");
fMain->AddFrame(hframeSettings, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); hframe->AddFrame(bSave, new TGLayoutHints(kLHintsCenterX, 5,5,3,4));
/// Setting
int modID = modIDEntry->GetNumber(); int modID = modIDEntry->GetNumber();
int maxCh = pixie->GetDigitizerNumChannel(modID); int maxCh = pixie->GetDigitizerNumChannel(modID);
int numItems = 14;
TString labelText[numItems] = {"CH", "ON/off", "Gain", "Trig L", "Trig G", "Threshold", "Polarity", "Energy L", "Energy G", "Tau", "Trace Len", "Trace delay", "V offset", "BaseLine"};
double width[numItems] = { 50, 50, 50, 60, 60, 80, 60, 60, 60, 60, 80, 80, 70, 80};
//int numItems = 3; TGVerticalFrame *hframeSettings = new TGVerticalFrame(fMain, w, 600 );
//TString labelText[numItems] = {"CH", "ON/off", "Gain"}; fMain->AddFrame(hframeSettings, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
//TGLabel ** labelItems = new TGLabel * [numItems];
//TGVerticalFrame ** hframeItems = new TGVerticalFrame * [numItems];
//
//for( int j = 0; i < numItems; j++){
//
// hframeItems[j] = new TGVerticalFrame(hframeSettings, 100, 600);
// hframeSettings->AddFrame(hframeItems[j], new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
//
//
//
//
//
//}
//
//for( int i = 0; i < 3; i++){
// labelItems[i] = new TGLabel(hframeLabel, Form("%s", labelText[i].Data()));
// hframeLabel->AddFrame(labelItems[i],new TGLayoutHints(kLHintsCenterX, 2,2,2,2) );
//}
TGHorizontalFrame * hframeLabel = new TGHorizontalFrame(hframeSettings, w, 50);
hframeSettings->AddFrame(hframeLabel, new TGLayoutHints(kLHintsExpandX, 2,2,2,2));
TGLabel ** labelItems = new TGLabel * [numItems];
for(int i = 0; i < numItems; i++){
labelItems[i] = new TGLabel(hframeLabel, Form("%s", labelText[i].Data()));
labelItems[i]->Resize(width[i], 20);
labelItems[i]->SetMargins(0, (i == 0 ? 0 : 10) , 0, 0);
hframeLabel->AddFrame(labelItems[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
}
TGHorizontalFrame ** hframeCh = new TGHorizontalFrame * [maxCh]; TGHorizontalFrame ** hframeCh = new TGHorizontalFrame * [maxCh];
TGLabel ** lbCh = new TGLabel * [maxCh]; TGLabel ** lbCh = new TGLabel * [maxCh];
TGComboBox ** cbOnOff = new TGComboBox * [maxCh]; TGComboBox ** cbOnOff = new TGComboBox * [maxCh];
TGComboBox ** cbGain = new TGComboBox * [maxCh]; TGComboBox ** cbGain = new TGComboBox * [maxCh];
TGNumberEntry ** neTrigL = new TGNumberEntry * [maxCh];
TGNumberEntry ** neTrigG = new TGNumberEntry * [maxCh];
TGNumberEntry ** neThreshold = new TGNumberEntry * [maxCh];
TGComboBox ** cbPol = new TGComboBox * [maxCh];
TGNumberEntry ** neEngL = new TGNumberEntry * [maxCh];
TGNumberEntry ** neEngG = new TGNumberEntry * [maxCh];
TGNumberEntry ** neTau = new TGNumberEntry * [maxCh];
TGNumberEntry ** neTraceLength = new TGNumberEntry * [maxCh];
TGNumberEntry ** neTraceDelay = new TGNumberEntry * [maxCh];
TGNumberEntry ** neVoff = new TGNumberEntry * [maxCh];
TGNumberEntry ** neBL = new TGNumberEntry * [maxCh];
for( int i = 0; i < maxCh ; i ++){ for( int i = 0; i < maxCh ; i ++){
hframeCh[i] = new TGHorizontalFrame(hframeSettings, w, 600 ); hframeCh[i] = new TGHorizontalFrame(hframeSettings, w, 600 );
hframeSettings->AddFrame(hframeCh[i], new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); hframeSettings->AddFrame(hframeCh[i], new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
int col = 0;
lbCh[i] = new TGLabel(hframeCh[i] , Form("%02d", i)); lbCh[i] = new TGLabel(hframeCh[i] , Form("%02d", i));
lbCh[i]->SetWidth(width[col]);
hframeCh[i]->AddFrame(lbCh[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); hframeCh[i]->AddFrame(lbCh[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
col++;
cbOnOff[i] = new TGComboBox(hframeCh[i], i); cbOnOff[i] = new TGComboBox(hframeCh[i], i);
cbOnOff[i]->AddEntry("ON", 1); cbOnOff[i]->AddEntry("ON", 1);
cbOnOff[i]->AddEntry("off", 2); cbOnOff[i]->AddEntry("off", 2);
cbOnOff[i]->Resize(50, 20); cbOnOff[i]->Resize(width[col], 20);
pixie->GetChannelOnOff(modID, i) ? cbOnOff[i]->Select(1) : cbOnOff[i]->Select(2); pixie->GetChannelOnOff(modID, i) ? cbOnOff[i]->Select(1) : cbOnOff[i]->Select(2);
hframeCh[i]->AddFrame(cbOnOff[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); hframeCh[i]->AddFrame(cbOnOff[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
col++;
cbGain[i] = new TGComboBox(hframeCh[i], i); cbGain[i] = new TGComboBox(hframeCh[i], i);
cbGain[i]->AddEntry("x1", 1); cbGain[i]->AddEntry("x1", 1);
cbGain[i]->AddEntry("x1/4", 2); cbGain[i]->AddEntry("x1/4", 2);
cbGain[i]->Resize(50, 20); cbGain[i]->Resize(width[col], 20);
pixie->GetChannelGain(modID, i) ? cbGain[i]->Select(1) : cbGain[i]->Select(2); pixie->GetChannelGain(modID, i) ? cbGain[i]->Select(1) : cbGain[i]->Select(2);
hframeCh[i]->AddFrame(cbGain[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); hframeCh[i]->AddFrame(cbGain[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
col++;
neTrigL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerRiseTime(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
neTrigL[i]->SetWidth(width[col]);
neTrigL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 2.0);
hframeCh[i]->AddFrame(neTrigL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
//TGNumberEntry * modIDEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); col++;
neTrigG[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerFlatTop(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
neTrigG[i]->SetWidth(width[col]);
neTrigG[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 2.0);
hframeCh[i]->AddFrame(neTrigG[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
col++;
neThreshold[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerThreshold(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
neThreshold[i]->SetWidth(width[col]);
neThreshold[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 4000);
hframeCh[i]->AddFrame(neThreshold[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
col++;
cbPol[i] = new TGComboBox(hframeCh[i], i);
cbPol[i]->AddEntry("Pos +", 1);
cbPol[i]->AddEntry("Neg -", 2);
cbPol[i]->Resize(width[col], 20);
pixie->GetChannelPolarity(modID, i) ? cbPol[i]->Select(1) : cbPol[i]->Select(2);
hframeCh[i]->AddFrame(cbPol[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
col++;
neEngL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyRiseTime(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
neEngL[i]->SetWidth(width[col]);
neEngL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 10.0);
hframeCh[i]->AddFrame(neEngL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
col++;
neEngG[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyFlatTop(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
neEngG[i]->SetWidth(width[col]);
neEngG[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 10.0);
hframeCh[i]->AddFrame(neEngG[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
col++;
neTau[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyTau(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
neTau[i]->SetWidth(width[col]);
neTau[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 300.0);
hframeCh[i]->AddFrame(neTau[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
col++;
double tracelen = pixie->GetChannelTraceLength(modID, i);
if( pixie->GetChannelTraceOnOff(modID, i) == false ) tracelen = -1;
neTraceLength[i] = new TGNumberEntry(hframeCh[i], tracelen, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber);
neTraceLength[i]->SetWidth(width[col]);
neTraceLength[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, -1, 20.0);
hframeCh[i]->AddFrame(neTraceLength[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
col++;
double tracedel = pixie->GetChannelTraceDelay(modID, i);
if( pixie->GetChannelTraceOnOff(modID, i) == false ) tracedel = -1;
neTraceDelay[i] = new TGNumberEntry(hframeCh[i], tracedel, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber);
neTraceDelay[i]->SetWidth(width[col]);
neTraceDelay[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, -1, 20.0);
hframeCh[i]->AddFrame(neTraceDelay[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
col++;
neVoff[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelVOffset(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber);
neVoff[i]->SetWidth(width[col]);
neVoff[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, -2, 2);
hframeCh[i]->AddFrame(neVoff[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
col++;
neBL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelBaseLinePrecent(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
neBL[i]->SetWidth(width[col]);
neBL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 100.0);
//neBL[i]->Connect("Modified()", "MainSettings", this, Form("ChangeBL(==%d, =%d)",modID, i));
//neBL[i]->Connect("Modified()", "MainSettings", this, "ChangeBL(0,1)");
//neBL[i]->Connect("Modified()", "MainSettings", this, "kaka()");
hframeCh[i]->AddFrame(neBL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
} }
fMain->MapSubwindows(); fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize()); fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow(); fMain->MapWindow();
@ -109,3 +194,13 @@ MainSettings::~MainSettings(){
delete fMain; delete fMain;
} }
void MainSettings::ChangeBL(unsigned short mod, unsigned short ch){
printf("mod : %d , ch : %d\n", mod, ch);
}
void MainSettings::kaka(){
printf("save button is pressed.\n");
}

View File

@ -18,9 +18,12 @@ public:
MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie); MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie);
virtual ~MainSettings(); virtual ~MainSettings();
void CloseWindow() { printf("close window\n"); delete this; } void CloseWindow() { printf("close window\n"); delete this; }
void ChangeBL(unsigned short mod, unsigned short ch);
void kaka();
}; };

View File

@ -82,8 +82,6 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2)); fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
/// Create canvas widget /// Create canvas widget
fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,800,400); fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,800,400);
fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1)); fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
@ -103,6 +101,9 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
/// Map main frame /// Map main frame
fMain->MapWindow(); fMain->MapWindow();
HandleMenu(M_MAIN_CH_SETTINGS);
///================ pixie ///================ pixie
///printf("Removing Pixie16Msg.log \n"); ///printf("Removing Pixie16Msg.log \n");
///remove( "Pixie16Msg.log"); ///remove( "Pixie16Msg.log");