2022-08-23 13:43:05 -04:00
# include <TApplication.h>
# include <TGClient.h>
# include <TCanvas.h>
# include <TF1.h>
# include <TRandom.h>
# include <TGButton.h>
# include <TRootEmbeddedCanvas.h>
# include <TGTableContainer.h>
# include <TGFileDialog.h>
2022-09-23 17:43:30 -04:00
# include "channelSettingPHA.h"
2022-09-22 16:26:33 -04:00
2022-10-26 13:23:21 -04:00
///========= declared at FSUDAQ.cpp
extern Pixel_t red , blue , green ;
extern unsigned short nDigi ;
extern Digitizer * * digi ;
ChannelSettingPHA : : ChannelSettingPHA ( const TGWindow * p , UInt_t w , UInt_t h , int boardID ) {
2022-09-16 17:53:57 -04:00
2022-08-23 13:43:05 -04:00
fMain = new TGMainFrame ( p , w , h ) ;
2022-09-23 17:43:30 -04:00
fMain - > SetWindowName ( " Channel Settings PHA " ) ;
fMain - > Connect ( " CloseWindow() " , " ChannelSettingPHA " , this , " CloseWindow() " ) ;
2022-09-21 17:40:47 -04:00
2022-10-18 17:23:29 -04:00
TGLayoutHints * layoutHintsR = new TGLayoutHints ( kLHintsRight , 5 , 5 , 3 , 3 ) ; /// left, right, top, bottom
2022-09-21 17:40:47 -04:00
TGLayoutHints * layoutHints = new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY , 5 , 5 , 0 , 0 ) ; /// left, right, top, bottom
2022-08-29 18:06:12 -04:00
2022-08-23 13:43:05 -04:00
TGVerticalFrame * vframe = new TGVerticalFrame ( fMain ) ;
fMain - > AddFrame ( vframe , new TGLayoutHints ( kLHintsCenterX , 2 , 2 , 2 , 2 ) ) ;
2022-09-16 17:53:57 -04:00
TGHorizontalFrame * hframe0 = new TGHorizontalFrame ( vframe , w , 50 ) ; vframe - > AddFrame ( hframe0 , new TGLayoutHints ( kLHintsCenterX , 2 , 2 , 2 , 2 ) ) ;
2022-08-23 13:43:05 -04:00
///==========Board choose
2022-09-16 17:53:57 -04:00
TGLabel * lb0 = new TGLabel ( hframe0 , " Module ID : " ) ; hframe0 - > AddFrame ( lb0 , new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY , 5 , 5 , 3 , 4 ) ) ;
2022-09-23 17:43:30 -04:00
boardIDEntry = new TGNumberEntry ( hframe0 , boardID , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; hframe0 - > AddFrame ( boardIDEntry , new TGLayoutHints ( kLHintsCenterX , 5 , 5 , 3 , 4 ) ) ;
2022-08-23 13:43:05 -04:00
boardIDEntry - > SetWidth ( 50 ) ;
boardIDEntry - > SetLimits ( TGNumberFormat : : kNELLimitMinMax , 0 , nDigi ) ;
2022-09-23 17:43:30 -04:00
boardIDEntry - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " ChangeBoard() " ) ;
2022-08-23 13:43:05 -04:00
if ( nDigi < = 1 ) boardIDEntry - > SetState ( false ) ;
2022-09-23 17:43:30 -04:00
this - > presentBoardID = boardID ;
2022-10-04 16:54:01 -04:00
NChannel = 16 ;
if ( digi ! = NULL ) NChannel = digi [ boardID ] - > GetNChannel ( ) ;
TGLabel * lba = new TGLabel ( hframe0 , Form ( " Serial : %03d " , digi = = NULL ? - 1 : digi [ boardID ] - > GetSerialNumber ( ) ) ) ; hframe0 - > AddFrame ( lba , new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY , 5 , 5 , 3 , 4 ) ) ;
2022-08-23 13:43:05 -04:00
2022-09-16 17:53:57 -04:00
TGLabel * lb1 = new TGLabel ( hframe0 , " Channel : " ) ; hframe0 - > AddFrame ( lb1 , new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY , 5 , 5 , 3 , 4 ) ) ;
2022-09-28 17:54:33 -04:00
chIDEntry = new TGNumberEntry ( hframe0 , 0 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEAAnyNumber ) ; hframe0 - > AddFrame ( chIDEntry , new TGLayoutHints ( kLHintsCenterX , 5 , 5 , 3 , 4 ) ) ;
2022-08-23 13:43:05 -04:00
chIDEntry - > SetWidth ( 50 ) ;
2022-09-22 16:26:33 -04:00
chIDEntry - > SetLimits ( TGNumberFormat : : kNELLimitMinMax , - 1 , NChannel - 1 ) ;
chIDEntry - > SetNumber ( 0 , false ) ;
2022-09-23 17:43:30 -04:00
chIDEntry - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " ChangeCh() " ) ;
2022-09-28 17:54:33 -04:00
2022-08-23 13:43:05 -04:00
2022-09-22 16:26:33 -04:00
TGTextButton * bSetAllChannels = new TGTextButton ( hframe0 , " Set All Channels " , 1 ) ; hframe0 - > AddFrame ( bSetAllChannels , new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY , 5 , 5 , 3 , 4 ) ) ;
bSetAllChannels - > SetState ( kButtonUp ) ;
2022-09-23 17:43:30 -04:00
bSetAllChannels - > Connect ( " Clicked() " , " ChannelSettingPHA " , this , " SetAllChannels() " ) ;
2022-09-22 16:26:33 -04:00
2022-09-16 17:53:57 -04:00
///const uint32_t ChannelADCTemperature = 0x10A8; /// R
TGLabel * lbTemp = new TGLabel ( hframe0 , " Temperature [C] : " ) ; hframe0 - > AddFrame ( lbTemp , new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY , 5 , 5 , 3 , 4 ) ) ;
2022-09-27 17:58:14 -04:00
eTemp = new TGTextEntry ( hframe0 , new TGTextBuffer ( 1 ) ) ; hframe0 - > AddFrame ( eTemp , new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY , 5 , 5 , 3 , 4 ) ) ;
2022-09-16 17:53:57 -04:00
eTemp - > SetEnabled ( false ) ;
eTemp - > Resize ( 50 , 20 ) ;
2022-08-23 13:43:05 -04:00
int ch = chIDEntry - > GetNumber ( ) ;
int width = 80 ;
2022-10-26 13:23:21 -04:00
TGHorizontalFrame * hframeStatus = new TGHorizontalFrame ( vframe , w , 50 ) ; vframe - > AddFrame ( hframeStatus , new TGLayoutHints ( kLHintsCenterX , 2 , 2 , 2 , 2 ) ) ;
{ ///================== Channel Status
txtSPIBus = new TGTextEntry ( hframeStatus , new TGTextBuffer ( 1 ) ) ; hframeStatus - > AddFrame ( txtSPIBus , new TGLayoutHints ( kLHintsLeft , 5 , 5 , 0 , 0 ) ) ;
txtSPIBus - > SetEnabled ( false ) ;
txtSPIBus - > Resize ( 200 , 20 ) ;
txtSPIBus - > SetText ( " SPI bus not busy " ) ;
txtADCCaliStatus = new TGTextEntry ( hframeStatus , new TGTextBuffer ( 1 ) ) ; hframeStatus - > AddFrame ( txtADCCaliStatus , new TGLayoutHints ( kLHintsLeft , 5 , 5 , 0 , 0 ) ) ;
txtADCCaliStatus - > SetEnabled ( false ) ;
txtADCCaliStatus - > Resize ( 200 , 20 ) ;
txtADCCaliStatus - > SetText ( " ADC Calibration None " ) ;
txtADCPowerStatus = new TGTextEntry ( hframeStatus , new TGTextBuffer ( 1 ) ) ; hframeStatus - > AddFrame ( txtADCPowerStatus , new TGLayoutHints ( kLHintsLeft , 5 , 5 , 0 , 0 ) ) ;
txtADCPowerStatus - > SetEnabled ( false ) ;
txtADCPowerStatus - > Resize ( 300 , 20 ) ;
txtADCPowerStatus - > SetText ( " ADC Power OK. " ) ;
}
2022-09-16 17:53:57 -04:00
TGHorizontalFrame * hframe1 = new TGHorizontalFrame ( vframe , w , 50 ) ; vframe - > AddFrame ( hframe1 , new TGLayoutHints ( kLHintsCenterX , 2 , 2 , 2 , 2 ) ) ;
2022-09-21 17:40:47 -04:00
{ ///================== Input Setting
TGGroupFrame * gfInput = new TGGroupFrame ( hframe1 , " Input / Misc. " , kHorizontalFrame ) ; hframe1 - > AddFrame ( gfInput , new TGLayoutHints ( kLHintsExpandY ) ) ;
TGHorizontalFrame * hfInput = new TGHorizontalFrame ( gfInput ) ; gfInput - > AddFrame ( hfInput ) ;
2022-09-16 17:53:57 -04:00
2022-09-21 17:40:47 -04:00
TGVerticalFrame * vfInput1 = new TGVerticalFrame ( hfInput ) ; hfInput - > AddFrame ( vfInput1 ) ;
TGVerticalFrame * vfInput2 = new TGVerticalFrame ( hfInput ) ; hfInput - > AddFrame ( vfInput2 ) ;
///----------- on/off
TGLabel * lbOnOff = new TGLabel ( vfInput1 , " On/Off " ) ; vfInput1 - > AddFrame ( lbOnOff , layoutHintsR ) ;
cbOnOff = new TGComboBox ( vfInput2 ) ; vfInput2 - > AddFrame ( cbOnOff , layoutHints ) ;
cbOnOff - > AddEntry ( " ON " , 1 ) ;
cbOnOff - > AddEntry ( " off " , 0 ) ;
cbOnOff - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbOnOff - > Connect ( " Selected(Int_t, Int_t) " , " ChannelSettingPHA " , this , " SetChannelMask() " ) ;
2022-09-21 17:40:47 -04:00
///----------- Polarity
TGLabel * lbPol = new TGLabel ( vfInput1 , " Polarity " ) ; vfInput1 - > AddFrame ( lbPol , layoutHintsR ) ;
cbPolarity = new TGComboBox ( vfInput2 ) ; vfInput2 - > AddFrame ( cbPolarity , layoutHints ) ;
2022-10-25 14:52:57 -04:00
cbPolarity - > AddEntry ( " Positive + " , 0 ) ;
cbPolarity - > AddEntry ( " Negative - " , 1 ) ;
2022-09-21 17:40:47 -04:00
cbPolarity - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbPolarity - > Connect ( " Selected(Int_t, Int_t) " , " ChannelSettingPHA " , this , " SetDPPAlgorithm1() " ) ;
2022-09-21 17:40:47 -04:00
///---------- Input Dynamic Range
TGLabel * lbInputDynamicRange = new TGLabel ( vfInput1 , " Input Range " ) ; vfInput1 - > AddFrame ( lbInputDynamicRange , layoutHintsR ) ;
cbInputDynamicRange = new TGComboBox ( vfInput2 ) ; vfInput2 - > AddFrame ( cbInputDynamicRange , layoutHints ) ;
cbInputDynamicRange - > AddEntry ( " 2.0 Vpp " , 0 ) ;
cbInputDynamicRange - > AddEntry ( " 0.5 Vpp " , 1 ) ;
2022-09-22 17:53:29 -04:00
cbInputDynamicRange - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbInputDynamicRange - > Connect ( " Selected(Int_t, Int_t) " , " ChannelSettingPHA " , this , " SetInputDynamicRange() " ) ;
2022-09-21 17:40:47 -04:00
///---------- Record Length
TGLabel * lbRecordLength = new TGLabel ( vfInput1 , " Record Length [ns] " ) ; vfInput1 - > AddFrame ( lbRecordLength , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numRecordLength = new TGNumberEntry ( vfInput2 , 20000 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfInput2 - > AddFrame ( numRecordLength , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numRecordLength - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
numRecordLength - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetRecordLength() " ) ;
2022-09-21 17:40:47 -04:00
///const uint32_t PreTrigger = 0x1038; /// R/W
TGLabel * lbPreTrigger = new TGLabel ( vfInput1 , " Pre trigger [ns] " ) ; vfInput1 - > AddFrame ( lbPreTrigger , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numPreTrigger = new TGNumberEntry ( vfInput2 , 2000 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfInput2 - > AddFrame ( numPreTrigger , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numPreTrigger - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
numPreTrigger - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetPreTrigger() " ) ;
2022-09-21 17:40:47 -04:00
///const uint32_t NumberEventsPerAggregate_G = 0x1034; /// R/W,
TGLabel * lbEventAgg = new TGLabel ( vfInput1 , " Events / Aggregate " ) ; vfInput1 - > AddFrame ( lbEventAgg , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numEventAgg = new TGNumberEntry ( vfInput2 , 512 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfInput2 - > AddFrame ( numEventAgg , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numEventAgg - > Resize ( width , 20 ) ;
2022-10-24 17:01:05 -04:00
numEventAgg - > SetLimits ( TGNumberFormat : : kNELLimitMinMax , 1 , 511 ) ;
2022-09-23 17:43:30 -04:00
numEventAgg - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetEventAggregate() " ) ;
2022-09-22 16:26:33 -04:00
2022-10-18 17:23:29 -04:00
TGLabel * lbBuffer = new TGLabel ( vfInput1 , " Buffer Size [MByte] " ) ; vfInput1 - > AddFrame ( lbBuffer , layoutHintsR ) ;
eBuffer = new TGTextEntry ( vfInput2 , " " ) ; vfInput2 - > AddFrame ( eBuffer , layoutHints ) ;
eBuffer - > Resize ( width , 20 ) ;
eBuffer - > SetEnabled ( false ) ;
2022-09-26 12:45:52 -04:00
///const uint32_t ChannelDCOffset = 0x1098; /// R/W
TGLabel * lbDCOffset = new TGLabel ( vfInput1 , " DC offset [%] " ) ; vfInput1 - > AddFrame ( lbDCOffset , layoutHintsR ) ;
numDCOffset = new TGNumberEntry ( vfInput2 , 20 , 0 , 0 , TGNumberFormat : : kNESRealTwo , TGNumberFormat : : kNEANonNegative ) ; vfInput2 - > AddFrame ( numDCOffset , layoutHints ) ;
numDCOffset - > Resize ( width , 20 ) ;
2022-10-24 14:40:16 -04:00
numDCOffset - > SetLimits ( TGNumberFormat : : kNELLimitMinMax , 0 , 100 ) ;
2022-09-26 12:45:52 -04:00
numDCOffset - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetDCOffset() " ) ;
2022-09-22 16:26:33 -04:00
///const uint32_t ShapedTriggerWidth = 0x1084; /// R/W not sure
///const uint32_t VetoWidth = 0x10D4; /// R/W
///const uint32_t FineGain = 0x10C4; /// R/W OK
2022-09-21 17:40:47 -04:00
}
2022-09-16 17:53:57 -04:00
2022-09-21 17:40:47 -04:00
{ ///================== Trigger Settings
TGGroupFrame * gfTrigger = new TGGroupFrame ( hframe1 , " Trigger " , kHorizontalFrame ) ; hframe1 - > AddFrame ( gfTrigger , new TGLayoutHints ( kLHintsExpandY ) ) ;
TGHorizontalFrame * hfTrigger = new TGHorizontalFrame ( gfTrigger ) ; gfTrigger - > AddFrame ( hfTrigger ) ;
2022-09-16 17:53:57 -04:00
2022-09-21 17:40:47 -04:00
TGVerticalFrame * vfTrigger1 = new TGVerticalFrame ( hfTrigger ) ; hfTrigger - > AddFrame ( vfTrigger1 ) ;
TGVerticalFrame * vfTrigger2 = new TGVerticalFrame ( hfTrigger ) ; hfTrigger - > AddFrame ( vfTrigger2 ) ;
2022-09-16 17:53:57 -04:00
2022-09-21 17:40:47 -04:00
///const uint32_t TriggerThreshold = 0x106C; /// R/W
TGLabel * lbTriggerThreshold = new TGLabel ( vfTrigger1 , " Trigger Threshold [LSB] " ) ; vfTrigger1 - > AddFrame ( lbTriggerThreshold , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numTriggerThreshold = new TGNumberEntry ( vfTrigger2 , 100 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfTrigger2 - > AddFrame ( numTriggerThreshold , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numTriggerThreshold - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
numTriggerThreshold - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetTriggerThreshold() " ) ;
2022-09-21 17:40:47 -04:00
///const uint32_t TriggerHoldOffWidth = 0x1074; /// R/W
TGLabel * lbTriggerHoldOff = new TGLabel ( vfTrigger1 , " Trigger Holdoff [ns] " ) ; vfTrigger1 - > AddFrame ( lbTriggerHoldOff , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numTriggerHoldOff = new TGNumberEntry ( vfTrigger2 , 20000 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfTrigger2 - > AddFrame ( numTriggerHoldOff , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numTriggerHoldOff - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
numTriggerHoldOff - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetTriggerHoldOff() " ) ;
2022-09-21 17:40:47 -04:00
///const uint32_t RCCR2SmoothingFactor = 0x1054; /// R/W Trigger Filter smoothing, triggerSmoothingFactor
TGLabel * lbTriggerSmoothing = new TGLabel ( vfTrigger1 , " Trigger Smoothing " ) ; vfTrigger1 - > AddFrame ( lbTriggerSmoothing , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
cbTriggerSmoothing = new TGComboBox ( vfTrigger2 ) ; vfTrigger2 - > AddFrame ( cbTriggerSmoothing , layoutHints ) ;
2022-09-21 17:40:47 -04:00
cbTriggerSmoothing - > AddEntry ( " disable " , 0 ) ;
cbTriggerSmoothing - > AddEntry ( " 2 samples " , 1 ) ;
cbTriggerSmoothing - > AddEntry ( " 4 samples " , 2 ) ;
cbTriggerSmoothing - > AddEntry ( " 8 samples " , 4 ) ;
cbTriggerSmoothing - > AddEntry ( " 16 samples " , 8 ) ;
cbTriggerSmoothing - > AddEntry ( " 32 samples " , 16 ) ;
cbTriggerSmoothing - > AddEntry ( " 64 samples " , 32 ) ;
cbTriggerSmoothing - > AddEntry ( " 128 samples " , 0x3F ) ;
cbTriggerSmoothing - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbTriggerSmoothing - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetTriggerSmoothing() " ) ;
2022-09-21 17:40:47 -04:00
///const uint32_t InputRiseTime = 0x1058; /// R/W OK
TGLabel * lbInputRiseTime = new TGLabel ( vfTrigger1 , " Input rise time [ns] " ) ; vfTrigger1 - > AddFrame ( lbInputRiseTime , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numInputRiseTime = new TGNumberEntry ( vfTrigger2 , 96 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfTrigger2 - > AddFrame ( numInputRiseTime , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numInputRiseTime - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
numInputRiseTime - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetInputRiseTime() " ) ;
2022-09-21 17:40:47 -04:00
///const uint32_t RiseTimeValidationWindow = 0x1070; /// R/W OK
TGLabel * lbRiseTimeValidWin = new TGLabel ( vfTrigger1 , " Rise Time Val. Win. [ns] " ) ; vfTrigger1 - > AddFrame ( lbRiseTimeValidWin , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numRiseTimeValidWin = new TGNumberEntry ( vfTrigger2 , 20 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfTrigger2 - > AddFrame ( numRiseTimeValidWin , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numRiseTimeValidWin - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
numRiseTimeValidWin - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetRiseTimeValidWin() " ) ;
2022-09-21 17:40:47 -04:00
/// DPP1 bit[19:18]
2022-09-26 12:45:52 -04:00
TGLabel * lbTriggerMode = new TGLabel ( vfTrigger1 , " Trigger Mode " ) ; vfTrigger1 - > AddFrame ( lbTriggerMode , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
cbTriggerMode = new TGComboBox ( vfTrigger2 ) ; vfTrigger2 - > AddFrame ( cbTriggerMode , layoutHints ) ;
2022-09-21 17:40:47 -04:00
cbTriggerMode - > AddEntry ( " Normal " , 0 ) ;
cbTriggerMode - > AddEntry ( " Coin. " , 1 ) ;
cbTriggerMode - > AddEntry ( " Anti-Coin. " , 3 ) ;
cbTriggerMode - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbTriggerMode - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm1() " ) ;
2022-10-26 14:55:06 -04:00
/// ShapedTriggerWidth = 0x1084 /// R/W
TGLabel * lbShapeTrigWidth = new TGLabel ( vfTrigger1 , " Shaped Trigger Width [ns] " ) ; vfTrigger1 - > AddFrame ( lbShapeTrigWidth , layoutHintsR ) ;
numShapedTriggerWidth = new TGNumberEntry ( vfTrigger2 , 20 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfTrigger2 - > AddFrame ( numShapedTriggerWidth , layoutHints ) ;
numShapedTriggerWidth - > Resize ( width , 20 ) ;
numShapedTriggerWidth - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetShaperTriggerWidth() " ) ;
2022-09-21 17:40:47 -04:00
}
{ ///================== Trapezoid Settings
TGGroupFrame * gfTrap = new TGGroupFrame ( hframe1 , " Trapazoid " , kHorizontalFrame ) ; hframe1 - > AddFrame ( gfTrap , new TGLayoutHints ( kLHintsExpandY ) ) ;
TGHorizontalFrame * hfTrap = new TGHorizontalFrame ( gfTrap ) ; gfTrap - > AddFrame ( hfTrap ) ;
TGVerticalFrame * vfTrap1 = new TGVerticalFrame ( hfTrap ) ; hfTrap - > AddFrame ( vfTrap1 ) ;
TGVerticalFrame * vfTrap2 = new TGVerticalFrame ( hfTrap ) ; hfTrap - > AddFrame ( vfTrap2 ) ;
2022-09-16 17:53:57 -04:00
2022-09-21 17:40:47 -04:00
///const uint32_t TrapezoidRiseTime = 0x105C; /// R/W OK
TGLabel * lbTrapRiseTime = new TGLabel ( vfTrap1 , " Rise time [ns] " ) ; vfTrap1 - > AddFrame ( lbTrapRiseTime , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numTrapRiseTime = new TGNumberEntry ( vfTrap2 , 96 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfTrap2 - > AddFrame ( numTrapRiseTime , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numTrapRiseTime - > Resize ( width , 20 ) ;
2022-10-26 18:38:55 -04:00
numTrapRiseTime - > SetLimits ( TGNumberFormat : : kNELLimitMinMax , 0 , 0xFFF * 4 * ch2ns ) ;
2022-09-23 17:43:30 -04:00
numTrapRiseTime - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetTrapRiseTime() " ) ;
2022-09-21 17:40:47 -04:00
///const uint32_t TrapezoidFlatTop = 0x1060; /// R/W OK
TGLabel * lbTrapFlatTop = new TGLabel ( vfTrap1 , " Flat Top [ns] " ) ; vfTrap1 - > AddFrame ( lbTrapFlatTop , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numTrapFlatTop = new TGNumberEntry ( vfTrap2 , 96 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfTrap2 - > AddFrame ( numTrapFlatTop , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numTrapFlatTop - > Resize ( width , 20 ) ;
2022-10-26 18:38:55 -04:00
numTrapFlatTop - > SetLimits ( TGNumberFormat : : kNELLimitMinMax , 0 , 0xFFF * 4 * ch2ns ) ;
2022-09-23 17:43:30 -04:00
numTrapFlatTop - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetTrapFlatTop() " ) ;
2022-09-16 17:53:57 -04:00
2022-09-21 17:40:47 -04:00
///const uint32_t DecayTime = 0x1068; /// R/W OK
TGLabel * lbDecay = new TGLabel ( vfTrap1 , " Decay [ns] " ) ; vfTrap1 - > AddFrame ( lbDecay , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numDecay = new TGNumberEntry ( vfTrap2 , 96 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfTrap2 - > AddFrame ( numDecay , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numDecay - > Resize ( width , 20 ) ;
2022-10-26 18:38:55 -04:00
numDecay - > SetLimits ( TGNumberFormat : : kNELLimitMinMax , 0 , 0xFFFF * 4 * ch2ns ) ;
2022-09-23 17:43:30 -04:00
numDecay - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetDecay() " ) ;
2022-09-21 17:40:47 -04:00
///const uint32_t PeakingTime = 0x1064; /// R/W OK
TGLabel * lbPeaking = new TGLabel ( vfTrap1 , " Peaking [ns] " ) ; vfTrap1 - > AddFrame ( lbPeaking , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numPeaking = new TGNumberEntry ( vfTrap2 , 96 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfTrap2 - > AddFrame ( numPeaking , layoutHints ) ;
2022-09-21 17:40:47 -04:00
numPeaking - > Resize ( width , 20 ) ;
2022-10-26 18:38:55 -04:00
numPeaking - > SetLimits ( TGNumberFormat : : kNELLimitMinMax , 0 , 0xFFF * 4 * ch2ns ) ;
2022-09-23 17:43:30 -04:00
numPeaking - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetPeaking() " ) ;
2022-09-21 17:40:47 -04:00
///const uint32_t PeakHoldOff = 0x1078; /// R/W OK
TGLabel * lbPeakHoldOff = new TGLabel ( vfTrap1 , " Peaking Holdoff [ns] " ) ; vfTrap1 - > AddFrame ( lbPeakHoldOff , layoutHintsR ) ;
2022-09-22 16:26:33 -04:00
numPeakHoldOff = new TGNumberEntry ( vfTrap2 , 96 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfTrap2 - > AddFrame ( numPeakHoldOff , layoutHints ) ;
numPeakHoldOff - > Resize ( width , 20 ) ;
2022-10-26 18:38:55 -04:00
numPeakHoldOff - > SetLimits ( TGNumberFormat : : kNELLimitMinMax , 0 , 0x3FF * 4 * ch2ns ) ;
2022-09-23 17:43:30 -04:00
numPeakHoldOff - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetPeakHoldOff() " ) ;
2022-09-21 17:40:47 -04:00
/// DPP1 bit[13:12]
2022-09-22 16:26:33 -04:00
TGLabel * lbPeakMean = new TGLabel ( vfTrap1 , " Peak Mean " ) ; vfTrap1 - > AddFrame ( lbPeakMean , layoutHintsR ) ;
cbPeakMean = new TGComboBox ( vfTrap2 ) ; vfTrap2 - > AddFrame ( cbPeakMean , layoutHints ) ;
2022-09-21 17:40:47 -04:00
cbPeakMean - > AddEntry ( " 1 sample " , 0 ) ;
cbPeakMean - > AddEntry ( " 4 samples " , 1 ) ;
cbPeakMean - > AddEntry ( " 16 samples " , 2 ) ;
cbPeakMean - > AddEntry ( " 64 samples " , 3 ) ;
cbPeakMean - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbPeakMean - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm1() " ) ;
2022-09-21 17:40:47 -04:00
/// DPP1 bit[22:20]
2022-09-22 16:26:33 -04:00
TGLabel * lbBaseLineAvg = new TGLabel ( vfTrap1 , " Baseline avg. " ) ; vfTrap1 - > AddFrame ( lbBaseLineAvg , layoutHintsR ) ;
cbBaseLineAvg = new TGComboBox ( vfTrap2 ) ; vfTrap2 - > AddFrame ( cbBaseLineAvg , layoutHints ) ;
2022-09-21 17:40:47 -04:00
cbBaseLineAvg - > AddEntry ( " no baseline " , 0 ) ;
cbBaseLineAvg - > AddEntry ( " 16 sp. " , 1 ) ;
cbBaseLineAvg - > AddEntry ( " 64 sp. " , 2 ) ;
cbBaseLineAvg - > AddEntry ( " 256 sp. " , 3 ) ;
cbBaseLineAvg - > AddEntry ( " 1024 sp. " , 4 ) ;
cbBaseLineAvg - > AddEntry ( " 4096 sp. " , 5 ) ;
cbBaseLineAvg - > AddEntry ( " 16384 sp. " , 6 ) ;
cbBaseLineAvg - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbBaseLineAvg - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm1() " ) ;
2022-09-21 17:40:47 -04:00
}
2022-09-28 15:09:27 -04:00
TGHorizontalFrame * hframe2 = new TGHorizontalFrame ( vframe , w , 50 ) ; vframe - > AddFrame ( hframe2 , new TGLayoutHints ( kLHintsExpandX , 2 , 2 , 2 , 2 ) ) ;
2022-09-27 17:58:14 -04:00
2022-09-21 17:40:47 -04:00
{ ///================== const uint32_t DPPAlgorithmControl = 0x1080; /// R/W
2022-09-27 17:58:14 -04:00
TGGroupFrame * gfDPPCtrl = new TGGroupFrame ( hframe2 , " DPP Algorithm Control 1 & 2 " , kHorizontalFrame ) ; hframe2 - > AddFrame ( gfDPPCtrl , new TGLayoutHints ( kLHintsExpandX ) ) ;
2022-09-21 17:40:47 -04:00
TGVerticalFrame * vfDPPCtrl = new TGVerticalFrame ( gfDPPCtrl ) ; gfDPPCtrl - > AddFrame ( vfDPPCtrl , new TGLayoutHints ( kLHintsExpandX ) ) ;
TGHorizontalFrame * hfDPPCtrl1 = new TGHorizontalFrame ( vfDPPCtrl ) ; vfDPPCtrl - > AddFrame ( hfDPPCtrl1 , new TGLayoutHints ( kLHintsExpandX , 5 , 5 , 10 , 0 ) ) ;
TGVerticalFrame * vfDPPCtrl11 = new TGVerticalFrame ( hfDPPCtrl1 ) ; hfDPPCtrl1 - > AddFrame ( vfDPPCtrl11 , new TGLayoutHints ( kLHintsExpandX , 5 , 5 , 0 , 0 ) ) ;
TGVerticalFrame * vfDPPCtrl12 = new TGVerticalFrame ( hfDPPCtrl1 ) ; hfDPPCtrl1 - > AddFrame ( vfDPPCtrl12 ) ;
2022-09-22 16:26:33 -04:00
TGLayoutHints * haha = new TGLayoutHints ( kLHintsRight , 5 , 5 , 3 , 2 ) ;
TGLabel * lbTrapScale = new TGLabel ( vfDPPCtrl11 , " Trap. Scaling [bit] : " ) ; vfDPPCtrl11 - > AddFrame ( lbTrapScale , haha ) ;
numTrapScale = new TGNumberEntry ( vfDPPCtrl12 , 14 , 0 , 0 , TGNumberFormat : : kNESInteger , TGNumberFormat : : kNEANonNegative ) ; vfDPPCtrl12 - > AddFrame ( numTrapScale ) ;
2022-09-21 17:40:47 -04:00
numTrapScale - > Resize ( width , 20 ) ;
2022-10-17 14:42:00 -04:00
numTrapScale - > Connect ( " Modified() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm1() " ) ;
2022-09-21 17:40:47 -04:00
2022-09-22 16:26:33 -04:00
TGLabel * lbDecimation = new TGLabel ( vfDPPCtrl11 , " Decimation : " ) ; vfDPPCtrl11 - > AddFrame ( lbDecimation , haha ) ;
cbDecimation = new TGComboBox ( vfDPPCtrl12 ) ; vfDPPCtrl12 - > AddFrame ( cbDecimation ) ;
2022-09-21 17:40:47 -04:00
cbDecimation - > AddEntry ( " Disable " , 0 ) ;
cbDecimation - > AddEntry ( " 2 samples " , 1 ) ;
cbDecimation - > AddEntry ( " 4 samples " , 2 ) ;
cbDecimation - > AddEntry ( " 8 samples " , 3 ) ;
cbDecimation - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbDecimation - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm1() " ) ;
2022-09-21 17:40:47 -04:00
2022-09-22 16:26:33 -04:00
TGLabel * lbDecimationGain = new TGLabel ( vfDPPCtrl11 , " Decimation Gain : " ) ; vfDPPCtrl11 - > AddFrame ( lbDecimationGain , haha ) ;
cbDecimationGain = new TGComboBox ( vfDPPCtrl12 ) ; vfDPPCtrl12 - > AddFrame ( cbDecimationGain ) ;
2022-09-21 17:40:47 -04:00
cbDecimationGain - > AddEntry ( " x 1 " , 0 ) ;
cbDecimationGain - > AddEntry ( " x 2 " , 1 ) ;
cbDecimationGain - > AddEntry ( " x 4 " , 2 ) ;
cbDecimationGain - > AddEntry ( " x 8 " , 3 ) ;
cbDecimationGain - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbDecimationGain - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm1() " ) ;
2022-09-22 16:26:33 -04:00
TGLabel * lbRollOver = new TGLabel ( vfDPPCtrl11 , " Roll-Over Flag : " ) ; vfDPPCtrl11 - > AddFrame ( lbRollOver , haha ) ;
cbRollOver = new TGComboBox ( vfDPPCtrl12 ) ; vfDPPCtrl12 - > AddFrame ( cbRollOver ) ;
2022-09-21 17:40:47 -04:00
cbRollOver - > AddEntry ( " Disabled " , 0 ) ;
cbRollOver - > AddEntry ( " Enabled " , 1 ) ;
cbRollOver - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbRollOver - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm1() " ) ;
2022-09-21 17:40:47 -04:00
2022-09-22 16:26:33 -04:00
TGLabel * lbPileUp = new TGLabel ( vfDPPCtrl11 , " Pile-Up Flag : " ) ; vfDPPCtrl11 - > AddFrame ( lbPileUp , haha ) ;
cbPileUp = new TGComboBox ( vfDPPCtrl12 ) ; vfDPPCtrl12 - > AddFrame ( cbPileUp ) ;
2022-09-21 17:40:47 -04:00
cbPileUp - > AddEntry ( " Disabled " , 0 ) ;
cbPileUp - > AddEntry ( " Enabled " , 1 ) ;
cbPileUp - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbPileUp - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm1() " ) ;
2022-09-21 17:40:47 -04:00
2022-09-22 16:26:33 -04:00
TGVerticalFrame * vfDPPCtrl21 = new TGVerticalFrame ( hfDPPCtrl1 ) ; hfDPPCtrl1 - > AddFrame ( vfDPPCtrl21 , new TGLayoutHints ( kLHintsExpandX , 5 , 5 , 0 , 0 ) ) ;
TGVerticalFrame * vfDPPCtrl22 = new TGVerticalFrame ( hfDPPCtrl1 ) ; hfDPPCtrl1 - > AddFrame ( vfDPPCtrl22 , new TGLayoutHints ( kLHintsExpandX , 5 , 5 , 0 , 0 ) ) ;
TGLabel * lbLocalShapedTrigger = new TGLabel ( vfDPPCtrl21 , " Local Shaped Trigger : " ) ; vfDPPCtrl21 - > AddFrame ( lbLocalShapedTrigger , haha ) ;
2022-09-27 17:58:14 -04:00
cbLocalShapedTrigger = new TGComboBox ( vfDPPCtrl22 ) ; vfDPPCtrl22 - > AddFrame ( cbLocalShapedTrigger ) ;
cbLocalShapedTrigger - > AddEntry ( " Disabled " , - 3 ) ;
2022-09-21 17:40:47 -04:00
cbLocalShapedTrigger - > AddEntry ( " AND " , 0 ) ;
cbLocalShapedTrigger - > AddEntry ( " Even Channel " , 1 ) ;
cbLocalShapedTrigger - > AddEntry ( " Odd Channel " , 2 ) ;
cbLocalShapedTrigger - > AddEntry ( " OR " , 3 ) ;
cbLocalShapedTrigger - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbLocalShapedTrigger - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm2() " ) ;
2022-09-22 16:26:33 -04:00
2022-09-21 17:40:47 -04:00
TGLabel * lbLocalTriggerValid = new TGLabel ( vfDPPCtrl21 , " Local Trigger Valid. : " ) ; vfDPPCtrl21 - > AddFrame ( lbLocalTriggerValid , haha ) ;
2022-09-22 16:26:33 -04:00
cbLocalTriggerValid = new TGComboBox ( vfDPPCtrl22 ) ; vfDPPCtrl22 - > AddFrame ( cbLocalTriggerValid ) ;
2022-09-27 17:58:14 -04:00
cbLocalTriggerValid - > AddEntry ( " Disabled " , - 3 ) ;
2022-09-21 17:40:47 -04:00
cbLocalTriggerValid - > AddEntry ( " crossed " , 0 ) ;
cbLocalTriggerValid - > AddEntry ( " val0 = val1 from mother-board mask " , 1 ) ;
cbLocalTriggerValid - > AddEntry ( " AND " , 3 ) ;
cbLocalTriggerValid - > AddEntry ( " OR " , 4 ) ;
2022-09-22 16:26:33 -04:00
cbLocalTriggerValid - > Resize ( 100 , 20 ) ;
2022-09-23 17:43:30 -04:00
cbLocalTriggerValid - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm2() " ) ;
2022-09-21 17:40:47 -04:00
2022-09-22 16:26:33 -04:00
TGLabel * lbVetoSource = new TGLabel ( vfDPPCtrl21 , " Veto Source : " ) ; vfDPPCtrl21 - > AddFrame ( lbVetoSource , haha ) ;
cbVetoSource = new TGComboBox ( vfDPPCtrl22 ) ; vfDPPCtrl22 - > AddFrame ( cbVetoSource ) ;
2022-09-21 17:40:47 -04:00
cbVetoSource - > AddEntry ( " Disabled " , 0 ) ;
cbVetoSource - > AddEntry ( " common to all channels " , 1 ) ;
cbVetoSource - > AddEntry ( " individually set for paired channel " , 2 ) ;
cbVetoSource - > AddEntry ( " negative saturation " , 3 ) ;
cbVetoSource - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbVetoSource - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm2() " ) ;
2022-09-22 16:26:33 -04:00
TGLabel * lbTriggerCounterRate = new TGLabel ( vfDPPCtrl21 , " Trigger Counter Rate : " ) ; vfDPPCtrl21 - > AddFrame ( lbTriggerCounterRate , haha ) ;
cbTriggerCounterRate = new TGComboBox ( vfDPPCtrl22 ) ; vfDPPCtrl22 - > AddFrame ( cbTriggerCounterRate ) ;
2022-09-21 17:40:47 -04:00
cbTriggerCounterRate - > AddEntry ( " 1024 " , 0 ) ;
cbTriggerCounterRate - > AddEntry ( " 128 " , 1 ) ;
cbTriggerCounterRate - > AddEntry ( " 8192 " , 2 ) ;
cbTriggerCounterRate - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbTriggerCounterRate - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm2() " ) ;
2022-09-21 17:40:47 -04:00
2022-09-22 16:26:33 -04:00
TGLabel * lbBaselineCal = new TGLabel ( vfDPPCtrl21 , " Active Baseline Cal. : " ) ; vfDPPCtrl21 - > AddFrame ( lbBaselineCal , haha ) ;
cbBaselineCal = new TGComboBox ( vfDPPCtrl22 ) ; vfDPPCtrl22 - > AddFrame ( cbBaselineCal ) ;
2022-09-21 17:40:47 -04:00
cbBaselineCal - > AddEntry ( " Enabled " , 0 ) ;
cbBaselineCal - > AddEntry ( " Disabled " , 1 ) ;
cbBaselineCal - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbBaselineCal - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm2() " ) ;
2022-09-21 17:40:47 -04:00
2022-09-22 16:26:33 -04:00
TGLabel * lbTagCorrelatedEvent = new TGLabel ( vfDPPCtrl21 , " Tag correlated events : " ) ; vfDPPCtrl21 - > AddFrame ( lbTagCorrelatedEvent , haha ) ;
cbTagCorrelatedEvent = new TGComboBox ( vfDPPCtrl22 ) ; vfDPPCtrl22 - > AddFrame ( cbTagCorrelatedEvent ) ;
2022-09-21 17:40:47 -04:00
cbTagCorrelatedEvent - > AddEntry ( " Disabled " , 0 ) ;
cbTagCorrelatedEvent - > AddEntry ( " Enabled " , 1 ) ;
cbTagCorrelatedEvent - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbTagCorrelatedEvent - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm2() " ) ;
2022-09-22 16:26:33 -04:00
TGLabel * lbBaselineOptimize = new TGLabel ( vfDPPCtrl11 , " Baseline Optimaization : " ) ; vfDPPCtrl11 - > AddFrame ( lbBaselineOptimize , haha ) ;
2022-09-27 17:58:14 -04:00
cbBaselineOptimize = new TGComboBox ( vfDPPCtrl12 ) ; vfDPPCtrl12 - > AddFrame ( cbBaselineOptimize ) ;
2022-09-21 17:40:47 -04:00
cbBaselineOptimize - > AddEntry ( " Disabled " , 0 ) ;
cbBaselineOptimize - > AddEntry ( " Enabled " , 1 ) ;
cbBaselineOptimize - > Resize ( width , 20 ) ;
2022-09-23 17:43:30 -04:00
cbBaselineOptimize - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm2() " ) ;
2022-09-21 17:40:47 -04:00
TGHorizontalFrame * hfDPPCtrl2 = new TGHorizontalFrame ( vfDPPCtrl ) ; vfDPPCtrl - > AddFrame ( hfDPPCtrl2 , new TGLayoutHints ( kLHintsExpandX , 5 , 5 , 10 , 0 ) ) ;
TGVerticalFrame * vfDPPCtrl_a = new TGVerticalFrame ( hfDPPCtrl2 ) ; hfDPPCtrl2 - > AddFrame ( vfDPPCtrl_a ) ;
TGVerticalFrame * vfDPPCtrl_b = new TGVerticalFrame ( hfDPPCtrl2 ) ; hfDPPCtrl2 - > AddFrame ( vfDPPCtrl_b , new TGLayoutHints ( kLHintsExpandX , 5 , 5 , 0 , 0 ) ) ;
TGLabel * lbDisableSelfTrigger = new TGLabel ( vfDPPCtrl_a , " Self Trigger : " ) ; vfDPPCtrl_a - > AddFrame ( lbDisableSelfTrigger , haha ) ;
2022-09-22 16:26:33 -04:00
cbDisableSelfTrigger = new TGComboBox ( vfDPPCtrl_b ) ; vfDPPCtrl_b - > AddFrame ( cbDisableSelfTrigger ) ;
2022-09-21 17:40:47 -04:00
cbDisableSelfTrigger - > AddEntry ( " used to acquire and propagate to trigger logic " , 0 ) ;
cbDisableSelfTrigger - > AddEntry ( " only propagate to trigger logic " , 1 ) ;
cbDisableSelfTrigger - > Resize ( 300 , 20 ) ;
2022-09-23 17:43:30 -04:00
cbLocalShapedTrigger - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm1() " ) ;
2022-09-21 17:40:47 -04:00
TGLabel * lbExtra2WordOption = new TGLabel ( vfDPPCtrl_a , " Extras 2 Word Option : " ) ; vfDPPCtrl_a - > AddFrame ( lbExtra2WordOption , haha ) ;
2022-09-22 16:26:33 -04:00
cbExtra2WordOption = new TGComboBox ( vfDPPCtrl_b ) ; vfDPPCtrl_b - > AddFrame ( cbExtra2WordOption ) ;
2022-09-21 17:40:47 -04:00
cbExtra2WordOption - > AddEntry ( " [31:16] Extended Time Stamp [15:0] Baseline * 4 " , 0 ) ;
cbExtra2WordOption - > AddEntry ( " [31:16] Extended Time Stamp [15:0] Fine Time Stamp " , 2 ) ;
cbExtra2WordOption - > AddEntry ( " [31:16] Lost Trigger Counter [15:0] Total Trigger Counter " , 4 ) ;
cbExtra2WordOption - > AddEntry ( " [31:16] Event Before Zero Crossing [15:0] Event After Zero Crossing " , 5 ) ;
cbExtra2WordOption - > Resize ( 400 , 20 ) ;
2022-09-26 12:45:52 -04:00
cbExtra2WordOption - > Connect ( " Changed() " , " ChannelSettingPHA " , this , " SetDPPAlgorithm2() " ) ;
2022-09-16 17:53:57 -04:00
2022-09-21 17:40:47 -04:00
}
2022-09-27 17:58:14 -04:00
{ ///================== Commands Buttons
2022-10-26 13:23:21 -04:00
TGGroupFrame * gfCmd = new TGGroupFrame ( hframe2 , " Commands " , kHorizontalFrame ) ; hframe2 - > AddFrame ( gfCmd , new TGLayoutHints ( kLHintsExpandY ) ) ;
2022-09-27 17:58:14 -04:00
TGVerticalFrame * vfCmd = new TGVerticalFrame ( gfCmd ) ; gfCmd - > AddFrame ( vfCmd , new TGLayoutHints ( kLHintsExpandX ) ) ;
TGTextButton * bReadSetting = new TGTextButton ( vfCmd , " Read Settings " ) ; vfCmd - > AddFrame ( bReadSetting , new TGLayoutHints ( kLHintsExpandX , 5 , 5 , 3 , 4 ) ) ;
bReadSetting - > Connect ( " Clicked() " , " ChannelSettingPHA " , this , " ChangeCh() " ) ;
TGTextButton * bReadTrace = new TGTextButton ( vfCmd , " Read Trace " ) ; vfCmd - > AddFrame ( bReadTrace , new TGLayoutHints ( kLHintsExpandX , 5 , 5 , 3 , 4 ) ) ;
bReadTrace - > Connect ( " Clicked() " , " ChannelSettingPHA " , this , " ReadTrace() " ) ;
2022-10-26 13:23:21 -04:00
2022-09-27 17:58:14 -04:00
}
2022-10-04 16:54:01 -04:00
{ ///=================== Comment
TGHorizontalFrame * hfOther = new TGHorizontalFrame ( vframe ) ; vframe - > AddFrame ( hfOther , new TGLayoutHints ( kLHintsNormal , 5 , 5 , 10 , 0 ) ) ;
///const uint32_t ShapedTriggerWidth = 0x1084; /// R/W not sure
///const uint32_t VetoWidth = 0x10D4; /// R/W
///const uint32_t FineGain = 0x10C4; /// R/W OK
TGLabel * lbOther = new TGLabel ( hfOther , " Shaped Trigger Width (0x1n84), Veto Width (0x1nD4), and Fine Gain (0x1nC4) are not implemented. " ) ; hfOther - > AddFrame ( lbOther ) ;
}
2022-08-23 13:43:05 -04:00
fMain - > MapSubwindows ( ) ;
fMain - > Resize ( fMain - > GetDefaultSize ( ) ) ;
fMain - > MapWindow ( ) ;
2022-09-22 17:53:29 -04:00
ch2ns = 4 ;
2022-08-23 13:43:05 -04:00
isOpened = true ;
2022-09-26 18:00:36 -04:00
ChangeBoard ( ) ;
2022-08-23 13:43:05 -04:00
}
2022-09-23 17:43:30 -04:00
ChannelSettingPHA : : ~ ChannelSettingPHA ( ) {
2022-08-23 13:43:05 -04:00
2022-09-23 17:43:30 -04:00
printf ( " close ChannelSettingPHA window \n " ) ;
2022-09-22 16:26:33 -04:00
2022-08-23 13:43:05 -04:00
isOpened = false ;
delete boardIDEntry ;
2022-10-26 13:23:21 -04:00
delete chIDEntry ;
delete eTemp ;
delete txtSPIBus ;
delete txtADCCaliStatus ;
delete txtADCPowerStatus ;
2022-08-23 13:43:05 -04:00
delete cbOnOff ;
delete cbPolarity ;
2022-10-26 13:23:21 -04:00
delete cbInputDynamicRange ;
delete numRecordLength ;
delete numPreTrigger ;
delete numEventAgg ;
delete eBuffer ;
delete numTriggerThreshold ;
delete numTriggerHoldOff ;
delete numDCOffset ;
delete cbTriggerSmoothing ;
delete numInputRiseTime ;
delete numRiseTimeValidWin ;
delete cbTriggerMode ;
2022-10-26 14:55:06 -04:00
delete numShapedTriggerWidth ;
2022-10-26 13:23:21 -04:00
delete numTrapRiseTime ;
delete numTrapFlatTop ;
delete numDecay ;
delete numPeaking ;
delete numPeakHoldOff ;
delete cbPeakMean ;
delete cbBaseLineAvg ;
delete numTrapScale ;
delete cbDecimation ;
delete cbDecimationGain ;
delete cbRollOver ;
delete cbPileUp ;
delete cbLocalShapedTrigger ;
delete cbLocalTriggerValid ;
delete cbVetoSource ;
delete cbTriggerCounterRate ;
delete cbBaselineCal ;
delete cbTagCorrelatedEvent ;
delete cbBaselineOptimize ;
delete cbDisableSelfTrigger ;
delete cbExtra2WordOption ;
2022-08-23 13:43:05 -04:00
/// fMain must be delete last;
fMain - > Cleanup ( ) ;
delete fMain ;
}
2022-09-22 16:26:33 -04:00
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : LogMsg ( TString msg ) {
2022-09-23 12:36:31 -04:00
Emit ( " LogMsg(char*) " , msg . Data ( ) ) ;
2022-09-22 16:26:33 -04:00
}
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : ChangeBoard ( ) {
2022-09-22 17:53:29 -04:00
if ( digi = = NULL ) return ;
int boardID = boardIDEntry - > GetNumber ( ) ;
2022-09-23 17:43:30 -04:00
if ( digi [ boardID ] - > GetDPPType ( ) ! = V1730_DPP_PHA_CODE ) {
if ( boardID > presentBoardID ) {
for ( int i = boardID + 1 ; i < nDigi ; i + + ) {
if ( digi [ i ] - > GetDPPType ( ) = = V1730_DPP_PHA_CODE ) {
boardID = i ;
boardIDEntry - > SetNumber ( i , false ) ;
break ;
}
if ( i = nDigi - 1 ) return ;
}
} else {
for ( int i = boardID - 1 ; i > = 0 ; i - - ) {
if ( digi [ i ] - > GetDPPType ( ) = = V1730_DPP_PHA_CODE ) {
boardID = i ;
boardIDEntry - > SetNumber ( i , false ) ;
break ;
}
if ( i = nDigi - 1 ) return ;
}
}
}
ch2ns = ( unsigned short ) digi [ boardID ] - > GetCh2ns ( ) ;
2022-08-23 13:43:05 -04:00
ChangeCh ( ) ;
2022-09-23 17:43:30 -04:00
2022-08-23 13:43:05 -04:00
}
2022-09-22 16:26:33 -04:00
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : ChangeCh ( ) {
2022-08-23 13:43:05 -04:00
2022-09-22 16:26:33 -04:00
if ( digi = = NULL ) return ;
2022-08-23 13:43:05 -04:00
int boardID = boardIDEntry - > GetNumber ( ) ;
int ch = chIDEntry - > GetNumber ( ) ;
2022-09-22 16:26:33 -04:00
if ( ch < 0 ) {
printf ( " All channels mode. \n " ) ;
return ;
}
2022-09-27 17:58:14 -04:00
LogMsg ( Form ( " Read Channel %d Setting " , ( int ) chIDEntry - > GetNumber ( ) ) ) ;
2022-10-26 13:23:21 -04:00
uint32_t temp = 0 ;
if ( digi [ boardID ] - > IsDummy ( ) ) {
txtADCCaliStatus - > SetText ( " No Digitizer is opened!!! " , false ) ; txtADCCaliStatus - > SetTextColor ( red ) ;
} else {
temp = digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : ChannelStatus_R , ch ) ;
if ( ( ( temp > > 2 ) & 0x1 ) = = 0 ) {
txtSPIBus - > SetText ( " SPI bus is not busy. " , false ) ; txtSPIBus - > SetTextColor ( blue ) ;
} else {
txtSPIBus - > SetText ( " SPI bus is BUSY. " , false ) ; txtSPIBus - > SetTextColor ( red ) ;
}
if ( ( ( temp > > 3 ) & 0x1 ) = = 0 ) {
txtADCCaliStatus - > SetText ( " ADC has not been calibrated. " , false ) ; txtADCCaliStatus - > SetTextColor ( red ) ;
} else {
txtADCCaliStatus - > SetText ( " ADC has been calibrated. " , false ) ; txtADCCaliStatus - > SetTextColor ( blue ) ;
}
if ( ( ( temp > > 8 ) & 0x1 ) = = 0 ) {
txtADCPowerStatus - > SetText ( " ADC OK. " , false ) ; txtADCPowerStatus - > SetTextColor ( blue ) ;
} else {
txtADCPowerStatus - > SetText ( " ADC Power down due to over-heat. " , false ) ; txtADCPowerStatus - > SetTextColor ( red ) ;
}
}
2022-09-22 16:26:33 -04:00
cbOnOff - > Select ( ( digi [ boardID ] - > GetChannelMask ( ) > > ch ) & 0x1 , false ) ; /// don't emit signal
2022-10-06 15:49:08 -04:00
cbInputDynamicRange - > Select ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : InputDynamicRange , ch ) , false ) ;
numRecordLength - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : RecordLength_G , ch ) * 8 * ch2ns , false ) ;
numPreTrigger - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PreTrigger , ch ) * 4 * ch2ns , false ) ;
numEventAgg - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : NumberEventsPerAggregate_G , ch ) , false ) ;
2022-09-22 16:26:33 -04:00
2022-10-26 13:23:21 -04:00
temp = digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : ChannelDCOffset , ch ) ;
2022-10-24 14:40:16 -04:00
numDCOffset - > SetNumber ( 100.0 - temp * 100.0 / 0xFFFF , false ) ;
2022-09-22 16:26:33 -04:00
2022-10-06 15:49:08 -04:00
eTemp - > SetText ( Form ( " %d C " , digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : ChannelADCTemperature_R , ch ) ) , false ) ;
2022-08-23 13:43:05 -04:00
2022-10-06 15:49:08 -04:00
numTriggerThreshold - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : TriggerThreshold , ch ) , false ) ;
numTriggerHoldOff - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : TriggerHoldOffWidth , ch ) * 4 * ch2ns , false ) ;
cbTriggerSmoothing - > Select ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : RCCR2SmoothingFactor , ch ) , false ) ;
numInputRiseTime - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : InputRiseTime , ch ) * 4 * ch2ns , false ) ;
numRiseTimeValidWin - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : RiseTimeValidationWindow , ch ) * ch2ns , false ) ;
2022-10-26 14:55:06 -04:00
numShapedTriggerWidth - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : ShapedTriggerWidth , ch ) * ch2ns , false ) ;
2022-09-23 17:43:30 -04:00
2022-10-06 15:49:08 -04:00
numTrapRiseTime - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : TrapezoidRiseTime , ch ) * 4 * ch2ns , false ) ;
numTrapFlatTop - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : TrapezoidFlatTop , ch ) * 4 * ch2ns , false ) ;
numDecay - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : DecayTime , ch ) * 4 * ch2ns , false ) ;
numPeaking - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : PeakingTime , ch ) * 4 * ch2ns , false ) ;
numPeakHoldOff - > SetNumber ( digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : PeakHoldOff , ch ) * 4 * ch2ns , false ) ;
2022-09-23 17:43:30 -04:00
2022-10-06 15:49:08 -04:00
temp = digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : DPPAlgorithmControl , ch ) ;
2022-09-23 17:43:30 -04:00
numTrapScale - > SetNumber ( temp & 0x3F , false ) ;
cbDecimation - > Select ( ( ( temp > > 8 ) & 0x3 ) , false ) ;
cbDecimationGain - > Select ( ( ( temp > > 10 ) & 0x3 ) , false ) ;
cbPeakMean - > Select ( ( ( temp > > 12 ) & 0x3 ) , false ) ;
cbPolarity - > Select ( ( ( temp > > 16 ) & 0x1 ) , false ) ;
cbTriggerMode - > Select ( ( ( temp > > 18 ) & 0x3 ) , false ) ;
cbBaseLineAvg - > Select ( ( ( temp > > 20 ) & 0x7 ) , false ) ;
cbDisableSelfTrigger - > Select ( ( ( temp > > 24 ) & 0x1 ) , false ) ;
cbRollOver - > Select ( ( ( temp > > 26 ) & 0x1 ) , false ) ;
cbPileUp - > Select ( ( ( temp > > 27 ) & 0x1 ) , false ) ;
2022-10-06 15:49:08 -04:00
temp = digi [ boardID ] - > GetSettingFromMemory ( Register : : DPP : : PHA : : DPPAlgorithmControl2_G , ch ) ;
2022-09-23 17:43:30 -04:00
if ( ( ( ( temp > > 2 ) ) & 0x1 ) = = 1 ) {
2022-09-27 17:58:14 -04:00
cbLocalShapedTrigger - > Select ( ( temp & 0x3 ) , false ) ;
2022-09-23 17:43:30 -04:00
} else {
2022-09-27 17:58:14 -04:00
cbLocalShapedTrigger - > Select ( - 3 , false ) ;
2022-09-23 17:43:30 -04:00
}
2022-09-27 17:58:14 -04:00
if ( ( ( temp > > 6 ) & 0x1 ) = = 1 ) {
cbLocalTriggerValid - > Select ( ( ( temp > > 4 ) & 0x3 ) , false ) ;
2022-09-23 17:43:30 -04:00
} else {
2022-09-27 17:58:14 -04:00
cbLocalTriggerValid - > Select ( - 3 , false ) ;
2022-09-22 16:26:33 -04:00
}
2022-09-23 17:43:30 -04:00
cbVetoSource - > Select ( ( ( temp > > 14 ) & 0x3 ) , false ) ;
cbTriggerCounterRate - > Select ( ( ( temp > > 16 ) & 0x3 ) , false ) ;
cbBaselineCal - > Select ( ( ( temp > > 18 ) & 0x1 ) , false ) ;
cbTagCorrelatedEvent - > Select ( ( ( temp > > 19 ) & 0x1 ) , false ) ;
cbBaselineOptimize - > Select ( ( ( temp > > 29 ) & 0x1 ) , false ) ;
cbExtra2WordOption - > Select ( ( ( temp > > 8 ) & 0x7 ) , false ) ;
2022-10-26 13:23:21 -04:00
uint32_t buffer = digi [ boardID ] - > CalByteForBuffer ( ) ;
eBuffer - > SetText ( Form ( " %.2f " , buffer / 1024. / 1024. ) ) ;
2022-09-23 17:43:30 -04:00
2022-09-22 16:26:33 -04:00
}
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : SetAllChannels ( ) {
2022-09-23 16:40:59 -04:00
printf ( " === %s \n " , __func__ ) ;
2022-09-22 16:26:33 -04:00
if ( digi = = NULL ) return ;
short boardID = boardIDEntry - > GetNumber ( ) ;
short ch = chIDEntry - > GetNumber ( ) ;
2022-10-06 17:10:54 -04:00
///use memory from this channel and set to all other channal
2022-10-17 14:42:00 -04:00
for ( int p = 0 ; p < ( int ) RegisterPHAList . size ( ) ; p + + ) {
2022-10-14 18:27:31 -04:00
unsigned short temp = digi [ boardID ] - > GetSettingFromMemory ( RegisterPHAList [ p ] , ch ) ;
for ( int i = 0 ; i < digi [ boardID ] - > GetNChannel ( ) ; i + + ) {
if ( i = = ch ) continue ;
digi [ boardID ] - > WriteRegister ( RegisterPHAList [ p ] , temp , i ) ;
}
2022-09-22 16:26:33 -04:00
}
2022-08-23 13:43:05 -04:00
}
2022-09-22 16:26:33 -04:00
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : SetChannelMask ( ) {
2022-09-23 16:40:59 -04:00
printf ( " === %s \n " , __func__ ) ;
2022-09-22 16:26:33 -04:00
if ( digi = = NULL ) return ;
2022-08-23 13:43:05 -04:00
short boardID = boardIDEntry - > GetNumber ( ) ;
short ch = chIDEntry - > GetNumber ( ) ;
2022-09-22 16:26:33 -04:00
unsigned short val = cbOnOff - > GetSelected ( ) ;
2022-09-26 18:00:36 -04:00
uint32_t bitMask = ( 1 < < ch ) ;
uint32_t chMask = ( ( digi [ boardID ] - > GetChannelMask ( ) & ~ bitMask ) | ( val < < ch ) ) ;
2022-09-22 16:26:33 -04:00
printf ( " mask : 0x%x \n " , chMask ) ;
digi [ boardID ] - > SetChannelMask ( chMask ) ;
2022-08-23 13:43:05 -04:00
}
2022-09-22 16:26:33 -04:00
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : SetDPPAlgorithm1 ( ) {
2022-09-23 16:40:59 -04:00
printf ( " === %s \n " , __func__ ) ;
2022-09-22 16:26:33 -04:00
if ( digi = = NULL ) return ;
2022-08-23 13:43:05 -04:00
short boardID = boardIDEntry - > GetNumber ( ) ;
short ch = chIDEntry - > GetNumber ( ) ;
2022-09-22 16:26:33 -04:00
unsigned short ch2ns = digi [ boardID ] - > GetCh2ns ( ) ;
uint32_t bit = 0 ;
2022-10-06 18:25:35 -04:00
bit + = ( unsigned int ) numTrapScale - > GetNumber ( ) ;
2022-09-27 17:58:14 -04:00
bit + = ( ( cbDecimation - > GetSelected ( ) & 0x3 ) < < 8 ) ;
bit + = ( ( cbDecimationGain - > GetSelected ( ) & 0x3 ) < < 10 ) ;
bit + = ( ( cbPeakMean - > GetSelected ( ) & 0x3 ) < < 12 ) ;
bit + = ( ( cbPolarity - > GetSelected ( ) & 0x3 ) < < 16 ) ;
bit + = ( ( cbTriggerMode - > GetSelected ( ) & 0x3 ) < < 18 ) ;
bit + = ( ( cbBaseLineAvg - > GetSelected ( ) & 0x7 ) < < 20 ) ;
bit + = ( ( cbDisableSelfTrigger - > GetSelected ( ) & 0x1 ) < < 24 ) ;
bit + = ( ( cbRollOver - > GetSelected ( ) & 0x1 ) < < 26 ) ;
bit + = ( ( cbPileUp - > GetSelected ( ) & 0x1 ) < < 27 ) ;
2022-09-22 16:26:33 -04:00
printf ( " DPP1 bit: 0x%x \n " , bit ) ;
digi [ boardID ] - > WriteRegister ( Register : : DPP : : DPPAlgorithmControl , bit , ch ) ;
2022-09-16 17:53:57 -04:00
2022-08-23 13:43:05 -04:00
}
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : SetDPPAlgorithm2 ( ) {
2022-09-23 16:40:59 -04:00
printf ( " === %s \n " , __func__ ) ;
2022-09-22 16:26:33 -04:00
if ( digi = = NULL ) return ;
2022-08-23 13:43:05 -04:00
short boardID = boardIDEntry - > GetNumber ( ) ;
short ch = chIDEntry - > GetNumber ( ) ;
2022-09-22 16:26:33 -04:00
uint32_t bit = 0 ;
if ( cbLocalShapedTrigger - > GetSelected ( ) > = 0 ) {
bit + = cbLocalShapedTrigger - > GetSelected ( ) ;
bit + = ( 1 < < 2 ) ;
}
if ( cbLocalTriggerValid - > GetSelected ( ) > = 0 ) {
2022-09-27 17:58:14 -04:00
bit + = ( ( cbLocalTriggerValid - > GetSelected ( ) & 0x3 ) < < 4 ) ;
2022-09-22 16:26:33 -04:00
bit + = ( 1 < < 6 ) ;
}
2022-09-27 17:58:14 -04:00
bit + = ( ( cbExtra2WordOption - > GetSelected ( ) & 0x7 ) < < 8 ) ;
bit + = ( ( cbVetoSource - > GetSelected ( ) & 0x3 ) < < 14 ) ;
bit + = ( ( cbTriggerCounterRate - > GetSelected ( ) & 0x3 ) < < 16 ) ;
bit + = ( ( cbBaselineCal - > GetSelected ( ) & 0x1 ) < < 18 ) ;
bit + = ( ( cbTagCorrelatedEvent - > GetSelected ( ) & 0x1 ) < < 19 ) ;
bit + = ( ( cbBaselineOptimize - > GetSelected ( ) & 0x1 ) < < 29 ) ;
2022-09-22 16:26:33 -04:00
printf ( " DPP2 bit: 0x%x \n " , bit ) ;
digi [ boardID ] - > WriteRegister ( Register : : DPP : : PHA : : DPPAlgorithmControl2_G , bit , ch ) ;
}
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : SetInputDynamicRange ( ) {
2022-09-23 16:40:59 -04:00
printf ( " === %s \n " , __func__ ) ;
2022-09-22 16:26:33 -04:00
if ( digi = = NULL ) return ;
short boardID = boardIDEntry - > GetNumber ( ) ;
short ch = chIDEntry - > GetNumber ( ) ;
digi [ boardID ] - > WriteRegister ( Register : : DPP : : InputDynamicRange , cbInputDynamicRange - > GetSelected ( ) , ch ) ;
}
2022-09-23 16:40:59 -04:00
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : ChangeAStep ( TGNumberEntry * numEntry , unsigned short stepSize , uint32_t address ) {
2022-09-22 17:53:29 -04:00
unsigned int temp = numEntry - > GetNumber ( ) ;
unsigned int res = temp % ( stepSize * ch2ns ) ;
temp = temp - res + ( ( res < ( stepSize * ch2ns / 2 ) ) ? ( stepSize * ch2ns ) : 0 ) ;
numEntry - > SetNumber ( temp , false ) ;
2022-09-22 16:26:33 -04:00
short boardID = boardIDEntry - > GetNumber ( ) ;
short ch = chIDEntry - > GetNumber ( ) ;
2022-10-14 13:22:55 -04:00
if ( digi ! = NULL ) {
Reg tempReg = digi [ boardID ] - > FindRegister ( address ) ;
digi [ boardID ] - > WriteRegister ( tempReg , temp / stepSize / ch2ns , ch ) ;
}
2022-09-22 17:53:29 -04:00
}
2022-10-26 14:55:06 -04:00
void ChannelSettingPHA : : SetRecordLength ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numRecordLength , 8 , Register : : DPP : : RecordLength_G ) ; }
void ChannelSettingPHA : : SetPreTrigger ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numPreTrigger , 4 , Register : : DPP : : PreTrigger ) ; }
void ChannelSettingPHA : : SetTriggerHoldOff ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numTriggerHoldOff , 4 , Register : : DPP : : PHA : : TriggerHoldOffWidth ) ; }
void ChannelSettingPHA : : SetInputRiseTime ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numInputRiseTime , 4 , Register : : DPP : : PHA : : InputRiseTime ) ; }
void ChannelSettingPHA : : SetRiseTimeValidWin ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numRiseTimeValidWin , 1 , Register : : DPP : : PHA : : RiseTimeValidationWindow ) ; }
void ChannelSettingPHA : : SetTrapRiseTime ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numTrapRiseTime , 4 , Register : : DPP : : PHA : : TrapezoidRiseTime ) ; }
void ChannelSettingPHA : : SetTrapFlatTop ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numTrapFlatTop , 4 , Register : : DPP : : PHA : : TrapezoidFlatTop ) ; }
void ChannelSettingPHA : : SetDecay ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numDecay , 4 , Register : : DPP : : PHA : : DecayTime ) ; }
void ChannelSettingPHA : : SetPeaking ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numPeaking , 4 , Register : : DPP : : PHA : : PeakingTime ) ; }
void ChannelSettingPHA : : SetPeakHoldOff ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numPeakHoldOff , 4 , Register : : DPP : : PHA : : PeakHoldOff ) ; }
void ChannelSettingPHA : : SetShaperTriggerWidth ( ) { printf ( " === %s \n " , __func__ ) ; ChangeAStep ( numShapedTriggerWidth , 4 , Register : : DPP : : PHA : : ShapedTriggerWidth ) ; }
2022-09-23 17:43:30 -04:00
2022-10-06 15:49:08 -04:00
void ChannelSettingPHA : : SetEventAggregate ( ) {
printf ( " === %s \n " , __func__ ) ;
if ( digi = = NULL ) return ;
short boardID = boardIDEntry - > GetNumber ( ) ;
short ch = chIDEntry - > GetNumber ( ) ;
unsigned int temp = numEventAgg - > GetNumber ( ) ;
if ( digi ! = NULL ) digi [ boardID ] - > WriteRegister ( Register : : DPP : : NumberEventsPerAggregate_G , temp , ch ) ;
2022-10-18 17:23:29 -04:00
uint32_t buffer = digi [ boardID ] - > CalByteForBuffer ( ) ;
eBuffer - > SetText ( Form ( " %.2f " , buffer / 1024. / 1024. ) ) ;
2022-10-06 15:49:08 -04:00
}
void ChannelSettingPHA : : SetTriggerThreshold ( ) {
printf ( " === %s \n " , __func__ ) ;
if ( digi = = NULL ) return ;
short boardID = boardIDEntry - > GetNumber ( ) ;
short ch = chIDEntry - > GetNumber ( ) ;
unsigned int temp = numTriggerThreshold - > GetNumber ( ) ;
if ( digi ! = NULL ) digi [ boardID ] - > WriteRegister ( Register : : DPP : : PHA : : TriggerThreshold , temp , ch ) ;
}
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : SetDCOffset ( ) {
2022-09-23 16:40:59 -04:00
printf ( " === %s \n " , __func__ ) ;
2022-09-22 16:26:33 -04:00
if ( digi = = NULL ) return ;
2022-09-23 16:40:59 -04:00
short boardID = boardIDEntry - > GetNumber ( ) ;
short ch = chIDEntry - > GetNumber ( ) ;
double temp = numDCOffset - > GetNumber ( ) ;
2022-10-24 14:40:16 -04:00
uint16_t bit = uint16_t ( ( 1.0 - temp / 100. ) * 0xFFFF ) ;
2022-09-23 16:40:59 -04:00
printf ( " %.2f = 0x%x \n " , temp , bit ) ;
2022-10-24 14:40:16 -04:00
if ( digi ! = NULL ) digi [ boardID ] - > WriteRegister ( Register : : DPP : : ChannelDCOffset , ( bit & 0xFFFF ) , ch ) ;
2022-09-22 16:26:33 -04:00
}
2022-09-23 17:43:30 -04:00
void ChannelSettingPHA : : SetTriggerSmoothing ( ) {
2022-09-23 16:40:59 -04:00
printf ( " === %s \n " , __func__ ) ;
2022-09-22 16:26:33 -04:00
if ( digi = = NULL ) return ;
2022-09-23 16:40:59 -04:00
short boardID = boardIDEntry - > GetNumber ( ) ;
short ch = chIDEntry - > GetNumber ( ) ;
if ( digi ! = NULL ) digi [ boardID ] - > WriteRegister ( Register : : DPP : : PHA : : RCCR2SmoothingFactor , ( unsigned int ) cbTriggerSmoothing - > GetSelected ( ) , ch ) ;
2022-09-22 16:26:33 -04:00
}
2022-09-27 17:58:14 -04:00
void ChannelSettingPHA : : ReadTrace ( ) {
2022-09-28 15:09:27 -04:00
printf ( " === %s \n " , __func__ ) ;
2022-09-27 17:58:14 -04:00
///Send plot trace to MainWindows
2022-10-03 14:17:15 -04:00
SendPlotTraceCmd ( ) ;
}
void ChannelSettingPHA : : SendPlotTraceCmd ( ) {
printf ( " === %s \n " , __func__ ) ;
Emit ( " SendPlotTraceCmd() " ) ;
2022-09-27 17:58:14 -04:00
}