break ProgramPHA into board and channel, some UI improve
This commit is contained in:
parent
2a9319fb5d
commit
d7d3988b75
|
@ -629,19 +629,61 @@ void Digitizer2Gen::SaveDataToFile(){
|
||||||
//###########################################
|
//###########################################
|
||||||
void Digitizer2Gen::Reset(){ SendCommand("/cmd/Reset"); }
|
void Digitizer2Gen::Reset(){ SendCommand("/cmd/Reset"); }
|
||||||
|
|
||||||
void Digitizer2Gen::ProgramPHA(bool testPulse){
|
void Digitizer2Gen::ProgramPHABoard(){
|
||||||
if( !isConnected ) return ;
|
if( !isConnected ) return ;
|
||||||
|
|
||||||
// Acquistion
|
//============= Board
|
||||||
WriteValue("/par/StartSource" , "SWcmd");
|
WriteValue("/par/ClockSource" , "Internal");
|
||||||
WriteValue("/par/TrgOutMode", "Disabled");
|
WriteValue("/par/EnClockOutFP" , "True");
|
||||||
WriteValue("/par/GPIOMode", "Disabled");
|
WriteValue("/par/StartSource" , "SWcmd");
|
||||||
WriteValue("/par/SyncOutMode", "Disabled");
|
WriteValue("/par/GlobalTriggerSource" , "TrgIn");
|
||||||
WriteValue("/par/RunDelay", "0"); // ns, that is for sync time with multi board
|
|
||||||
WriteValue("/par/IOlevel", "NIM");
|
WriteValue("/par/TrgOutMode" , "Disabled");
|
||||||
WriteValue("/par/EnStatEvents", "true");
|
WriteValue("/par/GPIOMode" , "Disabled");
|
||||||
WriteValue("/par/BusyInSource", "Disabled");
|
WriteValue("/par/BusyInSource" , "Disabled");
|
||||||
|
WriteValue("/par/SyncOutMode" , "Disabled");
|
||||||
|
WriteValue("/par/BoardVetoSource" , "Disabled");
|
||||||
|
|
||||||
|
WriteValue("/par/RunDelay" , "0"); // ns, that is for sync time with multi board
|
||||||
|
WriteValue("/par/IOlevel" , "NIM");
|
||||||
|
|
||||||
|
WriteValue("/par/EnAutoDisarmAcq" , "true");
|
||||||
|
WriteValue("/par/EnStatEvents" , "true");
|
||||||
|
|
||||||
|
WriteValue("/par/BoardVetoWidth" , "0");
|
||||||
|
WriteValue("/par/VolatileClockOutDelay" , "0");
|
||||||
|
WriteValue("/par/PermanentClockOutDelay" , "0");
|
||||||
|
|
||||||
|
WriteValue("/par/DACoutMode" , "ChInput");
|
||||||
|
WriteValue("/par/DACoutStaticLevel" , "8192");
|
||||||
|
WriteValue("/par/DACoutChSelect" , "0");
|
||||||
|
|
||||||
|
|
||||||
|
//============== Test pulse
|
||||||
|
//WriteValue("/par/TestPulsePeriod" , "1000000"); // 1.0 msec = 1000Hz, tested, 1 trace recording
|
||||||
|
//WriteValue("/par/TestPulseWidth" , "1000"); // nsec
|
||||||
|
//WriteValue("/par/TestPulseLowLevel" , "0");
|
||||||
|
//WriteValue("/par/TestPulseHighLevel" , "10000");
|
||||||
|
|
||||||
|
//============== ITL
|
||||||
|
WriteValue("/par/ITLAMainLogic" , "OR");
|
||||||
|
WriteValue("/par/ITLAMajorityLev" , "2");
|
||||||
|
WriteValue("/par/ITLAPairLogic" , "NONE");
|
||||||
|
WriteValue("/par/ITLAPolarity" , "Direct");
|
||||||
|
WriteValue("/par/ITLAGateWidth" , "100");
|
||||||
|
|
||||||
|
WriteValue("/par/ITLBMainLogic" , "OR");
|
||||||
|
WriteValue("/par/ITLBMajorityLev" , "2");
|
||||||
|
WriteValue("/par/ITLBPairLogic" , "NONE");
|
||||||
|
WriteValue("/par/ITLBPolarity" , "Direct");
|
||||||
|
WriteValue("/par/ITLBGateWidth" , "100");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Digitizer2Gen::ProgramPHAChannels(bool testPulse){
|
||||||
|
|
||||||
|
|
||||||
// Channel setting
|
// Channel setting
|
||||||
if( testPulse){
|
if( testPulse){
|
||||||
WriteValue("/ch/0..63/par/ChEnable" , "false");
|
WriteValue("/ch/0..63/par/ChEnable" , "false");
|
||||||
|
@ -658,84 +700,64 @@ void Digitizer2Gen::ProgramPHA(bool testPulse){
|
||||||
WriteValue("/par/GlobalTriggerSource", "SwTrg | TestPulse");
|
WriteValue("/par/GlobalTriggerSource", "SwTrg | TestPulse");
|
||||||
WriteValue("/par/TestPulsePeriod" , "1000000"); // 1.0 msec = 1000Hz, tested, 1 trace recording
|
WriteValue("/par/TestPulsePeriod" , "1000000"); // 1.0 msec = 1000Hz, tested, 1 trace recording
|
||||||
WriteValue("/par/TestPulseWidth" , "1000"); // nsec
|
WriteValue("/par/TestPulseWidth" , "1000"); // nsec
|
||||||
WriteValue("/par/TestPulseLowLevel" , "0");
|
WriteValue("/par/TestPulseLowLevel" , "0");
|
||||||
WriteValue("/par/TestPulseHighLevel" , "10000");
|
WriteValue("/par/TestPulseHighLevel" , "10000");
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
//======= this is for manual send trigger signal via software
|
|
||||||
//WriteValue("/ch/0..63/par/EventTriggerSource", "SwTrg");
|
|
||||||
//WriteValue("/ch/0..63/par/WaveTriggerSource" , "SwTrg");
|
|
||||||
|
|
||||||
|
|
||||||
//======== Self trigger for each channel
|
//======== Self trigger for each channel
|
||||||
WriteValue("/ch/0..63/par/EventTriggerSource", "ChSelfTrigger");
|
WriteValue("/ch/0..63/par/ChEnable" , "true");
|
||||||
WriteValue("/ch/0..63/par/WaveTriggerSource" , "ChSelfTrigger");
|
WriteValue("/ch/0..63/par/WaveAnalogProbe0" , "ADCInput");
|
||||||
|
WriteValue("/ch/0..63/par/WaveResolution" , "RES8"); /// 8 ns
|
||||||
|
WriteValue("/ch/0..63/par/WaveSaving" , "OnRequest");
|
||||||
|
WriteValue("/ch/0..63/par/PulsePolarity" , "Positive");
|
||||||
|
WriteValue("/ch/0..63/par/EnergyFilterLFLimitation" , "Off");
|
||||||
|
WriteValue("/ch/0..63/par/DCOffset" , "10"); /// 10%
|
||||||
|
WriteValue("/ch/0..63/par/TriggerThr" , "1000");
|
||||||
|
|
||||||
//======== One (or more) slef-trigger can trigger whole board, ??? depend on Channel Trigger mask
|
WriteValue("/ch/0..63/par/TimeFilterRiseTimeS" , "10"); // 80 ns
|
||||||
//WriteValue("/ch/0..63/par/EventTriggerSource", "Ch64Trigger");
|
WriteValue("/ch/0..63/par/TimeFilterRetriggerGuardS" , "10"); // 80 ns
|
||||||
//WriteValue("/ch/0..63/par/WaveTriggerSource" , "Ch64Trigger");
|
WriteValue("/ch/0..63/par/ChRecordLengthT" , "4096"); /// 4096 ns, S and T are not Sync
|
||||||
|
WriteValue("/ch/0..63/par/ChPreTriggerT" , "1000"); /// 1000 ns
|
||||||
|
|
||||||
//WriteValue("/ch/0..63/par/ChannelsTriggerMask", "0x0000FFFF000F000F");
|
//======== Trapezoid setting
|
||||||
|
WriteValue("/ch/0..63/par/EnergyFilterRiseTimeS" , "62"); // 496 ns
|
||||||
|
WriteValue("/ch/0..63/par/EnergyFilterFlatTopS" , "200"); // 1600 ns
|
||||||
|
WriteValue("/ch/0..63/par/EnergyFilterPoleZeroS" , "6250"); // 50 us
|
||||||
|
WriteValue("/ch/0..63/par/EnergyFilterPeakingPosition" , "20"); // 20 % = Flatup * 20% = 320 ns
|
||||||
|
WriteValue("/ch/0..63/par/EnergyFilterBaselineGuardS" , "100"); // 800 ns
|
||||||
|
WriteValue("/ch/0..63/par/EnergyFilterPileupGuardS" , "10"); // 80 ns
|
||||||
|
WriteValue("/ch/0..63/par/EnergyFilterBaselineAvg" , "Medium"); // 1024 sample
|
||||||
|
WriteValue("/ch/0..63/par/EnergyFilterFineGain" , "1.0");
|
||||||
|
WriteValue("/ch/0..63/par/EnergyFilterPeakingAvg" , "LowAVG");
|
||||||
|
|
||||||
//WriteValue("/ch/0..3/par/ChannelsTriggerMask", "0x1");
|
//======== Probe Setting
|
||||||
//WriteValue("/ch/4..7/par/ChannelsTriggerMask", "0x10");
|
WriteValue("/ch/0..63/par/WaveAnalogProbe0" , "ADCInput");
|
||||||
|
WriteValue("/ch/0..63/par/WaveAnalogProbe1" , "EnergyFilterMinusBaseline");
|
||||||
|
WriteValue("/ch/0..63/par/WaveDigitalProbe0" , "Trigger");
|
||||||
|
WriteValue("/ch/0..63/par/WaveDigitalProbe1" , "EnergyFilterPeaking");
|
||||||
|
WriteValue("/ch/0..63/par/WaveDigitalProbe2" , "TimeFilterArmed");
|
||||||
|
WriteValue("/ch/0..63/par/WaveDigitalProbe3" , "EnergyFilterPeakReady");
|
||||||
|
|
||||||
//WriteValue("/ch/0/par/ChannelsTriggerMask", "0x000F");
|
//======== Trigger setting
|
||||||
//WriteValue("/ch/12/par/ChannelsTriggerMask", "0x000F");
|
WriteValue("/ch/0..63/par/EventTriggerSource" , "ChSelfTrigger");
|
||||||
//WriteValue("/ch/38/par/ChannelsTriggerMask", "0x000F"); // when channel has no input, it still record.
|
WriteValue("/ch/0..63/par/WaveTriggerSource" , "Disabled");
|
||||||
|
WriteValue("/ch/0..63/par/ChannelVetoSource" , "Disabled");
|
||||||
|
WriteValue("/ch/0..63/par/ChannelsTriggerMask" , "0x0");
|
||||||
|
WriteValue("/ch/0..63/par/CoincidenceMask" , "Disabled");
|
||||||
|
WriteValue("/ch/0..63/par/AntiCoincidenceMask" , "Disabled");
|
||||||
|
WriteValue("/ch/0..63/par/CoincidenceLengthT" , "0");
|
||||||
|
WriteValue("/ch/0..63/par/ADCVetoWidth" , "0");
|
||||||
|
|
||||||
//----------- coincident trigger to ch-4n
|
//======== Other Setting
|
||||||
//WriteValue("/ch/0..63/par/EventTriggerSource", "ChSelfTrigger");
|
WriteValue("/ch/0..63/par/EventSelector" , "All");
|
||||||
//WriteValue("/ch/0..63/par/WaveTriggerSource" , "ChSelfTrigger");
|
WriteValue("/ch/0..63/par/WaveSelector" , "All");
|
||||||
|
WriteValue("/ch/0..63/par/EnergySkimLowDiscriminator" , "0");
|
||||||
|
WriteValue("/ch/0..63/par/EnergySkimHighDiscriminator" , "0");
|
||||||
|
WriteValue("/ch/0..63/par/ITLConnect" , "Disabled");
|
||||||
|
|
||||||
//for(int i = 0 ; i < 16; i++){
|
|
||||||
// WriteValue(("/ch/"+ std::to_string(4*i+1) + ".." + std::to_string(4*i+3) + "/par/ChannelsTriggerMask").c_str(), "0x1");
|
|
||||||
// WriteValue(("/ch/"+ std::to_string(4*i+1) + ".." + std::to_string(4*i+3) + "/par/CoincidenceMask").c_str(), "Ch64Trigger");
|
|
||||||
// WriteValue(("/ch/"+ std::to_string(4*i+1) + ".." + std::to_string(4*i+3) + "/par/CoincidenceLengthT").c_str(), "100"); // ns
|
|
||||||
//}
|
|
||||||
//======== ACQ trigger?
|
|
||||||
//WriteValue("/ch/0..63/par/EventTriggerSource", "GlobalTriggerSource");
|
|
||||||
//WriteValue("/ch/0..63/par/WaveTriggerSource" , "GlobalTriggerSource");
|
|
||||||
|
|
||||||
//WriteValue("/par/GlobalTriggerSource", "SwTrg");
|
|
||||||
|
|
||||||
|
|
||||||
WriteValue("/ch/0..63/par/ChEnable" , "true");
|
|
||||||
//WriteValue("/ch/0..15/par/ChEnable" , "true");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteValue("/ch/0..63/par/DCOffset" , "10"); /// 10%
|
|
||||||
WriteValue("/ch/0..63/par/WaveSaving" , "OnRequest");
|
|
||||||
|
|
||||||
WriteValue("/ch/0..63/par/ChRecordLengthT" , "4096"); /// 4096 ns, S and T are not Sync
|
|
||||||
WriteValue("/ch/0..63/par/ChPreTriggerT" , "1000"); /// 1000 ns
|
|
||||||
WriteValue("/ch/0..63/par/WaveResolution" , "RES8"); /// 8 ns
|
|
||||||
|
|
||||||
WriteValue("/ch/0..63/par/WaveAnalogProbe0" , "ADCInput");
|
|
||||||
WriteValue("/ch/0..63/par/WaveAnalogProbe1" , "EnergyFilterMinusBaseline");
|
|
||||||
WriteValue("/ch/0..63/par/WaveDigitalProbe0" , "Trigger");
|
|
||||||
WriteValue("/ch/0..63/par/WaveDigitalProbe1" , "EnergyFilterPeaking");
|
|
||||||
WriteValue("/ch/0..63/par/WaveDigitalProbe2" , "TimeFilterArmed");
|
|
||||||
WriteValue("/ch/0..63/par/WaveDigitalProbe3" , "EnergyFilterPeakReady");
|
|
||||||
|
|
||||||
// Filter parameters
|
|
||||||
WriteValue("/ch/0..63/par/TimeFilterRiseTimeS" , "10"); // 80 ns
|
|
||||||
WriteValue("/ch/0..63/par/TriggerThr" , "1000");
|
|
||||||
WriteValue("/ch/0..63/par/PulsePolarity" , "Positive");
|
|
||||||
WriteValue("/ch/0..63/par/EnergyFilterBaselineAvg" , "Medium"); // 1024 sample
|
|
||||||
WriteValue("/ch/0..63/par/EnergyFilterFineGain" , "1.0");
|
|
||||||
|
|
||||||
WriteValue("/ch/0..63/par/EnergyFilterRiseTimeS" , "62"); // 496 ns
|
|
||||||
WriteValue("/ch/0..63/par/EnergyFilterFlatTopS" , "200"); // 1600 ns
|
|
||||||
WriteValue("/ch/0..63/par/EnergyFilterPoleZeroS" , "6250"); // 50 us
|
|
||||||
|
|
||||||
WriteValue("/ch/0..63/par/EnergyFilterPeakingPosition" , "20"); // 20 % = Flatup * 20% = 320 ns
|
|
||||||
|
|
||||||
WriteValue("/ch/0..63/par/TimeFilterRetriggerGuardS" , "10"); // 80 ns
|
|
||||||
WriteValue("/ch/0..63/par/EnergyFilterPileupGuardS" , "10"); // 80 ns
|
|
||||||
WriteValue("/ch/0..63/par/EnergyFilterBaselineGuardS" , "100"); // 800 ns
|
|
||||||
|
|
||||||
WriteValue("/ch/0..63/par/EnergyFilterLFLimitation" , "Off");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,8 @@ class Digitizer2Gen {
|
||||||
uint64_t GetRealTime(int ch) const {return realTime[ch];}
|
uint64_t GetRealTime(int ch) const {return realTime[ch];}
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
void ProgramPHA(bool testPulse = false);
|
void ProgramPHABoard();
|
||||||
|
void ProgramPHAChannels(bool testPulse = false);
|
||||||
|
|
||||||
unsigned short GetNChannels() const {return nChannels;}
|
unsigned short GetNChannels() const {return nChannels;}
|
||||||
unsigned short GetCh2ns() const {return ch2ns;}
|
unsigned short GetCh2ns() const {return ch2ns;}
|
||||||
|
|
|
@ -81,6 +81,7 @@ then ` make`
|
||||||
|
|
||||||
# Known Issues
|
# Known Issues
|
||||||
|
|
||||||
-The "Trig." Rate in the Scaler does not included the coincident condition. This is related to the ChSavedEventCnt from the firmware.
|
- The "Trig." Rate in the Scaler does not included the coincident condition. This is related to the ChSavedEventCnt from the firmware.
|
||||||
-LVDSTrgMask cannot acess.
|
- LVDSTrgMask cannot acess.
|
||||||
-The CoincidenceLengthT not loaded.
|
- The CoincidenceLengthT not loaded.
|
||||||
|
- Sometime, the digitizer halt after sent the /cmd/armacquisition command. This is CAEN library problem.
|
|
@ -611,6 +611,9 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
SetupComboBox(cbITLAPolarity[iDigi], PHA::DIG::ITLAPolarity, -1, false, "Polarity", aLayout, 3, 0);
|
SetupComboBox(cbITLAPolarity[iDigi], PHA::DIG::ITLAPolarity, -1, false, "Polarity", aLayout, 3, 0);
|
||||||
SetupSpinBox( sbITLAGateWidth[iDigi], PHA::DIG::ITLAGateWidth, -1, false, "Output GateWidth [ns]", aLayout, 4, 0);
|
SetupSpinBox( sbITLAGateWidth[iDigi], PHA::DIG::ITLAGateWidth, -1, false, "Output GateWidth [ns]", aLayout, 4, 0);
|
||||||
|
|
||||||
|
connect(cbITLAMainLogic[iDigi], &RComboBox::currentIndexChanged, this, [=](){
|
||||||
|
sbITLAMajority[iDigi]->setEnabled(cbITLAMainLogic[iDigi]->currentData().toString() == "Majority");
|
||||||
|
});
|
||||||
|
|
||||||
QGroupBox * gbITLB = new QGroupBox("ITL-B", bdITL[iDigi]);
|
QGroupBox * gbITLB = new QGroupBox("ITL-B", bdITL[iDigi]);
|
||||||
ITLLayout->addWidget(gbITLB, 0, 1);
|
ITLLayout->addWidget(gbITLB, 0, 1);
|
||||||
|
@ -622,6 +625,9 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
SetupComboBox(cbITLBPolarity[iDigi], PHA::DIG::ITLBPolarity, -1, false, "Polarity", bLayout, 3, 0);
|
SetupComboBox(cbITLBPolarity[iDigi], PHA::DIG::ITLBPolarity, -1, false, "Polarity", bLayout, 3, 0);
|
||||||
SetupSpinBox( sbITLBGateWidth[iDigi], PHA::DIG::ITLBGateWidth, -1, false, "Output GateWidth [ns]", bLayout, 4, 0);
|
SetupSpinBox( sbITLBGateWidth[iDigi], PHA::DIG::ITLBGateWidth, -1, false, "Output GateWidth [ns]", bLayout, 4, 0);
|
||||||
|
|
||||||
|
connect(cbITLBMainLogic[iDigi], &RComboBox::currentIndexChanged, this, [=](){
|
||||||
|
sbITLBMajority[iDigi]->setEnabled(cbITLBMainLogic[iDigi]->currentData().toString() == "Majority");
|
||||||
|
});
|
||||||
|
|
||||||
QGroupBox * gbITL = new QGroupBox("ITL-Connect", bdITL[iDigi]);
|
QGroupBox * gbITL = new QGroupBox("ITL-Connect", bdITL[iDigi]);
|
||||||
ITLLayout->addWidget(gbITL, 1, 0, 1, 2);
|
ITLLayout->addWidget(gbITL, 1, 0, 1, 2);
|
||||||
|
@ -967,7 +973,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
leTriggerMask[ID][ch]->setText(SixteenBaseValue);
|
leTriggerMask[ID][ch]->setText(SixteenBaseValue);
|
||||||
|
|
||||||
QString msg;
|
QString msg;
|
||||||
msg = QString::fromStdString(PHA::CH::ChannelsTriggerMask.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
|
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::CH::ChannelsTriggerMask.GetPara()) ;
|
||||||
msg += ",CH:" + (index == -1 ? "All" : QString::number(index));
|
msg += ",CH:" + (index == -1 ? "All" : QString::number(index));
|
||||||
msg += " = " + SixteenBaseValue;
|
msg += " = " + SixteenBaseValue;
|
||||||
|
|
||||||
|
@ -1960,7 +1966,8 @@ void DigiSettingsPanel::LoadSettings(){
|
||||||
|
|
||||||
void DigiSettingsPanel::SetDefaultPHASettigns(){
|
void DigiSettingsPanel::SetDefaultPHASettigns(){
|
||||||
SendLogMsg("Program Digitizer-" + QString::number(digi[ID]->GetSerialNumber()) + " to default PHA.");
|
SendLogMsg("Program Digitizer-" + QString::number(digi[ID]->GetSerialNumber()) + " to default PHA.");
|
||||||
digi[ID]->ProgramPHA();
|
digi[ID]->ProgramPHABoard();
|
||||||
|
digi[ID]->ProgramPHAChannels();
|
||||||
RefreshSettings();
|
RefreshSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2189,6 +2196,10 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isSame ) leTriggerMask[ID][MaxNumberOfChannel]->setText("0x" + QString::number(mask, 16).toUpper());
|
if( isSame ) leTriggerMask[ID][MaxNumberOfChannel]->setText("0x" + QString::number(mask, 16).toUpper());
|
||||||
|
}else{
|
||||||
|
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
|
||||||
|
leTriggerMask[ID][digi[ID]->GetNChannels()]->setText("0x" + QString::number(mask, 16).toUpper());
|
||||||
|
leTriggerMask[ID][digi[ID]->GetNChannels()]->setStyleSheet("");
|
||||||
}
|
}
|
||||||
|
|
||||||
enableSignalSlot = true;
|
enableSignalSlot = true;
|
||||||
|
@ -2256,9 +2267,18 @@ void DigiSettingsPanel::SetStartSource(){
|
||||||
QString msg;
|
QString msg;
|
||||||
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::StartSource.GetPara());
|
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::StartSource.GetPara());
|
||||||
msg += " = " + QString::fromStdString(value);
|
msg += " = " + QString::fromStdString(value);
|
||||||
SendLogMsg(msg);
|
|
||||||
|
|
||||||
digi[ID]->WriteValue(PHA::DIG::StartSource, value);
|
if( digi[ID]->WriteValue(PHA::DIG::StartSource, value) ){
|
||||||
|
SendLogMsg(msg + "|OK.");
|
||||||
|
for( int i = 0; i < (int) PHA::DIG::StartSource.GetAnswers().size(); i++){
|
||||||
|
ckbStartSource[ID][i]->setStyleSheet("");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
SendLogMsg(msg + "|Fail.");
|
||||||
|
for( int i = 0; i < (int) PHA::DIG::StartSource.GetAnswers().size(); i++){
|
||||||
|
ckbStartSource[ID][i]->setStyleSheet("background-color : red");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DigiSettingsPanel::SetGlobalTriggerSource(){
|
void DigiSettingsPanel::SetGlobalTriggerSource(){
|
||||||
|
@ -2281,7 +2301,17 @@ void DigiSettingsPanel::SetGlobalTriggerSource(){
|
||||||
msg += " = " + QString::fromStdString(value);
|
msg += " = " + QString::fromStdString(value);
|
||||||
SendLogMsg(msg);
|
SendLogMsg(msg);
|
||||||
|
|
||||||
digi[ID]->WriteValue(PHA::DIG::GlobalTriggerSource, value);
|
if( digi[ID]->WriteValue(PHA::DIG::GlobalTriggerSource, value) ){
|
||||||
|
SendLogMsg(msg + "|OK.");
|
||||||
|
for( int i = 0; i < (int) PHA::DIG::GlobalTriggerSource.GetAnswers().size(); i++){
|
||||||
|
ckbGlbTrgSource[ID][i]->setStyleSheet("");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
SendLogMsg(msg + "|Fail.");
|
||||||
|
for( int i = 0; i < (int) PHA::DIG::GlobalTriggerSource.GetAnswers().size(); i++){
|
||||||
|
ckbGlbTrgSource[ID][i]->setStyleSheet("background-color : red");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,6 +223,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
bnComment->setEnabled(false);
|
bnComment->setEnabled(false);
|
||||||
bnOpenScope->setEnabled(true);
|
bnOpenScope->setEnabled(true);
|
||||||
chkSaveRun->setEnabled(true);
|
chkSaveRun->setEnabled(true);
|
||||||
|
cbDataFormat->setEnabled(true);
|
||||||
if(chkSaveRun->isChecked() ) cbAutoRun->setEnabled(true);
|
if(chkSaveRun->isChecked() ) cbAutoRun->setEnabled(true);
|
||||||
if( digiSetting ) digiSetting->EnableControl();
|
if( digiSetting ) digiSetting->EnableControl();
|
||||||
}
|
}
|
||||||
|
@ -437,9 +438,11 @@ int MainWindow::StartACQ(){
|
||||||
int dataFormatID = cbDataFormat->currentData().toInt();
|
int dataFormatID = cbDataFormat->currentData().toInt();
|
||||||
digi[i]->SetPHADataFormat(dataFormatID);// only save 1 trace
|
digi[i]->SetPHADataFormat(dataFormatID);// only save 1 trace
|
||||||
|
|
||||||
//Additional settings
|
//Additional settings, it is better user to control
|
||||||
digi[i]->WriteValue("/ch/0..63/par/WaveAnalogProbe0", "ADCInput");
|
//if( cbDataFormat->currentIndex() < 2 ) {
|
||||||
|
// digi[i]->WriteValue("/ch/0..63/par/WaveAnalogProbe0", "ADCInput");
|
||||||
|
// digi[i]->WriteValue(PHA::CH::WaveSaving, "True", -1);
|
||||||
|
//}
|
||||||
|
|
||||||
if( chkSaveRun->isChecked() ){
|
if( chkSaveRun->isChecked() ){
|
||||||
//Save setting to raw data with run ID
|
//Save setting to raw data with run ID
|
||||||
|
@ -587,6 +590,7 @@ void MainWindow::AutoRun(){
|
||||||
bnOpenScope->setEnabled(false);
|
bnOpenScope->setEnabled(false);
|
||||||
chkSaveRun->setEnabled(false);
|
chkSaveRun->setEnabled(false);
|
||||||
cbAutoRun->setEnabled(false);
|
cbAutoRun->setEnabled(false);
|
||||||
|
cbDataFormat->setEnabled(false);
|
||||||
if( digiSetting ) digiSetting->EnableControl();
|
if( digiSetting ) digiSetting->EnableControl();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -646,6 +650,7 @@ void MainWindow::AutoRun(){
|
||||||
if(chkSaveRun->isChecked()) bnComment->setEnabled(true);
|
if(chkSaveRun->isChecked()) bnComment->setEnabled(true);
|
||||||
bnOpenScope->setEnabled(false);
|
bnOpenScope->setEnabled(false);
|
||||||
chkSaveRun->setEnabled(false);
|
chkSaveRun->setEnabled(false);
|
||||||
|
cbDataFormat->setEnabled(false);
|
||||||
cbAutoRun->setEnabled(false);
|
cbAutoRun->setEnabled(false);
|
||||||
if( digiSetting ) digiSetting->EnableControl();
|
if( digiSetting ) digiSetting->EnableControl();
|
||||||
|
|
||||||
|
@ -691,7 +696,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
digi[i]->SetSettingFileName("");
|
digi[i]->SetSettingFileName("");
|
||||||
//LogMsg("Reset digitizer And set default PHA settings.");
|
//LogMsg("Reset digitizer And set default PHA settings.");
|
||||||
//digi[i]->Reset();
|
//digi[i]->Reset();
|
||||||
//digi[i]->ProgramPHA(false);
|
//digi[i]->ProgramPHABoard(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
digi[i]->ReadAllSettings();
|
digi[i]->ReadAllSettings();
|
||||||
|
|
104
scope.cpp
104
scope.cpp
|
@ -80,6 +80,9 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
for( int i = 0; i < digi[index]->GetNChannels(); i++){
|
for( int i = 0; i < digi[index]->GetNChannels(); i++){
|
||||||
cbScopeCh->addItem("ch-" + QString::number(i), i);
|
cbScopeCh->addItem("ch-" + QString::number(i), i);
|
||||||
}
|
}
|
||||||
|
digiMTX[index].lock();
|
||||||
|
ReadScopeSettings();
|
||||||
|
digiMTX[index].unlock();
|
||||||
allowChange = true;
|
allowChange = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -103,14 +106,17 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
allowChange = true;
|
allowChange = true;
|
||||||
|
|
||||||
|
|
||||||
bnScopeReset = new QPushButton("ReProgram Digitizer", this);
|
bnScopeReset = new QPushButton("ReProgram Channels", this);
|
||||||
layout->addWidget(bnScopeReset, rowID, 2);
|
layout->addWidget(bnScopeReset, rowID, 2);
|
||||||
connect(bnScopeReset, &QPushButton::clicked, this, [=](){
|
connect(bnScopeReset, &QPushButton::clicked, this, [=](){
|
||||||
if( !allowChange ) return;
|
if( !allowChange ) return;
|
||||||
int iDigi = cbScopeDigi->currentIndex();
|
int iDigi = cbScopeDigi->currentIndex();
|
||||||
digi[iDigi]->Reset();
|
//digi[iDigi]->Reset();
|
||||||
digi[iDigi]->ProgramPHA(false);
|
digi[iDigi]->ProgramPHAChannels();
|
||||||
SendLogMsg("Reset Digi-" + QString::number(digi[iDigi]->GetSerialNumber()) + " and Set Default PHA.");
|
//SendLogMsg("Reset Digi-" + QString::number(digi[iDigi]->GetSerialNumber()) + " and Set Default PHA.");
|
||||||
|
ReadScopeSettings();
|
||||||
|
UpdateOtherPanels();
|
||||||
|
SendLogMsg("Re-program all Channels to default PHA settings");
|
||||||
});
|
});
|
||||||
|
|
||||||
bnScopeReadSettings = new QPushButton("Read Ch. Settings", this);
|
bnScopeReadSettings = new QPushButton("Read Ch. Settings", this);
|
||||||
|
@ -268,6 +274,8 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
ScopeMakeComoBox(cbTrapPeakAvg, "Trap. Peaking ", bLayout, 3, 2, PHA::CH::EnergyFilterPeakingAvg);
|
ScopeMakeComoBox(cbTrapPeakAvg, "Trap. Peaking ", bLayout, 3, 2, PHA::CH::EnergyFilterPeakingAvg);
|
||||||
ScopeMakeSpinBox(sbBaselineGuard, "Baseline Guard [ns] ", bLayout, 3, 4, PHA::CH::EnergyFilterBaselineGuard);
|
ScopeMakeSpinBox(sbBaselineGuard, "Baseline Guard [ns] ", bLayout, 3, 4, PHA::CH::EnergyFilterBaselineGuard);
|
||||||
ScopeMakeComoBox(cbBaselineAvg, "Baseline Avg ", bLayout, 3, 6, PHA::CH::EnergyFilterBaselineAvg);
|
ScopeMakeComoBox(cbBaselineAvg, "Baseline Avg ", bLayout, 3, 6, PHA::CH::EnergyFilterBaselineAvg);
|
||||||
|
|
||||||
|
//----------------- next row
|
||||||
ScopeMakeSpinBox(sbPileUpGuard, "Pile-up Guard [ns] ", bLayout, 4, 0, PHA::CH::EnergyFilterPileUpGuard);
|
ScopeMakeSpinBox(sbPileUpGuard, "Pile-up Guard [ns] ", bLayout, 4, 0, PHA::CH::EnergyFilterPileUpGuard);
|
||||||
ScopeMakeComoBox(cbLowFreqFilter, "Low Freq. Filter ", bLayout, 4, 2, PHA::CH::EnergyFilterLowFreqFilter);
|
ScopeMakeComoBox(cbLowFreqFilter, "Low Freq. Filter ", bLayout, 4, 2, PHA::CH::EnergyFilterLowFreqFilter);
|
||||||
|
|
||||||
|
@ -321,6 +329,8 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
|
|
||||||
//StartScope();
|
//StartScope();
|
||||||
|
|
||||||
|
UpdateSettingsFromMemeory();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope::~Scope(){
|
Scope::~Scope(){
|
||||||
|
@ -342,33 +352,35 @@ void Scope::ReadScopeSettings(){
|
||||||
int iDigi = cbScopeDigi->currentIndex();
|
int iDigi = cbScopeDigi->currentIndex();
|
||||||
if( !digi[iDigi] || digi[iDigi]->IsDummy() || !digi[iDigi]->IsConnected()) return;
|
if( !digi[iDigi] || digi[iDigi]->IsDummy() || !digi[iDigi]->IsConnected()) return;
|
||||||
|
|
||||||
int ch = cbScopeCh->currentIndex();
|
// int ch = cbScopeCh->currentIndex();
|
||||||
digi[iDigi]->ReadValue(PHA::CH::WaveAnalogProbe0, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::WaveAnalogProbe0, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::WaveAnalogProbe1, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::WaveAnalogProbe1, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe0, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe0, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe1, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe1, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe2, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe2, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe3, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe3, ch);
|
||||||
|
|
||||||
digi[iDigi]->ReadValue(PHA::CH::Polarity, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::Polarity, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::WaveResolution, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::WaveResolution, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPeakingAvg, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPeakingAvg, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterBaselineAvg, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::EnergyFilterBaselineAvg, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterLowFreqFilter, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::EnergyFilterLowFreqFilter, ch);
|
||||||
|
|
||||||
digi[iDigi]->ReadValue(PHA::CH::RecordLength, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::RecordLength, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::PreTrigger, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::PreTrigger, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::DC_Offset, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::DC_Offset, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::TriggerThreshold, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::TriggerThreshold, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::TimeFilterRiseTime, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::TimeFilterRiseTime, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::TimeFilterRetriggerGuard, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::TimeFilterRetriggerGuard, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterRiseTime, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::EnergyFilterRiseTime, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterFlatTop, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::EnergyFilterFlatTop, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPoleZero, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPoleZero, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterFineGain, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::EnergyFilterFineGain, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPeakingPosition, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPeakingPosition, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterBaselineGuard, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::EnergyFilterBaselineGuard, ch);
|
||||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPileUpGuard, ch);
|
// digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPileUpGuard, ch);
|
||||||
|
|
||||||
|
// digi[iDigi]->ReadValue(PHA::CH::WaveTriggerSource, ch);
|
||||||
|
|
||||||
UpdateSettingsFromMemeory();
|
UpdateSettingsFromMemeory();
|
||||||
|
|
||||||
|
@ -446,11 +458,23 @@ void Scope::StartScope(){
|
||||||
|
|
||||||
ReadScopeSettings();
|
ReadScopeSettings();
|
||||||
|
|
||||||
digi[iDigi]->WriteValue(PHA::CH::WaveSaving, "Always", -1);
|
for( int ch2 = 0 ; ch2 < digi[iDigi]->GetNChannels(); ch2 ++){
|
||||||
|
channelEnable[iDigi][ch2] = digi[iDigi]->ReadValue(PHA::CH::ChannelEnable, ch2);
|
||||||
|
}
|
||||||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "False", -1);
|
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "False", -1);
|
||||||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "True", ch);
|
|
||||||
digi[iDigi]->SetPHADataFormat(0);
|
|
||||||
|
|
||||||
|
if( iDigi == cbScopeDigi->currentIndex() ){
|
||||||
|
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "True", ch);
|
||||||
|
|
||||||
|
waveSaving = digi[iDigi]->ReadValue(PHA::CH::WaveSaving, ch);
|
||||||
|
digi[iDigi]->WriteValue(PHA::CH::WaveSaving, "Always", ch);
|
||||||
|
|
||||||
|
waveTriggerSource = digi[iDigi]->ReadValue(PHA::CH::WaveTriggerSource, ch);
|
||||||
|
digi[iDigi]->WriteValue(PHA::CH::WaveTriggerSource, "ChSelfTrigger", ch);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
digi[iDigi]->SetPHADataFormat(0);
|
||||||
digi[iDigi]->StartACQ();
|
digi[iDigi]->StartACQ();
|
||||||
|
|
||||||
readDataThread[iDigi]->SetSaveData(false);
|
readDataThread[iDigi]->SetSaveData(false);
|
||||||
|
@ -476,19 +500,27 @@ void Scope::StopScope(){
|
||||||
if(digi){
|
if(digi){
|
||||||
for(int i = 0; i < nDigi; i++){
|
for(int i = 0; i < nDigi; i++){
|
||||||
if( digi[i]->IsDummy() ) continue;
|
if( digi[i]->IsDummy() ) continue;
|
||||||
digiMTX[i].lock();
|
|
||||||
digi[i]->StopACQ();
|
|
||||||
digi[i]->WriteValue(PHA::CH::ChannelEnable, "True", -1);
|
|
||||||
digiMTX[i].unlock();
|
|
||||||
|
|
||||||
readDataThread[i]->Stop();
|
readDataThread[i]->Stop();
|
||||||
readDataThread[i]->quit();
|
readDataThread[i]->quit();
|
||||||
readDataThread[i]->wait();
|
readDataThread[i]->wait();
|
||||||
|
|
||||||
|
digiMTX[i].lock();
|
||||||
|
digi[i]->StopACQ();
|
||||||
|
for( int ch2 = 0 ; ch2 < digi[i]->GetNChannels(); ch2 ++){
|
||||||
|
digi[i]->WriteValue(PHA::CH::ChannelEnable, channelEnable[i][ch2], ch2);
|
||||||
|
}
|
||||||
|
if( i == cbScopeDigi->currentIndex() ) {
|
||||||
|
digi[i]->WriteValue(PHA::CH::WaveTriggerSource, waveTriggerSource, cbScopeCh->currentIndex());
|
||||||
|
digi[i]->WriteValue(PHA::CH::WaveSaving, waveSaving, cbScopeCh->currentIndex());
|
||||||
|
}
|
||||||
|
digiMTX[i].unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit TellACQOnOff(false);
|
emit TellACQOnOff(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ScopeControlOnOff(true);
|
ScopeControlOnOff(true);
|
||||||
emit TellSettingsPanelControlOnOff();
|
emit TellSettingsPanelControlOnOff();
|
||||||
|
|
||||||
|
|
4
scope.h
4
scope.h
|
@ -201,6 +201,10 @@ private:
|
||||||
|
|
||||||
bool allowChange;
|
bool allowChange;
|
||||||
|
|
||||||
|
// remembee setting, once the scope stop, restore it.
|
||||||
|
std::string channelEnable[MaxNumberOfDigitizer][MaxNumberOfChannel];
|
||||||
|
std::string waveSaving;
|
||||||
|
std::string waveTriggerSource;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
2
test.cpp
2
test.cpp
|
@ -90,7 +90,7 @@ int main(int argc, char* argv[]){
|
||||||
|
|
||||||
digi->OpenDigitizer(url);
|
digi->OpenDigitizer(url);
|
||||||
digi->Reset();
|
digi->Reset();
|
||||||
//digi->ProgramPHA(false);
|
//digi->ProgramPHABoard(false);
|
||||||
|
|
||||||
//printf("--------%s \n", digi->ReadChValue("0..63", "WaveAnalogprobe0", true).c_str());
|
//printf("--------%s \n", digi->ReadChValue("0..63", "WaveAnalogprobe0", true).c_str());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user