properly set trace length and delay

This commit is contained in:
Ryan Tang 2022-03-16 18:56:56 -04:00
parent 7005979ec9
commit d60ad72d84
2 changed files with 27 additions and 14 deletions

View File

@ -158,19 +158,19 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi
col++; col++;
double tracelen = pixie->GetChannelTraceLength(modID, i); double tracelen = pixie->GetChannelTraceLength(modID, i);
if( pixie->GetChannelTraceOnOff(modID, i) == false ) tracelen = -1; if( pixie->GetChannelTraceOnOff(modID, i) == false ) tracelen = 0;
neTraceLength[i] = new TGNumberEntry(hframeCh[i], tracelen, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber); neTraceLength[i] = new TGNumberEntry(hframeCh[i], tracelen, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
neTraceLength[i]->SetWidth(width[col]); 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)); neTraceLength[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTraceLenght(=%d)", i));
hframeCh[i]->AddFrame(neTraceLength[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); hframeCh[i]->AddFrame(neTraceLength[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
col++; col++;
double tracedel = pixie->GetChannelTraceDelay(modID, i); double tracedel = pixie->GetChannelTraceDelay(modID, i);
if( pixie->GetChannelTraceOnOff(modID, i) == false ) tracedel = -1; if( pixie->GetChannelTraceOnOff(modID, i) == false ) tracedel = 0;
neTraceDelay[i] = new TGNumberEntry(hframeCh[i], tracedel, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber); neTraceDelay[i] = new TGNumberEntry(hframeCh[i], tracedel, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
neTraceDelay[i]->SetWidth(width[col]); 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)); neTraceDelay[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTraceDelay(=%d)", i));
hframeCh[i]->AddFrame(neTraceDelay[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); 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){ void MainSettings::ChangeTraceLenght(unsigned short ch){
//TODO need to set On Off
short modID = modIDEntry->GetNumber(); short modID = modIDEntry->GetNumber();
double val = neTraceLength[ch]->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)"); teFileName->SetText(settingFileName + " (not saved)");
} }
void MainSettings::ChangeTraceDelay(unsigned short ch){ void MainSettings::ChangeTraceDelay(unsigned short ch){
//TODO need to set On Off
short modID = modIDEntry->GetNumber(); short modID = modIDEntry->GetNumber();
double val = neTraceDelay[ch]->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)"); teFileName->SetText(settingFileName + " (not saved)");
} }

View File

@ -98,7 +98,7 @@
16544, 16544,
16544, 16544,
16544, 16544,
16548, 16804,
16804, 16804,
16544, 16544,
16544, 16544,
@ -421,7 +421,7 @@
32768, 32768,
32768, 32768,
32768, 32768,
32768, 34952,
32768, 32768,
21845, 21845,
32768, 32768,
@ -440,7 +440,7 @@
1768, 1768,
1768, 1768,
1768, 1768,
1768, 1018,
666, 666,
1768, 1768,
1768, 1768,
@ -1016,7 +1016,7 @@
"ChanNum": 0, "ChanNum": 0,
"CoincPattern": 0, "CoincPattern": 0,
"CoincWait": 0, "CoincWait": 0,
"ControlTask": 23, "ControlTask": 0,
"CrateID": 0, "CrateID": 0,
"FIFOLength": 8188, "FIFOLength": 8188,
"FastFilterRange": 0, "FastFilterRange": 0,