#ifndef DIGITIZER_PSD_H #define DIGITIZER_PSD_H #include "ClassDigitizer.h" class DigitizerPSD : public Digitizer { public: DigitizerPSD(); DigitizerPSD(int boardID, int portID = 0); ~DigitizerPSD(); int ProgramBoard(); void SetAutoDataFlush(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 0); ErrorMsg("PSD-SetAutoDataFlush"); } void SetDualTrace(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 11); ErrorMsg("PSD-SetDualTrace"); } void SetAnalogProbe(unsigned int bit) { SetBits(Register::DPP::BoardConfiguration, bit, 2, 12); ErrorMsg("PSD-SetAnalogProbe1"); } void SetWaveFormRecording(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 16); ErrorMsg("PSD-SetWaveFormRecording"); } void SetEnableExtraWord(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 17); ErrorMsg("PSD-SetEnableExtraWord"); } void SetTimeStampRecording(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 18); ErrorMsg("PSD-SetTimeStampRecording"); } void SetChargeRecording(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 19); ErrorMsg("PSD-SetChargeRecording");} void SetVirtualProbe1(unsigned int bit){ SetBits(Register::DPP::BoardConfiguration, bit, 3, 23); ErrorMsg("PSD-SetVirtualProbe1"); } void SetVirtualProbe2(unsigned int bit){ SetBits(Register::DPP::BoardConfiguration, bit, 3, 26); ErrorMsg("PSD-SetVirtualProbe2"); } void SetEnableDigitalTrace(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 31); ErrorMsg("PSD-SetEnableDigitalTrace");} void SetChargeSensitivity(unsigned int bit, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, bit, 3, 0, ch); ErrorMsg("PSD-SetChargeSensitivity");} void SetChargePedestal(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 4, ch); ErrorMsg("PSD-SetChargePedestal");} void SetTriggerCounting(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 5, ch); ErrorMsg("PSD-SetTriggerCounting");} void SetDiscriminationMode(bool LEDzero_CFDone, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, LEDzero_CFDone, 1, 6, ch); ErrorMsg("PSD-SetDiscriminationMode");} void SetPileUpToTRIGOUT(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 7, ch); ErrorMsg("PSD-SetPileUpToTRIGOUT");} void SetInternalTestPulse(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 8, ch); ErrorMsg("PSD-SetInternalTestPulse");} void SetTestPulseRate(unsigned int bit, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, bit, 2, 9, ch); ErrorMsg("PSD-SetTestPulseRate");} void SetBaelineRecalculateAfterLongGate(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 15, ch); ErrorMsg("PSD-SetBaelineRecalculateAfterLongGate");} void SetPulsePolarity(bool PositiveIsZero, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, PositiveIsZero, 1, 16, ch); ErrorMsg("PSD-SetPulsePolarity");} void SetTriggerMode(unsigned int bit, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, bit, 2, 18, ch); ErrorMsg("PSD-SetTriggerMode");} void SetBaselineSampling(unsigned int bit, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, bit, 3, 20, ch); ErrorMsg("PSD-SetBaselineSampling");} void SetDisableSelfTrigger(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 24, ch); ErrorMsg("PSD-SetDisableSelfTrigger");} void SetDiscardQlongSmallerQThreshold(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 25, ch); ErrorMsg("PSD-SetDiscardQlongSmallerQThreshold");} void SetPileUpRejection(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 26, ch); ErrorMsg("PSD-SetPileUpRejection");} void SetEnablePSDcutBelowThreshold(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 27, ch); ErrorMsg("PSD-SetEnablePSDcutBelowThreshold");} void SetEnablePSDcutAboveThreshold(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 28, ch); ErrorMsg("PSD-SetEnablePSDcutAboveThreshold");} void SetOverRangeRejection(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 29, ch); ErrorMsg("PSD-SetOverRangeRejection");} void SetDisableTriggerHysteresis(bool OnOff, int ch = -1) { SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 30, ch); ErrorMsg("PSD-SetDisableTriggerHysteresis");} void SetDisableOppositeParityInhibitation(bool OnOff, int ch = -1){ SetBits(Register::DPP::DPPAlgorithmControl, OnOff, 1, 31, ch); ErrorMsg("PSD-SetDisableOppositeParityInhibitation");} void SetDPPAlgorithmControl2(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::DPPAlgorithmControl2_G, bit, ch); ErrorMsg("PSD-SetDPPAlgorithmControl2");} void SetLocalShapedTriggerMode(unsigned int bit, int ch = -1) { SetBits(Register::DPP::PSD::DPPAlgorithmControl2_G, bit, 2, 0, ch); ErrorMsg("PSD-SetLocalShapedTriggerMode");} void SetEnableLocalShapedTrigger(bool OnOff, int ch = -1) { SetBits(Register::DPP::PSD::DPPAlgorithmControl2_G, OnOff, 1, 2, ch); ErrorMsg("PSD-SetEnableLocalShapedTrigger");} void SetLocalTriggerValidationMode(unsigned int bit, int ch = -1) { SetBits(Register::DPP::PSD::DPPAlgorithmControl2_G, bit, 2, 4, ch); ErrorMsg("PSD-SetLocalTriggerValidationMode");} void SetEnableLocalTriggerValidation(bool OnOff, int ch = -1) { SetBits(Register::DPP::PSD::DPPAlgorithmControl2_G, OnOff, 1, 6, ch); ErrorMsg("PSD-SetEnableLocalTriggerValidation");} void SetExtraWordOption(unsigned int bit, int ch = -1) { SetBits(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, 3, 8, ch); ErrorMsg("PSD-SetExtraWordOption");} void SetUseSmoothedSignal(bool OnOff, int ch = -1) { SetBits(Register::DPP::PSD::DPPAlgorithmControl2_G, OnOff, 1, 11, ch); ErrorMsg("PSD-SetUseSmoothedSignal");} void SetInputSmoothingFactor(unsigned int bit, int ch = -1) { SetBits(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, 4, 12, ch); ErrorMsg("PSD-SetInputSmoothingFactor");} void SetTriggerCounterRateStep(unsigned int bit, int ch = -1) { SetBits(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, 2, 16, ch); ErrorMsg("PSD-SetTriggerCounterRateStep");} void SetVetoSource(unsigned int bit, int ch = -1) { SetBits(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, 2, 18, ch); ErrorMsg("PSD-SetVetoSource");} void SetMarkSaturatedPulse(bool OnOff, int ch = -1) { SetBits(Register::DPP::PSD::DPPAlgorithmControl2_G, OnOff, 1, 24, ch); ErrorMsg("PSD-SetMarkSaturatedPulse");} void SetAdditionalLocalTriggerValidation(unsigned int bit, int ch = -1 ) { SetBits(Register::DPP::PSD::DPPAlgorithmControl2_G, bit, 2, 25, ch); ErrorMsg("PSD-SetAdditionalLocalTriggerValidation");} void SetVetoMode(bool OnOff, int ch = -1) { SetBits(Register::DPP::PSD::DPPAlgorithmControl2_G, OnOff, 1, 27, ch); ErrorMsg("PSD-SetVetoMode");} void SetTimestampResetWhenExtVetoActive(bool OnOff, int ch = -1) { SetBits(Register::DPP::PSD::DPPAlgorithmControl2_G, OnOff, 1, 28, ch); ErrorMsg("PSD-SetTimestampResetWhenExtVetoActive");} void SetCFDSetting(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::CFDSetting, bit & 0x0FFF, ch); ErrorMsg("PSD-SetCFDSetting");} void SetCFDDelayUnit(unsigned int bit, int ch = -1) { SetBits(Register::DPP::PSD::CFDSetting, bit, 8, 0, ch); ErrorMsg("PSD-SetCFDDelayUnit");} void SetCFDFraction(unsigned int bit, int ch = -1) { SetBits(Register::DPP::PSD::CFDSetting, bit, 2, 8, ch); ErrorMsg("PSD-SetCFDFraction");} void SetCFDInterpolationPoint(unsigned int bit, int ch = -1) { SetBits(Register::DPP::PSD::CFDSetting, bit, 2, 10, ch); ErrorMsg("PSD-SetCFDInterpolationPoint");} void SetForceDataFlush(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::ForcedDataFlush, bit, ch); ErrorMsg("PSD-SetForceDataFlush");} void SetChargeZeroSuppressionThreshold(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::ChargeZeroSuppressionThreshold, bit & 0xFFFF, ch); ErrorMsg("PSD-SetChargeZeroSuppressionThreshold");} void SetShortGateWidthSample(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::ShortGateWidth, bit & 0x0FFF, ch); ErrorMsg("PSD-SetShortGateWidthSample");} void SetLongGateWidthSample(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::LongGateWidth, bit & 0xFFFF, ch); ErrorMsg("PSD-SetLongGateWidthSample");} void SetGateOffsetSample(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::GateOffset, bit & 0x00FF, ch); ErrorMsg("PSD-SetGateOffsetSample");} void SetTriggerThreshold(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::TriggerThreshold, bit & 0x3FFF, ch); ErrorMsg("PSD-SetTriggerThreshold");} void SetTriggerLatency(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::TriggerLatency, bit & 0x03FF, ch); ErrorMsg("PSD-SetTriggerLatency");} void SetTriggerHoldOff(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::TriggerHoldOffWidth, bit & 0xFFFF, ch); ErrorMsg("PSD-SetTriggerHoldOff");} void SetThresholdforPSDcut(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::ThresholdForPSDCut, bit & 0x03FF, ch); ErrorMsg("PSD-SetThresholdforPSDcut");} void SetPurGapThreshold(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::PurGapThreshold, bit & 0x0FFF, ch); ErrorMsg("PSD-SetPurGapThreshold");} void SetShapedTriggerWidth(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::ShapedTriggerWidth, bit & 0x03FF, ch); ErrorMsg("PSD-SetShapedTriggerWidth");} void SetEarlyBaselineFreeze(unsigned int bit, int ch = -1) { WriteRegister(Register::DPP::PSD::EarlyBaselineFreeze, bit & 0x03FF, ch); ErrorMsg("PSD-SetEarlyBaselineFreeze");} void SetFixedBaseline(unsigned int bit, int ch = -1) { if ( bit == 0 ) SetBaselineSampling(3); if ( bit > 0 ) { SetBaselineSampling(0); WriteRegister(Register::DPP::PSD::FixedBaseline, bit & 0x3FFF, ch); ErrorMsg("PSD-SetTriggerThreshold"); } } }; #endif