channel setting can change setting

This commit is contained in:
Ryan Tang 2022-04-01 16:07:18 -04:00
parent 114a24d076
commit be1620d3ba
4 changed files with 114 additions and 40 deletions

View File

@ -10,32 +10,47 @@
#include "channelSetting.h"
///---------------------------------------------- NAME, DIGI, unit
TString settingName[NUM_CHANNEL_SETTING][3] = {{"TRIGGER_RISETIME", "2", "us"},
{"TRIGGER_FLATTOP", "2", "us"},
{"TRIGGER_THRESHOLD", "0", "ADC"},
{"ENERGY_RISETIME", "1", "us"},
{"ENERGY_FLATTOP", "1", "us"},
{"TAU", "2", "us"},
{"TRACE_LENGTH", "2", "us"},
{"TRACE_DELAY", "2", "us"},
{"VOFFSET", "2", "V"},
{"XDT", "2", "us"},
{"BASELINE_PERCENT", "0", "%"},
{"BASELINE_AVERAGE", "0", ""},
{"BLCUT", "0", ""},
{"EMIN", "0", ""},
{"QDCLen0", "3", "us"},
{"QDCLen1", "3", "us"},
{"QDCLen2", "3", "us"},
{"QDCLen3", "3", "us"},
{"QDCLen4", "3", "us"},
{"QDCLen5", "3", "us"},
{"QDCLen6", "3", "us"},
{"QDCLen7", "3", "us"},
{"MultiplicityMaskL", "0", ""},
{"MultiplicityMaskH", "0", ""},
{"CHANNEL_CSRA", "0", ""}};
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"};
///==== missing parameters
///"PEAK_SAMPLE"
///"PEAK_SEP"
///"BINFACTOR"
///"FASTTRIGBACKLEN"
///"INTEGRATOR"
///"CFDDelay"
///"CFDScale"
///"CFDThresh"
///"ExtTrigStretch"
///"VetoStretch"
///"ExternDelayLen"
///"FtrigoutDelay"
///"ChanTrigStretch"
ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){
@ -75,6 +90,28 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 *
int modID = modIDEntry->GetNumber();
int ch = chIDEntry->GetNumber();
int width = 135;
TGHorizontalFrame *hframeOnOff = new TGHorizontalFrame(vframe, 50, 50 );
vframe->AddFrame(hframeOnOff, new TGLayoutHints(kLHintsRight, 2,2,2,2));
cbOnOff = new TGComboBox(hframeOnOff);
cbOnOff->AddEntry("ON", 1);
cbOnOff->AddEntry("off", 0);
cbOnOff->Resize(width, 20);
if( pixie->GetChannelOnOff(modID, ch) ){
cbOnOff->Select(1);
}else{
cbOnOff->Select(0);
}
cbOnOff->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "ChangeOnOff()");
hframeOnOff->AddFrame(cbOnOff, new TGLayoutHints(kLHintsRight, 5,5,3,4));
TGLabel * lbOnOff = new TGLabel(hframeOnOff, "On/Off");
hframeOnOff->AddFrame(lbOnOff, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 3, 4));
TGHorizontalFrame *hframe[NUM_CHANNEL_SETTING];
TGLabel * lb[NUM_CHANNEL_SETTING];
@ -82,16 +119,22 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 *
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);
double temp = pixie->GetChannelSetting(settingName[i][0].Data(), modID, ch, false);
entry[i]->SetText( Form("%f", temp) );
TGNumberFormat::EStyle digi = TGNumberFormat::kNESInteger;
if( settingName[i][1] == "0" ) digi = TGNumberFormat::kNESInteger;
if( settingName[i][1] == "1" ) digi = TGNumberFormat::kNESRealOne;
if( settingName[i][1] == "2" ) digi = TGNumberFormat::kNESRealTwo;
if( settingName[i][1] == "3" ) digi = TGNumberFormat::kNESRealThree;
entry[i] = new TGNumberEntry(hframe[i], temp, 0, 0, digi, TGNumberFormat::kNEANonNegative);
entry[i]->Resize(width, 20);
entry[i]->Connect("Modified()", "ChannelSetting", this, Form("ChangeID(=%d)", i));
hframe[i]->AddFrame(entry[i], new TGLayoutHints(kLHintsRight, 5,5,3,4));
lb[i] = new TGLabel(hframe[i], settingName[i]);
lb[i] = new TGLabel(hframe[i], settingName[i][0] + (settingName[i][2] != "" ? " [" + settingName[i][2] + "]" : ""));
hframe[i]->AddFrame(lb[i], new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 3, 4));
}
@ -111,11 +154,12 @@ ChannelSetting::~ChannelSetting(){
delete modIDEntry;
delete cbOnOff;
for ( int i = 0; i < NUM_CHANNEL_SETTING; i++){
delete entry[i];
}
/// fMain must be delete last;
fMain->Cleanup();
delete fMain;
@ -132,9 +176,35 @@ void ChannelSetting::ChangeCh(){
int modID = modIDEntry->GetNumber();
int ch = chIDEntry->GetNumber();
if( pixie->GetChannelOnOff(modID, ch) ){
cbOnOff->Select(1);
}else{
cbOnOff->Select(0);
}
for( int i = 0 ; i < NUM_CHANNEL_SETTING; i++){
double temp = pixie->GetChannelSetting(settingName[i].Data(), modID, ch, false);
entry[i]->SetText( Form("%f", temp) );
double temp = pixie->GetChannelSetting(settingName[i][0].Data(), modID, ch, false);
entry[i]->SetNumber(temp );
}
}
void ChannelSetting::ChangeOnOff(){
short modID = modIDEntry->GetNumber();
short ch = chIDEntry->GetNumber();
int val = cbOnOff->GetSelected();
pixie->SetChannelOnOff(val, modID, ch);
pixie->SaveSettings(pixie->GetSettingFile(modIDEntry->GetNumber()));
}
void ChannelSetting::ChangeID(int id){
short modID = modIDEntry->GetNumber();
short ch = chIDEntry->GetNumber();
double val = entry[id]->GetNumber();
pixie->SetChannelSetting(settingName[id][0].Data(), val, modID, ch, 1);
pixie->SaveSettings(pixie->GetSettingFile(modIDEntry->GetNumber()));
}

View File

@ -20,7 +20,9 @@ private:
TGNumberEntry * modIDEntry, * chIDEntry;
TGTextEntry * entry[NUM_CHANNEL_SETTING];
TGComboBox * cbOnOff;
TGNumberEntry * entry[NUM_CHANNEL_SETTING];
Pixie16 * pixie;
@ -33,6 +35,9 @@ public:
void ChangeMod();
void ChangeCh();
void ChangeOnOff();
void ChangeID(int id);
bool isOpened;
};

View File

@ -491,7 +491,6 @@ void * MainWindow::SaveData(void* ptr){
year, month, day, hour, minute, secound, newFileSize, rate, MByteRead));
teLog->LineDown();
}
pixie->ReadData(0);

View File

@ -417,7 +417,7 @@
2
],
"OffsetDAC": [
32768,
32986,
32768,
32768,
32768,
@ -1016,7 +1016,7 @@
"ChanNum": 0,
"CoincPattern": 0,
"CoincWait": 0,
"ControlTask": 23,
"ControlTask": 0,
"CrateID": 0,
"FIFOLength": 8188,
"FastFilterRange": 0,