From 6a64b37e38269ec032dac4f4faf2bde54afb52e7 Mon Sep 17 00:00:00 2001 From: "carina@hades" Date: Fri, 23 Sep 2022 16:40:59 -0400 Subject: [PATCH] boardSetting for PSD --- ClassDigitizer.cpp | 42 ++--- RegisterAddress.h | 2 + boardSetting.cpp | 405 +++++++++++++++++++++++++++------------------ boardSetting.h | 5 +- channelSetting.cpp | 93 ++++------- 5 files changed, 299 insertions(+), 248 deletions(-) diff --git a/ClassDigitizer.cpp b/ClassDigitizer.cpp index 925ed07..2771987 100644 --- a/ClassDigitizer.cpp +++ b/ClassDigitizer.cpp @@ -279,7 +279,7 @@ int Digitizer::ProgramBoard(){ ret |= CAEN_DGTZ_SetRunSynchronizationMode(handle, CAEN_DGTZ_RUN_SYNC_Disabled); - ErrorMsg("End of ProgramBoard"); + ErrorMsg(__func__); return ret; } @@ -330,7 +330,7 @@ void Digitizer::ReadData(){ printf("Read Buffer size %d byte, Event Size : %d byte \n", data->nByte, EventSize); if (ret || data->nByte == 0) { - ErrorMsg("ReadData"); + ErrorMsg(__func__); return; } @@ -376,63 +376,63 @@ void Digitizer::SetChannelMask(uint32_t mask){ channelMask = mask; ret |= CAEN_DGTZ_SetChannelEnableMask(handle, channelMask); SaveSettingEditByteByRegister(Register::DPP::ChannelEnableMask); - ErrorMsg("SetChannelMask"); + ErrorMsg(__func__); } void Digitizer::SetRecordLength(unsigned int ns, int ch){ WriteRegister( Register::DPP::RecordLength_G, ns / ch2ns / 8 , ch); if( ch >= 0 ) WriteRegister( Register::DPP::RecordLength_G, ns / ch2ns / 8 , ch + int(pow(-1, ch))); - ErrorMsg("SetRecordLength"); + ErrorMsg(__func__); } void Digitizer::SetAggregateOrganization(unsigned int bit){ WriteRegister(Register::DPP::AggregateOrganization, bit & 0x7); - ErrorMsg("SetAggregateOrganization"); + ErrorMsg(__func__); } void Digitizer::SetEventAggregation(unsigned int numEvent, int ch){ WriteRegister( Register::DPP::NumberEventsPerAggregate_G,numEvent, ch); if( ch >= 0 ) WriteRegister( Register::DPP::NumberEventsPerAggregate_G,numEvent, ch + int(pow(-1, ch))); - ErrorMsg("SetEventAggregation"); + ErrorMsg(__func__); } void Digitizer::SetMaxAggregatePerBlockTransfer(unsigned int numEvent){ WriteRegister( Register::DPP::MaxAggregatePerBlockTransfer,numEvent); - ErrorMsg("SetMaxNumberOfAggregatePerBlockTransfer"); + ErrorMsg(__func__); } void Digitizer::SetACQControl(uint32_t bit){ WriteRegister( Register::DPP::AcquisitionControl, bit); - ErrorMsg("SetACQControl"); + ErrorMsg(__func__); } void Digitizer::SetGlobalTriggerMask(uint32_t bit){ WriteRegister( Register::DPP::GlobalTriggerMask, bit); - ErrorMsg("SetGlobalTriggerMask"); + ErrorMsg(__func__); } void Digitizer::SetFrontPanelTRGOUTMask(uint32_t bit){ WriteRegister( Register::DPP::FrontPanelTRGOUTEnableMask, bit); - ErrorMsg("SetFrontPanelTRGOUTMask"); + ErrorMsg(__func__); } void Digitizer::SetFrontPanelIOControl(uint32_t bit){ WriteRegister( Register::DPP::FrontPanelIOControl, bit); - ErrorMsg("SetFrontPanelIOControl"); + ErrorMsg(__func__); } void Digitizer::SetTriggerValidationMask(uint32_t bit){ WriteRegister( Register::DPP::TriggerValidationMask, bit); - ErrorMsg("SetTriggerValidationMask"); + ErrorMsg(__func__); } -void Digitizer::SetInputDynamicRange(unsigned int TwoVol_0_or_halfVol_1, int ch){ WriteRegister( Register::DPP::InputDynamicRange, TwoVol_0_or_halfVol_1, ch); ErrorMsg("SetInputDynamicRange");} -void Digitizer::SetPreTriggerSample(unsigned int nSample, int ch) { WriteRegister( Register::DPP::PreTrigger, nSample / 4, ch); ErrorMsg("SetPreTriggerSample");} -void Digitizer::SetPreTriggerDuration(unsigned int ns, int ch) { WriteRegister( Register::DPP::PreTrigger, ns / ch2ns / 4, ch); ErrorMsg("SetPreTriggerSample");} -void Digitizer::SetDCOffset(float offsetPrecentage, int ch) { WriteRegister( Register::DPP::ChannelDCOffset, uint( 0xFFFF * (1.0-offsetPrecentage)), ch ); ErrorMsg("SetDCOffset");} -void Digitizer::SetVetoWidth(uint32_t bit, int ch) { WriteRegister( Register::DPP::VetoWidth, bit, ch); ErrorMsg("SetVetoWidth");} +void Digitizer::SetInputDynamicRange(unsigned int TwoVol_0_or_halfVol_1, int ch){ WriteRegister( Register::DPP::InputDynamicRange, TwoVol_0_or_halfVol_1, ch); ErrorMsg(__func__);} +void Digitizer::SetPreTriggerSample(unsigned int nSample, int ch) { WriteRegister( Register::DPP::PreTrigger, nSample / 4, ch); ErrorMsg(__func__);} +void Digitizer::SetPreTriggerDuration(unsigned int ns, int ch) { WriteRegister( Register::DPP::PreTrigger, ns / ch2ns / 4, ch); ErrorMsg(__func__);} +void Digitizer::SetDCOffset(float offsetPrecentage, int ch) { WriteRegister( Register::DPP::ChannelDCOffset, uint( 0xFFFF * (1.0-offsetPrecentage)), ch ); ErrorMsg(__func__);} +void Digitizer::SetVetoWidth(uint32_t bit, int ch) { WriteRegister( Register::DPP::VetoWidth, bit, ch); ErrorMsg(__func__);} void Digitizer::SetTriggerPolarity(bool RiseingIsZero, int ch ){ if( !isConnected ) return; @@ -445,7 +445,7 @@ void Digitizer::SetTriggerPolarity(bool RiseingIsZero, int ch ){ }else{ ret = CAEN_DGTZ_SetTriggerPolarity(handle, ch, CAEN_DGTZ_TriggerPolarity_t(RiseingIsZero)); } - if( ret != 0 ) ErrorMsg("SetTriggerPolarity"); + if( ret != 0 ) ErrorMsg(__func__); } @@ -490,7 +490,7 @@ void Digitizer::SetDPPAlgorithmControl(uint32_t bit, int ch){ /// [29] Enable the optimization of the Baseline Restorer to avoid tails in the energy peaks. 0 = disbale, 1 = enable WriteRegister( Register::DPP::DPPAlgorithmControl, bit, ch); - if( ret != 0 ) ErrorMsg("SetDPPAlgorithmControl"); + if( ret != 0 ) ErrorMsg(__func__); } unsigned int Digitizer::ReadBits(uint32_t address, unsigned int bitLength, unsigned int bitSmallestPos, int ch ){ @@ -512,7 +512,7 @@ void Digitizer::SetBits(uint32_t address, unsigned int bitValue, unsigned int bi bit = (bit & ~bitmask) | (bitValue << bitSmallestPos); ///printf("bit : 0x%x, ch : %d \n", bit, ch); WriteRegister(address, bit, ch); - if( ret != 0 ) ErrorMsg("SetBits"); + if( ret != 0 ) ErrorMsg(__func__); } int Digitizer::GetChTemperature(int ch){ @@ -523,7 +523,7 @@ int Digitizer::GetChTemperature(int ch){ uint32_t * temp; ret |= CAEN_DGTZ_ReadTemperature(handle, ch, temp); - if( ret != 0 ) ErrorMsg("GetChTemperature"); + if( ret != 0 ) ErrorMsg(__func__); return temp[0]; } diff --git a/RegisterAddress.h b/RegisterAddress.h index a46be0e..83353d1 100644 --- a/RegisterAddress.h +++ b/RegisterAddress.h @@ -7,6 +7,8 @@ /// Group register, 2m and 2m+1 channels setting are shared. and the name will have _G as prefix /// Most 0x8XXX registers are common, which share for all channel +#define GET_NAME(name) #name /// this give out the name, printf("%s", GET_NAME(Register::EventReadOutBuffer)); + namespace Register { const uint32_t EventReadOutBuffer = 0x0000; /// R diff --git a/boardSetting.cpp b/boardSetting.cpp index 27aaa9e..55a4bc4 100644 --- a/boardSetting.cpp +++ b/boardSetting.cpp @@ -24,8 +24,8 @@ Pixel_t BoardSetting::red = 0; Pixel_t BoardSetting::blue = 0; TGNumberEntry * BoardSetting::boardIDEntry = NULL; Digitizer ** BoardSetting::digi = NULL; -DigitizerPHA * BoardSetting::pha = NULL; -DigitizerPSD * BoardSetting::psd = NULL; +//DigitizerPHA * BoardSetting::pha = NULL; +//DigitizerPSD * BoardSetting::psd = NULL; TGTextEntry * BoardSetting::txtACQStatus = NULL; TGTextEntry * BoardSetting::txtACQEventReady = NULL; @@ -249,7 +249,7 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d bDecimateWF = new TGCheckButton(vBdCfg1, "Decimate WaveForm", 1); vBdCfg1->AddFrame(bDecimateWF, haha); bDecimateWF->SetState(kButtonUp); bDecimateWF->Connect("Clicked()", "BoardSetting", this, "SetBoardConfiguration()"); - + bWFRecord = new TGCheckButton(vBdCfg1, "Record WaveFrom", 1); vBdCfg1->AddFrame(bWFRecord, haha); bWFRecord->SetState(kButtonUp); bWFRecord->Connect("Clicked()", "BoardSetting", this, "SetBoardConfiguration()"); @@ -321,24 +321,10 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d TGLabel * lbDP2 = new TGLabel(vBdCfg_Probe_Label, "Digi. Prb. 2"); vBdCfg_Probe_Label->AddFrame(lbDP2, kaka); cbDP2 = new TGComboBox(vBdCfg_Probe_CBox, "Digital. Pb.", 1); vBdCfg_Probe_CBox->AddFrame(cbDP2); cbDP2->EnableTextInput(false); - cbDP2->AddEntry("Peaking", 0); - cbDP2->AddEntry("Armed (Triggered)", 1); - cbDP2->AddEntry("Peak Run", 2); - cbDP2->AddEntry("Pile-Up", 3); - cbDP2->AddEntry("Peaking", 4); - cbDP2->AddEntry("TRG Validation Win.", 5); - cbDP2->AddEntry("Baseline freeze", 6); - cbDP2->AddEntry("TRG holdoff", 7); - cbDP2->AddEntry("TRG Validation", 8); - cbDP2->AddEntry("ACQ busy", 9); - cbDP2->AddEntry("Zero Cross", 10); - cbDP2->AddEntry("Ext. TRG", 11); - cbDP2->AddEntry("Memory full", 12); + cbDP2->AddEntry("Trigger", 0); cbDP2->Resize(150, 20); - cbDP2->SetEnabled(false); cbDP2->Connect("Changed()", "BoardSetting", this, "SetBoardConfiguration()"); - TGHorizontalFrame * hframeBdCfg3 = new TGHorizontalFrame(vBdCfg0); vBdCfg0->AddFrame(hframeBdCfg3, new TGLayoutHints( kLHintsCenterX, 5, 5, 5, 5)); TGVerticalFrame * vBdCfga_label = new TGVerticalFrame(hframeBdCfg3); hframeBdCfg3->AddFrame(vBdCfga_label, new TGLayoutHints( kLHintsLeft, 5, 5, 10, 0) ); @@ -716,8 +702,8 @@ BoardSetting::~BoardSetting(){ for( int i = 0; i < nDigi; i++) digi[i] = 0; - pha = 0; - psd = 0; + //pha = 0; + //psd = 0; fMain->Cleanup(); delete fMain; @@ -729,7 +715,6 @@ void BoardSetting::LogMsg(TString msg){ } void * BoardSetting::ReadStatus(void * ptr){ - if( digi == NULL ) return 0; int pauseTime = 1000; /// msec @@ -737,14 +722,14 @@ void * BoardSetting::ReadStatus(void * ptr){ if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ) { - pha = dynamic_cast (digi[boardID]); + //pha = dynamic_cast (digi[boardID]); //while( digi[boardID]->isACQRunning() == false ){ while( isOpened ){ - printf("=========== readStatus () for PHA\n"); + printf("=========== %s for PHA\n", __func__); /// ACQ Status - uint32_t temp = pha->ReadRegister(Register::DPP::AcquisitionStatus); + uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::AcquisitionStatus); txtACQStatus ->SetText( ((temp >> 2) & 0x1) == 0 ? "ACQ is stopped" : "ACQ is Running", false); txtACQStatus->SetTextColor( ((temp >> 2) & 0x1) == 0 ? 1 : blue); txtACQEventReady ->SetText( ((temp >> 3) & 0x1) == 0 ? "no Event" : "Has Events", false); txtACQEventReady->SetTextColor( ((temp >> 3) & 0x1) == 0 ? 1 : blue); @@ -764,7 +749,7 @@ void * BoardSetting::ReadStatus(void * ptr){ txtACQTemp3->SetText( ((temp >> 23) & 0x1) == 0 ? "< 70" : "> 70", false); txtACQTemp3->SetTextColor( ((temp >> 23) & 0x1) == 0 ? 1 : red); /// Redaout Status - temp = pha->ReadRegister(Register::DPP::ReadoutStatus); + temp = digi[boardID]->ReadRegister(Register::DPP::ReadoutStatus); if( (temp & 0x1) == 1 ){ txtEventReady->SetText( "Event Ready" , false); txtEventReady->SetTextColor(blue); }else{ @@ -786,11 +771,11 @@ void * BoardSetting::ReadStatus(void * ptr){ usleep(pauseTime*1000); } - pha = 0; } } void BoardSetting::ChangeBoard(){ + printf("=== %s\n", __func__); if( digi == NULL ) { printf("no didgitizers\n"); @@ -831,121 +816,216 @@ void BoardSetting::ChangeBoard(){ } ///================ Board Failure Status + unsigned int tempBits; + + tempBits = digi[boardID]->ReadRegister(Register::BoardFailureStatus); + if( (tempBits & 0x10) == 0 ) { + enPLLStatus->SetText( "OK" , false); enPLLStatus->SetTextColor(1); + }else{ + enPLLStatus->SetText( "Lost Lock" , false); enPLLStatus->SetTextColor(red); + } + + if( (tempBits & 0x20) == 0 ) { + enTempStatus->SetText( "OK (<70)" , false); enTempStatus->SetTextColor(1); + }else{ + enTempStatus->SetText( "Failure" , false); enTempStatus->SetTextColor(red); + } + + if( (tempBits & 0x40) == 0 ) { + enADCPwrStatus->SetText( "OK", false); enADCPwrStatus->SetTextColor(1); + }else{ + enADCPwrStatus->SetText( "Failure", false); enADCPwrStatus->SetTextColor(red); + } + + cbAggOrg->Select( digi[boardID]->ReadRegister(Register::DPP::AggregateOrganization) , false); + numAggBLT->SetNumber( digi[boardID]->ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer) , false); + cbFanCtrl->Select( digi[boardID]->ReadRegister(Register::DPP::FanSpeedControl) , false); + numRunStartStopDelay->SetNumber( digi[boardID]->ReadRegister(Register::DPP::RunStartStopDelay), false); + bEnableExtTRG->SetState( (digi[boardID]->ReadRegister(Register::DPP::DisableExternalTrigger) & 0x1) ? kButtonDown : kButtonUp, false); + numExtendVetoDelay->SetNumber( digi[boardID]->ReadRegister(Register::DPP::ExtendedVetoDelay) , false); + + cbAnaMonitor->Select( digi[boardID]->ReadRegister(Register::DPP::AnalogMonitorMode) & 0x7 , false); + numBufferOccpGain->SetNumber( digi[boardID]->ReadRegister(Register::DPP::BufferOccupancyGain) & 0xf, false); + + /// ACQ Control + //digi[boardID]->PrintRegister(Register::DPP::AcquisitionControl, "AcquisitionControl"); + tempBits = digi[boardID]->ReadRegister(Register::DPP::AcquisitionControl); + cbAcqMode->Select( tempBits & 0x3 , false); + bAcqArm->SetState( ((tempBits >> 2) & 0x1) ? kButtonDown : kButtonUp, false); + cbPLLref->Select( ((tempBits >> 6) & 0x1), false); + + /// Global Trigger Mask + tempBits = digi[boardID]->ReadRegister(Register::DPP::GlobalTriggerMask); + for( int i = 0; i < 8; i++){ + cbGbTRGMskCh[i]->SetState( ((tempBits >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown , false); + } + numMajorCoinWin->SetNumber( (tempBits >> 20 ) & 0x7 , false); + GlbMajorLevel->SetNumber( ( tempBits >> 24) & 0x7 , false); + bGLBExtTrigger->SetState( (( tempBits >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + bGLBSoftwareTrigger->SetState( (( tempBits >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + + /// Trigger Validation Mask + tempBits = digi[boardID]->ReadRegister(Register::DPP::TriggerValidationMask); + for( int i = 0; i < 8; i++){ + cbTRGValMskCh[i]->SetState( ((tempBits >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown , false); + } + cbTRGMODE->Select( ( tempBits >> 8 ) & 0x3, false) ; + TRGMajorLevel->SetNumber( ( tempBits >> 10 ) & 0x3, false); + bTRGExtTrigger->SetState( (( tempBits >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + bTRGSoftwareTrigger->SetState( (( tempBits >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + + /// Front Panel TRG-OUT Enable Mask , PHA = PSD only for bit[19:0] + tempBits = digi[boardID]->ReadRegister(Register::DPP::FrontPanelTRGOUTEnableMask); + for( int i = 0; i < 8; i++){ + cbTRGOUTMskCh[i]->SetState( ((tempBits >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown, false ); + } + cbTRGOUTMODE->Select( ( tempBits >> 8 ) & 0x3, false) ; + TRGOUTMajorLevel->SetNumber( ( tempBits >> 10 ) & 0x7, false); + bTRGOUTExtTrigger->SetState( (( tempBits >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + bTRGOUTSoftwareTrigger->SetState( (( tempBits >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + + /// Front Panel I/O Control, PHA = PSD only for bit[19:0] + tempBits = digi[boardID]->ReadRegister(Register::DPP::FrontPanelIOControl); + cbLEMOIO->Select( tempBits & 0x1 , false); + if( ((tempBits >> 1) & 0x1 ) == 0 ) { + cbTRGOUTmode->Select( 1 , false); + }else{ + cbTRGOUTmode->Select( (tempBits >> 14) & 0x3F , false); + } + cbTRGINCtrl->Select( (tempBits >> 10) & 0x1 , false); + cbTRGINMezzanines->Select( (tempBits >> 11) & 0x1 , false); + + /// Readout Control + tempBits = digi[boardID]->ReadRegister(Register::DPP::ReadoutControl); + cbVMEInterrupLevel->Select( tempBits & 0x3 , false); + bOpticalLinkInterrupt->SetState( (( tempBits >> 3 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ; + bEventAligned->SetState( (( tempBits >> 4 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ; + bVMEAlogn64Mode->SetState( (( tempBits >> 5 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ; + bInteruptReleaseMode->SetState( (( tempBits >> 7 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ; + bEnableExtendedBlockTransfer->SetState( (( tempBits >> 8 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ; + if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ) { - pha = dynamic_cast (digi[boardID]); + bDecimateWF->SetEnabled(true); - unsigned int temp = pha->ReadRegister(Register::BoardFailureStatus); + cbAP1->RemoveAll(); + cbAP1->AddEntry("Input", 0); + cbAP1->AddEntry("RC-CR (1st derivative)", 1); + cbAP1->AddEntry("RC-CR2 (2st derivative)", 2); + cbAP1->AddEntry("Trapezoid", 3); - if( (temp & 0x10) == 0 ) { - enPLLStatus->SetText( "OK" , false); enPLLStatus->SetTextColor(1); - }else{ - enPLLStatus->SetText( "Lost Lock" , false); enPLLStatus->SetTextColor(red); - } + cbAP2->SetEnabled(true); + cbAP2->RemoveAll(); + cbAP2->AddEntry("Input", 0); + cbAP2->AddEntry("Threshold", 1); + cbAP2->AddEntry("Trapezoid - Baseline", 2); + cbAP2->AddEntry("Baseline", 3); - if( (temp & 0x20) == 0 ) { - enTempStatus->SetText( "OK (<70)" , false); enTempStatus->SetTextColor(1); - }else{ - enTempStatus->SetText( "Failure" , false); enTempStatus->SetTextColor(red); - } + cbDP1->RemoveAll(); + cbDP1->AddEntry("Peaking", 0); + cbDP1->AddEntry("Armed (Triggered)", 1); + cbDP1->AddEntry("Peak Run", 2); + cbDP1->AddEntry("Pile-Up", 3); + cbDP1->AddEntry("Peaking", 4); + cbDP1->AddEntry("TRG Validation Win.", 5); + cbDP1->AddEntry("Baseline freeze", 6); + cbDP1->AddEntry("TRG holdoff", 7); + cbDP1->AddEntry("TRG Validation", 8); + cbDP1->AddEntry("ACQ busy", 9); + cbDP1->AddEntry("Zero Cross", 10); + cbDP1->AddEntry("Ext. TRG", 11); + cbDP1->AddEntry("Memory full", 12); - if( (temp & 0x40) == 0 ) { - enADCPwrStatus->SetText( "OK", false); enADCPwrStatus->SetTextColor(1); - }else{ - enADCPwrStatus->SetText( "Failure", false); enADCPwrStatus->SetTextColor(red); - } - - //pha->PrintBoardConfiguration(); - temp = pha->ReadRegister(Register::DPP::BoardConfiguration); - - bAutoDataFlush->SetState( (temp & 0x1) ? kButtonDown : kButtonUp, false); - bDecimateWF->SetState( ((temp >> 1) & 0x1) ? kButtonDown : kButtonUp, false ); - bWFRecord->SetState( ((temp >> 16) & 0x1) ? kButtonDown : kButtonUp, false ); - bTrigPropa->SetState( ((temp >> 2) & 0x1) ? kButtonDown : kButtonUp, false ); - bExtrac2->SetState( ((temp >> 17) & 0x1) ? kButtonDown : kButtonUp, false ); - bDualTrace->SetState( ((temp >> 11) & 0x1) ? kButtonDown : kButtonUp, false ); - cbAP1->Select( ((temp >> 12) & 0x3) , false); - cbAP2->Select( ((temp >> 14) & 0x3) , false); - cbDP1->Select( ((temp >> 20) & 0x7) , false); - - cbAggOrg->Select( pha->ReadRegister(Register::DPP::AggregateOrganization) , false); - numAggBLT->SetNumber( pha->ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer) , false); - - cbFanCtrl->Select( pha->ReadRegister(Register::DPP::FanSpeedControl) , false); - - //pha->PrintACQControl(); - temp = pha->ReadRegister(Register::DPP::AcquisitionControl); - - cbAcqMode->Select( temp & 0x3 , false); - bAcqArm->SetState( ((temp >> 2) & 0x1) ? kButtonDown : kButtonUp, false); - cbPLLref->Select( ((temp >> 6) & 0x1), false); - - numRunStartStopDelay->SetNumber( pha->ReadRegister(Register::DPP::RunStartStopDelay), false); - - /// Global Trigger Mask - temp = pha->ReadRegister(Register::DPP::GlobalTriggerMask); - for( int i = 0; i < 8; i++){ - cbGbTRGMskCh[i]->SetState( ((temp >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown , false); - } - numMajorCoinWin->SetNumber( (temp >> 20 ) & 0x7 , false); - GlbMajorLevel->SetNumber( ( temp >> 24) & 0x7 , false); - bGLBExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); - bGLBSoftwareTrigger->SetState( (( temp >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + cbDP2->RemoveAll(); + cbDP2->AddEntry("Trigger", 0); - /// Trigger Validation Mask - temp = pha->ReadRegister(Register::DPP::TriggerValidationMask); - for( int i = 0; i < 8; i++){ - cbTRGValMskCh[i]->SetState( ((temp >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown , false); - } - cbTRGMODE->Select( ( temp >> 8 ) & 0x3, false) ; - TRGMajorLevel->SetNumber( ( temp >> 10 ) & 0x3, false); - bTRGExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); - bTRGSoftwareTrigger->SetState( (( temp >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); - - /// Front Panel TRG-OUT Enable Mask - temp = pha->ReadRegister(Register::DPP::FrontPanelTRGOUTEnableMask); - for( int i = 0; i < 8; i++){ - cbTRGOUTMskCh[i]->SetState( ((temp >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown, false ); - } - cbTRGOUTMODE->Select( ( temp >> 8 ) & 0x3, false) ; - TRGOUTMajorLevel->SetNumber( ( temp >> 10 ) & 0x7, false); - bTRGOUTExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); - bTRGOUTSoftwareTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + cbDP2->SetEnabled(false); + cbDP2->Select(-1, false); - bEnableExtTRG->SetState( (pha->ReadRegister(Register::DPP::DisableExternalTrigger) & 0x1) ? kButtonDown : kButtonUp, false); + /// Board Configuration + //digi[boardID]->PrintRegister(Register::DPP::BoardConfiguration, "BoardConfiguration"); + tempBits = digi[boardID]->ReadRegister(Register::DPP::BoardConfiguration); - numExtendVetoDelay->SetNumber( pha->ReadRegister(Register::DPP::ExtendedVetoDelay) , false); + bAutoDataFlush->SetState( (tempBits & 0x1) ? kButtonDown : kButtonUp, false); + bDecimateWF->SetState( ((tempBits >> 1) & 0x1) ? kButtonDown : kButtonUp, false ); + bWFRecord->SetState( ((tempBits >> 16) & 0x1) ? kButtonDown : kButtonUp, false ); + bTrigPropa->SetState( ((tempBits >> 2) & 0x1) ? kButtonDown : kButtonUp, false ); + bExtrac2->SetState( ((tempBits >> 17) & 0x1) ? kButtonDown : kButtonUp, false ); + bDualTrace->SetState( ((tempBits >> 11) & 0x1) ? kButtonDown : kButtonUp, false ); + cbAP1->Select( ((tempBits >> 12) & 0x3) , false); + cbAP2->Select( ((tempBits >> 14) & 0x3) , false); + cbDP1->Select( ((tempBits >> 20) & 0x7) , false); - /// Front Panel I/O Control - temp = pha->ReadRegister(Register::DPP::FrontPanelIOControl); - cbLEMOIO->Select( temp & 0x1 , false); - - if( ((temp >> 1) & 0x1 ) == 0 ) { - cbTRGOUTmode->Select( 1 , false); - }else{ - cbTRGOUTmode->Select( (temp >> 14) & 0x3F , false); - } - cbTRGINCtrl->Select( (temp >> 10) & 0x1 , false); - cbTRGINMezzanines->Select( (temp >> 11) & 0x1 , false); - - cbAnaMonitor->Select( pha->ReadRegister(Register::DPP::AnalogMonitorMode) & 0x7 , false); - numBufferOccpGain->SetNumber( pha->ReadRegister(Register::DPP::BufferOccupancyGain) & 0xf, false); - - /// Readout Control - temp = pha->ReadRegister(Register::DPP::ReadoutControl); - cbVMEInterrupLevel->Select( temp & 0x3 , false); - bOpticalLinkInterrupt->SetState( (( temp >> 3 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ; - bEventAligned->SetState( (( temp >> 4 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ; - bVMEAlogn64Mode->SetState( (( temp >> 5 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ; - bInteruptReleaseMode->SetState( (( temp >> 7 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ; - bEnableExtendedBlockTransfer->SetState( (( temp >> 8 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ; - - pha = NULL; ///unlink the pointer }else if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE ) { + bDecimateWF->SetEnabled(false); + cbDP2->SetEnabled(true); - }else{ ///========== disable all others - bAutoDataFlush->SetEditable(false); + cbAP1->RemoveAll(); + cbAP1->AddEntry("Input", 0); + cbAP1->AddEntry("CFD", 1); + cbAP1->AddEntry("Input", 2); + + cbAP2->SetEnabled(false); + cbAP2->RemoveAll(); + cbAP2->AddEntry("N/A", -1); + cbAP2->AddEntry("Baseline", 0); + cbAP2->AddEntry("CFD", 1); + + cbDP1->RemoveAll(); + cbDP1->AddEntry("Long Gate", 0); + cbDP1->AddEntry("Over Threshold", 1); + cbDP1->AddEntry("Shaped TRG", 2); + cbDP1->AddEntry("TRG Val. Accep. Win.", 3); + cbDP1->AddEntry("Pile Up", 4); + cbDP1->AddEntry("Coincidence", 5); + cbDP1->AddEntry("Trigger", 7); + + cbDP2->RemoveAll(); + cbDP2->AddEntry("Short Gate", 0); + cbDP2->AddEntry("Over Threshold", 1); + cbDP2->AddEntry("TRG Validation", 2); + cbDP2->AddEntry("TRG Holdoff", 3); + cbDP2->AddEntry("PileUp Trigger", 4); + cbDP2->AddEntry("PSD Cut hight", 5); + cbDP2->AddEntry("Baseline freeze", 6); + cbDP2->AddEntry("Trigger", 7); + + tempBits = digi[boardID]->ReadRegister(Register::DPP::BoardConfiguration); + + bAutoDataFlush->SetState( (tempBits & 0x1) ? kButtonDown : kButtonUp, false); + bTrigPropa->SetState( ((tempBits >> 2) & 0x1) ? kButtonDown : kButtonUp, false ); + + if( ((tempBits >> 11) & 0x1) == 1 ) { /// Dual Trace + bDualTrace->SetState(kButtonDown , false ); + + switch ((tempBits >> 12) & 0x3) { + case 0 : { + cbAP1->Select( 0, false); + cbAP2->Select( 0, false); + }; break; + + case 1 : { + cbAP1->Select( 1, false); + cbAP2->Select( 0, false); + }; break; + + case 2 : { + cbAP1->Select( 2, false); + cbAP2->Select( 1, false); + }; break; + } + }else{ + bDualTrace->SetState( kButtonUp, false ); + cbAP1->Select( ((tempBits >> 12) & 0x3) , false); + cbAP2->Select(-1, false); + } + + bWFRecord->SetState( ((tempBits >> 16) & 0x1) ? kButtonDown : kButtonUp, false ); + bExtrac2->SetState( ((tempBits >> 17) & 0x1) ? kButtonDown : kButtonUp, false ); + + cbDP1->Select( ((tempBits >> 23) & 0x7) , false); + cbDP2->Select( ((tempBits >> 26) & 0x7) , false); } @@ -955,7 +1035,7 @@ void BoardSetting::ChangeBoard(){ //################################################ Change Settings void BoardSetting::ResetSettingToDefault(){ /// same for PHA and PSD - printf("============== ResetSettingToDefault() \n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -963,7 +1043,7 @@ void BoardSetting::ResetSettingToDefault(){ /// same for PHA and PSD } void BoardSetting::ClearBuffer(){ /// same for PHA and PSD - printf("============== ClearBuffer() \n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -971,7 +1051,7 @@ void BoardSetting::ClearBuffer(){ /// same for PHA and PSD } void BoardSetting::SetBoardConfiguration(){ - printf("============== SetBoardConfiguration() \n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -979,13 +1059,18 @@ void BoardSetting::SetBoardConfiguration(){ if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ) { uint32_t bit = (3 << 18); /// timestamp and energy recording + bit += (18 << 3) ; /// Reserved must be 0010010 for bit[10:3] if( bAutoDataFlush->GetState() == kButtonDown ) bit += 1; if( bDecimateWF->GetState() == kButtonDown ) bit += (1 << 1); if( bWFRecord->GetState() == kButtonDown ) bit += ( 1 << 16); if( bTrigPropa->GetState() == kButtonDown ) bit += ( 1 << 2); if( bExtrac2->GetState() == kButtonDown ) bit += ( 1 << 17); - if( bDualTrace->GetState() == kButtonDown ) bit += ( 1 << 11); - + if( bDualTrace->GetState() == kButtonDown ) { + bit += ( 1 << 11); + cbAP2->SetEnabled(true); + }else{ + cbAP2->SetEnabled(false); + } bit += (cbAP1->GetSelected() << 12); bit += (cbAP2->GetSelected() << 14); bit += (cbDP1->GetSelected() << 20); @@ -994,27 +1079,27 @@ void BoardSetting::SetBoardConfiguration(){ if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE ) { - //uint32_t bit = (3 << 18); /// timestamp and energy recording - //if( bAutoDataFlush->GetState() == kButtonDown ) bit += 1; - //if( bDecimateWF->GetState() == kButtonDown ) bit += (1 << 1); - //if( bWFRecord->GetState() == kButtonDown ) bit += ( 1 << 16); - //if( bTrigPropa->GetState() == kButtonDown ) bit += ( 1 << 2); - //if( bExtrac2->GetState() == kButtonDown ) bit += ( 1 << 17); - //if( bDualTrace->GetState() == kButtonDown ) bit += ( 1 << 11); - // - //bit += (cbAP1->GetSelected() << 12); - //bit += (cbAP2->GetSelected() << 14); - //bit += (cbDP1->GetSelected() << 20); + uint32_t bit = (3 << 18); /// timestamp and energy recording + bit += (18 << 3) ; /// Reserved must be 0010010 for bit[10:3] + if( bAutoDataFlush->GetState() == kButtonDown ) bit += 1; + if( bDecimateWF->GetState() == kButtonDown ) bit += (1 << 1); + if( bWFRecord->GetState() == kButtonDown ) bit += ( 1 << 16); + if( bTrigPropa->GetState() == kButtonDown ) bit += ( 1 << 2); + if( bExtrac2->GetState() == kButtonDown ) bit += ( 1 << 17); + + if( bDualTrace->GetState() == kButtonDown ) bit += ( 1 << 11); + bit += (cbAP1->GetSelected() << 12); + bit += (cbDP1->GetSelected() << 23); + bit += (cbDP2->GetSelected() << 26); } printf("bit : 0x%x \n", bit); - digi[boardID]->WriteRegister(Register::DPP::BoardConfiguration, bit); } void BoardSetting::SetAggregateOrganization(){ /// same for PHA and PSD - printf("========== SetAggregateOrganization, %d \n", cbAggOrg->GetSelected()); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1023,7 +1108,7 @@ void BoardSetting::SetAggregateOrganization(){ /// same for PHA and PSD } void BoardSetting::SetReadOutAggregate(){ /// same for PHA and PSD - printf("========== SetReadOutAggregate, %d \n", (int) numAggBLT->GetNumber()); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1032,7 +1117,7 @@ void BoardSetting::SetReadOutAggregate(){ /// same for PHA and PSD } void BoardSetting::SetFanSpeedControl(){ /// same for PHA and PSD - printf("============== SetFanSpeedControl() \n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1040,7 +1125,7 @@ void BoardSetting::SetFanSpeedControl(){ /// same for PHA and PSD } void BoardSetting::SetACQControl(){ /// same for PHA and PSD - printf("========== SetACQControl()\n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1057,21 +1142,21 @@ void BoardSetting::SetACQControl(){ /// same for PHA and PSD void BoardSetting::SendSoftwareTriggerSignal(){ /// same for PHA and PSD - printf("========== SendSoftwareTriggerSignal()\n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); digi[boardID]->WriteRegister(Register::DPP::SoftwareTrigger, 1 ); } void BoardSetting::SendSoftwareClockSyncSignal(){ /// same for PHA and PSD - printf("========== SendSoftwareClockSyncSignal()\n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); digi[boardID]->WriteRegister(Register::DPP::SoftwareClockSync, 1 ); } void BoardSetting::SetRunStartStopDelay(){ /// same for PHA and PSD - printf("========== SetRunStartStopDelay()\n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1079,7 +1164,7 @@ void BoardSetting::SetRunStartStopDelay(){ /// same for PHA and PSD } void BoardSetting::SetGlobalTriggerMask(){ /// same for PHA and PSD - printf("========== SetGlobalTriggerMask()\n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1096,7 +1181,7 @@ void BoardSetting::SetGlobalTriggerMask(){ /// same for PHA and PSD } void BoardSetting::SetTriggerValidMask(){ /// same for PHA and PSD - printf("========== SetTriggerValidMask()\n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1113,7 +1198,7 @@ void BoardSetting::SetTriggerValidMask(){ /// same for PHA and PSD } void BoardSetting::SetTRGOUTMask(){ /// same for PHA and PSD - printf("========== SetTRGOUTMask()\n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1129,7 +1214,7 @@ void BoardSetting::SetTRGOUTMask(){ /// same for PHA and PSD digi[boardID]->WriteRegister(Register::DPP::FrontPanelTRGOUTEnableMask, bit ); } void BoardSetting::SetEnableExternalTrigger(){ /// same for PHA and PSD - printf("========== SetTRGOUTMask()\n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1139,7 +1224,7 @@ void BoardSetting::SetEnableExternalTrigger(){ /// same for PHA and PSD } void BoardSetting::SetExtendedVetoDelay(){ /// same for PHA and PSD - printf("========== SetExtendedVetoDelay()\n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1147,7 +1232,7 @@ void BoardSetting::SetExtendedVetoDelay(){ /// same for PHA and PSD } void BoardSetting::SetFrontPanelIO(){ /// bit[20] different, bit[20] (PSD) not impletemented, PHA, bit[20] not use - printf("========== SetFrontPanelIO()\n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1167,7 +1252,7 @@ void BoardSetting::SetFrontPanelIO(){ /// bit[20] different, bit[20] (PSD) not } void BoardSetting::SetAnalogMonitorMode(){ /// same for PHA and PSD - printf("========== SetAnalogMonitorMode(), %d \n", cbAnaMonitor->GetSelected()); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); @@ -1182,7 +1267,7 @@ void BoardSetting::SetAnalogMonitorMode(){ /// same for PHA and PSD } void BoardSetting::SetReadOutControl(){ /// same for PHA and PSD - printf("========== SetReadOutControl() \n"); + printf("=== %s\n", __func__); if( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); uint32_t bit = 0; diff --git a/boardSetting.h b/boardSetting.h index a6fb66d..40f729e 100644 --- a/boardSetting.h +++ b/boardSetting.h @@ -30,8 +30,8 @@ class BoardSetting{ int nDigi; static Digitizer ** digi; - static DigitizerPHA * pha; - static DigitizerPSD * psd; + //static DigitizerPHA * pha; + //static DigitizerPSD * psd; /// board failure status TGTextEntry * enPLLStatus; @@ -106,7 +106,6 @@ class BoardSetting{ /// Front Panel IO Control TGComboBox * cbLEMOIO; TGComboBox * cbTRGOUTmode; - //TGCheckButton * bTRGOUTImp; TGComboBox * cbTRGINCtrl; TGComboBox * cbTRGINMezzanines; TGComboBox * cbAnaMonitor; diff --git a/channelSetting.cpp b/channelSetting.cpp index 4109118..362d0ee 100644 --- a/channelSetting.cpp +++ b/channelSetting.cpp @@ -491,7 +491,7 @@ void ChannelSetting::ChangeCh(){ } void ChannelSetting::SetAllChannels(){ - printf("=================== SetAllChannels()\n"); + printf("=== %s\n", __func__); if ( digi == NULL ) return; @@ -534,7 +534,7 @@ void ChannelSetting::SetAllChannels(){ } void ChannelSetting::SetChannelMask(){ - printf("=================== SetChannelMask()\n"); + printf("=== %s\n", __func__); if ( digi == NULL ) return; short boardID = boardIDEntry->GetNumber(); @@ -549,7 +549,7 @@ void ChannelSetting::SetChannelMask(){ } void ChannelSetting::SetDPPAlgorithm1(){ - printf("=================== SetDPPAlgorithm1()\n"); + printf("=== %s\n", __func__); if ( digi == NULL ) return; short boardID = boardIDEntry->GetNumber(); @@ -580,7 +580,7 @@ void ChannelSetting::SetDPPAlgorithm1(){ } void ChannelSetting::SetDPPAlgorithm2(){ - printf("=================== SetDPPAlgorithm2()\n"); + printf("=== %s\n", __func__); if ( digi == NULL ) return; short boardID = boardIDEntry->GetNumber(); @@ -609,7 +609,7 @@ void ChannelSetting::SetDPPAlgorithm2(){ } void ChannelSetting::SetInputDynamicRange(){ - printf("=================== SetInputDynamicRange()\n"); + printf("=== %s\n", __func__); if ( digi == NULL ) return; short boardID = boardIDEntry->GetNumber(); @@ -617,6 +617,7 @@ void ChannelSetting::SetInputDynamicRange(){ digi[boardID]->WriteRegister(Register::DPP::InputDynamicRange, cbInputDynamicRange->GetSelected(), ch); } + void ChannelSetting::ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSize, uint32_t address){ unsigned int temp = numEntry->GetNumber(); @@ -630,72 +631,36 @@ void ChannelSetting::ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSi if( digi != NULL ) digi[boardID]->WriteRegister(address, temp / stepSize / ch2ns , ch); } -void ChannelSetting::SetRecordLength(){ - printf("=================== SetRecordLength()\n"); - ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G); -} - -void ChannelSetting::SetPreTrigger(){ - printf("=================== SetPreTrigger()\n"); - ChangeAStep(numPreTrigger, 4, Register::DPP::PreTrigger); -} - -void ChannelSetting::SetEventAggregate(){ - printf("=================== SetEventAggregate()\n"); - if ( digi == NULL ) return; -} - -void ChannelSetting::SetTriggerThreshold(){ - printf("=================== SetTriggerThreshold()\n"); - -} - -void ChannelSetting::SetTriggerHoldOff(){ - printf("=================== SetTriggerHoldOff()\n"); - ChangeAStep(numTriggerHoldOff, 4, Register::DPP::PHA::TriggerHoldOffWidth); -} +void ChannelSetting::SetRecordLength() {printf("=== %s\n", __func__); ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G); } +void ChannelSetting::SetPreTrigger() {printf("=== %s\n", __func__); ChangeAStep(numPreTrigger, 4, Register::DPP::PreTrigger);} +void ChannelSetting::SetEventAggregate() {printf("=== %s\n", __func__); ChangeAStep(numEventAgg, 1, Register::DPP::NumberEventsPerAggregate_G);} +void ChannelSetting::SetTriggerThreshold(){printf("=== %s\n", __func__); ChangeAStep(numTriggerThreshold, 1, Register::DPP::PHA::TriggerThreshold); } +void ChannelSetting::SetTriggerHoldOff() {printf("=== %s\n", __func__); ChangeAStep(numTriggerHoldOff, 4, Register::DPP::PHA::TriggerHoldOffWidth);} +void ChannelSetting::SetInputRiseTime() {printf("=== %s\n", __func__); ChangeAStep(numInputRiseTime, 4, Register::DPP::PHA::InputRiseTime);} +void ChannelSetting::SetRiseTimeValidWin(){printf("=== %s\n", __func__); ChangeAStep(numRiseTimeValidWin, 1, Register::DPP::PHA::RiseTimeValidationWindow);} +void ChannelSetting::SetTrapRiseTime() {printf("=== %s\n", __func__); ChangeAStep(numTrapRiseTime, 4, Register::DPP::PHA::TrapezoidRiseTime);} +void ChannelSetting::SetTrapFlatTop() {printf("=== %s\n", __func__); ChangeAStep(numTrapFlatTop, 4, Register::DPP::PHA::TrapezoidFlatTop);} +void ChannelSetting::SetDecay() {printf("=== %s\n", __func__); ChangeAStep(numDecay, 4, Register::DPP::PHA::DecayTime);} +void ChannelSetting::SetPeaking() {printf("=== %s\n", __func__); ChangeAStep(numPeaking, 4, Register::DPP::PHA::PeakingTime);} +void ChannelSetting::SetPeakHoldOff() {printf("=== %s\n", __func__); ChangeAStep(numPeakHoldOff, 4, Register::DPP::PHA::PeakHoldOff);} void ChannelSetting::SetDCOffset(){ - printf("=================== SetDCOffset()\n"); + printf("=== %s\n", __func__); if ( digi == NULL ) return; + short boardID = boardIDEntry->GetNumber(); + short ch = chIDEntry->GetNumber(); + double temp = numDCOffset->GetNumber(); + uint32_t bit = uint32_t((1.0 - temp) * 0xFFFF); + printf("%.2f = 0x%x \n", temp, bit); + if( digi != NULL ) digi[boardID]->WriteRegister(Register::DPP::ChannelDCOffset, bit , ch); } void ChannelSetting::SetTriggerSmoothing(){ - printf("=================== SetTriggerSmoothing()\n"); + printf("=== %s\n", __func__); if ( digi == NULL ) return; + short boardID = boardIDEntry->GetNumber(); + short ch = chIDEntry->GetNumber(); + if( digi != NULL ) digi[boardID]->WriteRegister(Register::DPP::PHA::RCCR2SmoothingFactor, (unsigned int)cbTriggerSmoothing->GetSelected() , ch); } -void ChannelSetting::SetInputRiseTime(){ - printf("=================== SetInputRiseTime()\n"); - ChangeAStep(numInputRiseTime, 4, Register::DPP::PHA::InputRiseTime); -} -void ChannelSetting::SetRiseTimeValidWin(){ - printf("=================== SetRiseTimeValidWin()\n"); - ChangeAStep(numRiseTimeValidWin, 1, Register::DPP::PHA::RiseTimeValidationWindow); -} - -void ChannelSetting::SetTrapRiseTime(){ - printf("=================== SetTrapRiseTime()\n"); - ChangeAStep(numTrapRiseTime, 4, Register::DPP::PHA::TrapezoidRiseTime); -} - -void ChannelSetting::SetTrapFlatTop(){ - printf("=================== SetTrapFlatTop()\n"); - ChangeAStep(numTrapFlatTop, 4, Register::DPP::PHA::TrapezoidFlatTop); -} - -void ChannelSetting::SetDecay(){ - printf("=================== SetDecay()\n"); - ChangeAStep(numDecay, 4, Register::DPP::PHA::DecayTime); -} - -void ChannelSetting::SetPeaking(){ - printf("=================== SetPeaking()\n"); - ChangeAStep(numPeaking, 4, Register::DPP::PHA::PeakingTime); -} - -void ChannelSetting::SetPeakHoldOff(){ - printf("=================== SetPeakHoldOff()\n"); - ChangeAStep(numPeakHoldOff, 4, Register::DPP::PHA::PeakHoldOff); -}