From d60ad72d84b32aa4f1ca55b97dc21e1c2a47797e Mon Sep 17 00:00:00 2001 From: "Ryan@Debain10" Date: Wed, 16 Mar 2022 18:56:56 -0400 Subject: [PATCH] properly set trace length and delay --- mainSettings.cpp | 33 +++++++++++++++++++++++---------- test_ryan.set | 8 ++++---- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/mainSettings.cpp b/mainSettings.cpp index 1136dbe..b360687 100644 --- a/mainSettings.cpp +++ b/mainSettings.cpp @@ -158,19 +158,19 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi 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); + if( pixie->GetChannelTraceOnOff(modID, i) == false ) tracelen = 0; + neTraceLength[i] = new TGNumberEntry(hframeCh[i], tracelen, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); neTraceLength[i]->SetWidth(width[col]); - neTraceLength[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, -1, 20.0); + neTraceLength[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 20.0); neTraceLength[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTraceLenght(=%d)", i)); 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); + if( pixie->GetChannelTraceOnOff(modID, i) == false ) tracedel = 0; + neTraceDelay[i] = new TGNumberEntry(hframeCh[i], tracedel, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); neTraceDelay[i]->SetWidth(width[col]); - neTraceDelay[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, -1, 20.0); + neTraceDelay[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 20.0); neTraceDelay[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTraceDelay(=%d)", i)); hframeCh[i]->AddFrame(neTraceDelay[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); @@ -285,18 +285,31 @@ void MainSettings::ChangeTau(unsigned short ch){ } void MainSettings::ChangeTraceLenght(unsigned short ch){ - //TODO need to set On Off short modID = modIDEntry->GetNumber(); double val = neTraceLength[ch]->GetNumber(); - pixie->SetChannelTraceLenght(val, modID, ch); + if( val > 0 ){ + pixie->SetChannelTraceOnOff(true, modID, ch); + pixie->SetChannelTraceLenght(val, modID, ch); + neTraceDelay[ch]->SetNumber(pixie->GetChannelTraceDelay(modID, ch)); + }else{ + pixie->SetChannelTraceOnOff(false, modID, ch); + neTraceDelay[ch]->SetNumber(0.); + } teFileName->SetText(settingFileName + " (not saved)"); } void MainSettings::ChangeTraceDelay(unsigned short ch){ - //TODO need to set On Off short modID = modIDEntry->GetNumber(); double val = neTraceDelay[ch]->GetNumber(); - pixie->SetChannelTraceDelay(val, modID, ch); + + if( val > 0 ){ + pixie->SetChannelTraceOnOff(true, modID, ch); + pixie->SetChannelTraceDelay(val, modID, ch); + neTraceLength[ch]->SetNumber(pixie->GetChannelTraceLength(modID, ch)); + }else{ + pixie->SetChannelTraceOnOff(false, modID, ch); + neTraceLength[ch]->SetNumber(0.); + } teFileName->SetText(settingFileName + " (not saved)"); } diff --git a/test_ryan.set b/test_ryan.set index 7eab454..9f672d2 100644 --- a/test_ryan.set +++ b/test_ryan.set @@ -98,7 +98,7 @@ 16544, 16544, 16544, - 16548, + 16804, 16804, 16544, 16544, @@ -421,7 +421,7 @@ 32768, 32768, 32768, - 32768, + 34952, 32768, 21845, 32768, @@ -440,7 +440,7 @@ 1768, 1768, 1768, - 1768, + 1018, 666, 1768, 1768, @@ -1016,7 +1016,7 @@ "ChanNum": 0, "CoincPattern": 0, "CoincWait": 0, - "ControlTask": 23, + "ControlTask": 0, "CrateID": 0, "FIFOLength": 8188, "FastFilterRange": 0,