FSUDAQ/DigitizerPHA.cpp
2022-08-17 16:08:49 -04:00

344 lines
23 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "DigitizerPHA.h"
DigitizerPHA::DigitizerPHA(){
}
DigitizerPHA::DigitizerPHA(int boardID, int portID){
OpenDigitizer(boardID, portID);
}
DigitizerPHA::~DigitizerPHA(){
}
int DigitizerPHA::ProgramBoard(){
Digitizer::ProgramBoard();
printf("----- program PHA\n");
/// Set trigger propagation
/// Set analog probe 1 to input
/// Set analog probe 2 to Tranpedoiz - Baseline
/// disable waveform recording
/// enable extrac 2 word
/// record time stamp
/// record energy
/// digitial virtual probe 1 = Peaking
/// digitial virtual probe 2 = trigger
///ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardConfiguration , 0x000F8114);
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardConfiguration , 0x014F8905);
ErrorMsg("PHA-ProgramBoard");
/*
///==================== Set default Channel setting using CAEN function
CAEN_DGTZ_DPP_PHA_Params_t DPPParams;
memset(&DPPParams, 0, sizeof(CAEN_DGTZ_DPP_PHA_Params_t));
for(int i = 0; i < NChannel; i++){
DPPParams.M[i] = 100000; /// decay time [ns]
DPPParams.m[i] = 992; /// flat-top [ns]
DPPParams.k[i] = 96; /// rise-time [ns]
DPPParams.ftd[i] = 192; /// flat-top delay, peaking time [ns]
DPPParams.a[i] = 4; /// Trigger Filter smoothing factor, 1, 2, 3, 4, 16, 32
DPPParams.b[i] = 96; /// input rise time [ns]
DPPParams.thr[i] = 100; /// Threshold [LSB]
DPPParams.nsbl[i] = 3; /// Baseline samples, 0 = 0, when > 0, pow(4, n+1)
DPPParams.nspk[i] = 2; /// peak samples, 4^n
DPPParams.pkho[i] = 992 ; /// peak hold off [ns]
DPPParams.trgho[i] = 480 ; /// trigger hold off [ns]
DPPParams.twwdt[i] = 0 ; /// rise time validation window, 0x1070
DPPParams.trgwin[i] = 0 ; /// trigger coincident window
DPPParams.dgain[i] = 0; /// digial gain for digial probe, 2^n
DPPParams.enf[i] = 1 ; /// energy normalization factor (fine gain?)
DPPParams.decimation[i] = 0 ; /// waveform decimation, 2^n, when n = 0, disable
DPPParams.blho[i] = 0; /// not use
}
ret = CAEN_DGTZ_SetDPPParameters(handle, channelMask, &DPPParams);
ErrorMsg("PHA-CAEN_DGTZ_SetDPPParameters");
for(int i=0; i<NChannel; i++) {
if (channelMask & (1<<i)) {
/// Set a DC offset to the input signal to adapt it to digitizer's dynamic range
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, i, 0xCCCC); /// 20%
/// Set the Pre-Trigger size (in samples)
ret |= CAEN_DGTZ_SetDPPPreTriggerSize(handle, i, 124); /// 496ns
/// Set the polarity for the given channel (CAEN_DGTZ_PulsePolarityPositive or CAEN_DGTZ_PulsePolarityNegative)
ret |= CAEN_DGTZ_SetChannelPulsePolarity(handle, i, CAEN_DGTZ_PulsePolarityPositive);
/// Set InputDynamic Range
ret |= CAEN_DGTZ_WriteRegister(handle, 0x1028 + (i<<8), 0x0); /// 2.0 Vpp
/// read the register to check the input is correct
///uint32_t * value = new uint32_t[8];
///ret = CAEN_DGTZ_ReadRegister(handle, 0x1028 + (i << 8), value);
///printf(" InputDynamic Range (ch:%d): %d \n", i, value[0]);
}
}
/**************/
//ret = CAEN_DGTZ_MallocReadoutBuffer(handle, &(data->buffer), &(data->AllocatedSize));
//ret |= CAEN_DGTZ_MallocDPPEvents(handle, reinterpret_cast<void**>(&(data->Events)), &(data->AllocatedSize)) ;
//WriteRegister(Register::DPP::RecordLength_G, 0x138);
//WriteRegister(Register::DPP::InputDynamicRange, 0x0);
//WriteRegister(Register::DPP::NumberEventsPerAggregate_G, 0x1A);
//WriteRegister(Register::DPP::PreTrigger, 0x1F);
//
//WriteRegister(Register::DPP::PHA::RCCR2SmoothingFactor, 0x2);
//WriteRegister(Register::DPP::PHA::InputRiseTime, 0x6);
//WriteRegister(Register::DPP::PHA::TrapezoidRiseTime, 0x6);
//WriteRegister(Register::DPP::PHA::TrapezoidFlatTop, 0x3E);
//WriteRegister(Register::DPP::PHA::PeakingTime, 0xC);
//WriteRegister(Register::DPP::PHA::DecayTime, 0x186A);
//WriteRegister(Register::DPP::PHA::TriggerThreshold, 0x64);
//WriteRegister(Register::DPP::PHA::RiseTimeValidationWindow, 0x0);
//WriteRegister(Register::DPP::PHA::TriggerHoldOffWidth, 0x1E);
//WriteRegister(Register::DPP::PHA::PeakHoldOff, 0x3E);
//WriteRegister(Register::DPP::DPPAlgorithmControl, 0x0C30200F);
//WriteRegister(Register::DPP::PHA::ShapedTriggerWidth, 0x6);
//WriteRegister(Register::DPP::ChannelDCOffset, 0xCCCC);
//WriteRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, 0x0);
//WriteRegister(Register::DPP::PHA::FineGain, 0xDFB1);
//WriteRegister(Register::DPP::VetoWidth, 0xA);
//
//
//WriteRegister(Register::DPP::BoardConfiguration, 0x14F8905);
//WriteRegister(Register::DPP::AggregateOrganization, 0x2);
//WriteRegister(Register::DPP::AcquisitionControl, 0x0);
//WriteRegister(Register::DPP::GlobalTriggerMask, 0x80000000);
//WriteRegister(Register::DPP::ReadoutControl, 0x10);
SetRecordLength(4096*4);
SetPreTriggerDuration(1000*4);
SetBaselineSampling(3);
SetDCOffset(0.2);
SetInputDynamicRange(0);
SetPulsePolarity(0);
SetTriggerThreshold(400);
SetTriggerHoldOff(248);
SetTriggerSmoothingFactor(2);
SetTriggerOutputWidth(6);
SetInputRiseTime(6);
//SetTrapezoidRescaling(23);
SetTrapezoidRiseTime(31);
SetTrapezoidFlatTop(31);
SetDecayTime(312);
SetPeakingTime(3);
SetPeakingHoldOff(25);
SetPeakSampling(8);
SetRiseTimeValidWindow(0);
SetTrapezoidRescaling(13);
SetEnergyFineGain(30000);
//AutoSetTrapezoidRescalingAndFindGate(1.0);
//SetDPPAlgorithmControl(0xC30200E);
//SetEnergyFineGain(0xDFB1);
SetEventAggregation(2); /// max 511
SetMaxNumberOfAggregatePerBlackTransfer(4);
SetAggregateOrganization(0); ///0 or 1 = no division in buffer, n = 2^n divsions
SetRollOverFlag(1);
SetPileUpFlag(1);
SetExtra2WordOption(2);
ErrorMsg("PHA-ProgramBoard");
printf("End of program board and channels\n");
return ret;
}
void DigitizerPHA::SetAnalogProbe1(unsigned int bit) { SetBits(Register::DPP::BoardConfiguration, bit, 2, 12); ErrorMsg("PHA-SetAnalogProbe1"); }
void DigitizerPHA::SetAnalogProbe2(unsigned int bit) { SetBits(Register::DPP::BoardConfiguration, bit, 2, 14); ErrorMsg("PHA-SetAnalogProbe1"); }
void DigitizerPHA::SetWaveFormRecording(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 16); ErrorMsg("PHA-SetWaveFormRecording"); }
void DigitizerPHA::SetTimeStampRecording(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 18); ErrorMsg("PHA-SetTimeStampRecording"); }
void DigitizerPHA::SetEnergyRecording(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 19); ErrorMsg("PHA-SetEnergyRecording");}
void DigitizerPHA::SetVirtualProbe1(unsigned int bit){ SetBits(Register::DPP::BoardConfiguration, bit, 4, 20); ErrorMsg("PHA-SetVirtualProbe1"); }
void DigitizerPHA::SetTrapezoidRescaling(unsigned int rightShiftBits, int ch){ SetBits(Register::DPP::DPPAlgorithmControl, rightShiftBits, 5, 0, ch); ErrorMsg("SetTrapezoidRescaling"); }
void DigitizerPHA::SetPeakSampling(unsigned int bit, int ch) { SetBits(Register::DPP::DPPAlgorithmControl, bit, 2, 12, ch); ErrorMsg("SetPeakSampling");}
void DigitizerPHA::SetPulsePolarity(bool PositiveIsZero, int ch) { SetBits(Register::DPP::DPPAlgorithmControl, PositiveIsZero, 1, 16, ch); ErrorMsg("SetPulsePolarity");}
void DigitizerPHA::SetBaselineSampling(unsigned int bit, int ch) { SetBits(Register::DPP::DPPAlgorithmControl, bit, 3, 20, ch); ErrorMsg("SetBaselineSampling"); }
void DigitizerPHA::SetRollOverFlag(bool isRollOver, int ch) { SetBits(Register::DPP::DPPAlgorithmControl, isRollOver, 1, 26, ch); ErrorMsg("SetRollOverFlag");}
void DigitizerPHA::SetPileUpFlag(bool isPileUpFlag, int ch) { SetBits(Register::DPP::DPPAlgorithmControl, isPileUpFlag, 1, 27, ch); ErrorMsg("SetPileUpFlag");}
void DigitizerPHA::SetExtra2WordOption(unsigned int bit, int ch) { SetBits(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, 3, 8, ch); ErrorMsg("PHA-SetExtra2WordOption");}
void DigitizerPHA::SetDPPAlgorithmControl2(unsigned int bit, int ch) { WriteRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, ch); ErrorMsg("PHA-SetDPPAlgorithmControl2");}
void DigitizerPHA::SetTriggerThreshold(unsigned int threshold, int ch ) { WriteRegister(Register::DPP::PHA::TriggerThreshold, threshold & 0x03FF, ch); ErrorMsg("PHA-SetTriggerThreshold");}
void DigitizerPHA::SetTriggerHoldOff(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::TriggerHoldOffWidth, nSample & 0x03FF, ch); ErrorMsg("PHA-SetTriggerHoldOff"); }
void DigitizerPHA::SetTriggerSmoothingFactor(unsigned int bit, int ch ) { WriteRegister(Register::DPP::PHA::RCCR2SmoothingFactor, bit & 0x001F, ch); ErrorMsg("PHA-SetTriggerSmoothingFactor");}
void DigitizerPHA::SetTriggerOutputWidth(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::ShapedTriggerWidth, nSample & 0x03FF, ch); ErrorMsg("PHA-SetTriggerOutputWidth");}
void DigitizerPHA::SetInputRiseTime(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::InputRiseTime, nSample & 0x00FF, ch); ErrorMsg("PHA-SetInputRiseTime");}
void DigitizerPHA::SetTrapezoidRiseTime(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::TrapezoidRiseTime, nSample & 0x0FFF, ch); ErrorMsg("PHA-SetTrapezoidRiseTime");}
void DigitizerPHA::SetTrapezoidFlatTop(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::TrapezoidFlatTop, nSample & 0x0FFF, ch); ErrorMsg("PHA-SetTrapezoidFlatTop");}
void DigitizerPHA::SetDecayTime(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::DecayTime, nSample & 0xFFFF, ch); ErrorMsg("PHA-SetDecayTime");}
void DigitizerPHA::SetPeakingTime(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::PeakingTime, nSample & 0x0FFF, ch); ErrorMsg("PHA-SetPeakingTime");}
void DigitizerPHA::SetPeakingHoldOff(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::PeakHoldOff, nSample & 0x03FF, ch); ErrorMsg("PHA-SetPeakingHoldOff");}
void DigitizerPHA::SetEnergyFineGain(unsigned int gain, int ch ) { WriteRegister(Register::DPP::PHA::FineGain, gain & 0xFFFF, ch); ErrorMsg("PHA-SetEnergyFineGain");}
void DigitizerPHA::SetRiseTimeValidWindow(unsigned int nSample, int ch ){ WriteRegister(Register::DPP::PHA::RiseTimeValidationWindow,nSample & 0x03FF, ch); ErrorMsg("PHA-SetRiseTimeValidWindow");}
void DigitizerPHA::AutoSetTrapezoidRescalingAndFindGate(double gain, int ch){
int startCh = 0;
int endCh = MaxNChannels;
if( ch >= 0 ){
startCh = ch;
endCh = ch;
}
for( int i = startCh ; i <= endCh; i++){
double riseTime = ReadRegister(Register::DPP::PHA::TrapezoidRiseTime, i) * 4 * ch2ns;
double flatTop = ReadRegister(Register::DPP::PHA::TrapezoidFlatTop, i) * 4 * ch2ns;
unsigned int shift = (unsigned int ) ( log(riseTime * flatTop ) / log(2.0)) ;
SetTrapezoidRescaling(shift, i);
double haha = 0xFFFF * gain * (pow(2, shift) / riseTime / flatTop);
unsigned int fineGain = (unsigned int) (haha);
if( fineGain > 0xFFFF ){
SetEnergyFineGain(0xFFFF, i);
}else{
SetEnergyFineGain(fineGain, i);
}
}
ErrorMsg("PHA-AutoSetTrapezoidRescalingAndFindGate");
}
void DigitizerPHA::PrintBoardConfiguration(){
if( !isConnected ) return;
printf("\e[33m================================================\n");
printf("================ Setting for Board \n");
printf("================================================\e[0m\n");
uint32_t * value = new uint32_t[1];
CAEN_DGTZ_ReadRegister(handle, (uint32_t) Register::BoardConfiguration, value);
printf(" 32 28 24 20 16 12 8 4 0\n");
printf(" | | | | | | | | |\n");
cout <<" Board Configuration : 0b" << bitset<32>(value[0]) << endl;
printf(" : 0x%x\n", value[0]);
printf(" Bit[ 0] = Auto Data Flush \n");
printf(" Bit[ 1] = Save decimated waveform \n");
printf(" Bit[ 2] = Trigger propagation \n");
printf(" Bit[ 3:10] = must be 001 0001 0 \n");
printf(" Bit[ 11] = Dual Trace \n");
printf(" Bit[12:13] = Analog probe 1 : 00 = input, 01 = RC-CR (1st derivative), 10 = RC-CR2 (2nd derivative), 11 = Trapezoid.\n");
printf(" Bit[14:15] = Analog probe 2 : 00 = input, 01 = Threshold, 10 = Trapezoid - Baseline, 11 = baseline.\n");
printf(" Bit[ 16] = WaveForm Recording \n");
printf(" Bit[ 17] = Extras 2 word enable \n");
printf(" Bit[ 18] = Record Time Stamp \n");
printf(" Bit[ 19] = Record Energy \n");
printf(" Bit[20:23] = Digital Virtual probe 1 : \n");
printf(" 0000: Peaking, shows where the energy is calculated; \n");
printf(" 0001: ”Armed”, digital input showing where the RCCR2 crosses the Threshold\n");
printf(" 0010: ”Peak Run”, starts with the trigger and last for the whole event\n");
printf(" 0011: ”Pileup”, shows where a pileup event occurred\n");
printf(" 0100: ”Peaking”, shows where the energy is calculated\n");
printf(" 0101: ”TRG Validation Win”, digital input showing the trigger validation acceptance window TVAW\n");
printf(" 0110: ”Baseline freeze”, shows where the algorithm stops calculating the baseline and its value is frozen\n");
printf(" 0111: ”TRG Holdoff”, shows the trigger holdoff parameter\n");
printf(" 1000: ”TRG Validation”, shows the trigger validation signal TRG_VAL \n");
printf(" 1001: ”Acq Busy”, this is 1 when the board is busy (saturated input signal or full memory board) or there is a veto\n");
printf(" 1010: ”Zero Cross. Win.”, shows the RT Discrimination Width\n");
printf(" 1011: ”Ext TRG”, shows the external trigger, when available\n");
printf(" 1100: ”Busy”, shows when the memory board is full.\n");
printf(" Bit[26:28] = Digital Virtual probe 2 : \n");
printf(" 000: Trigger\n");
printf(" other: Reserved\n");
printf("====================================== \n");
}
void DigitizerPHA::PrintChannelSettingFromDigitizer(int ch){
if( !isConnected ) return;
printf("\e[33m================================================\n");
printf("================ Setting for channel %d \n", ch);
printf("================================================\e[0m\n");
///DPP algorithm Control
uint32_t * value = new uint32_t[NChannel];
CAEN_DGTZ_ReadRegister(handle, Register::DPP::DPPAlgorithmControl + (ch << 8), value);
printf(" 32 28 24 20 16 12 8 4 0\n");
printf(" | | | | | | | | |\n");
cout <<" DPP algorithm Control : 0b" << bitset<32>(value[0]);
printf(" = 0x%x\n", value[0]);
int trapRescaling = int(value[0]) & 0x1f ;
int polarity = int(value[0] >> 16) & 0x1; /// in bit[16]
int baseline = int(value[0] >> 20) & 0x7; /// in bit[22:20]
int NsPeak = int(value[0] >> 12) & 0x3; /// in bit[13:12]
int rollOver = int(value[0] >> 26) & 0x1;
int pileUp = int(value[0] >> 27) & 0x1;
///DPP algorithm Control 2
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::DPPAlgorithmControl2_G + (ch << 8), value);
cout <<" DPP algorithm Control 2: 0b" << bitset<32>(value[0]) ;
printf(" = 0x%x\n", value[0]);
int extras2WordOption = int(value[0] >> 8) & 0x3;
string extra2WordOptStr = "";
switch (extras2WordOption){
case 0 : extra2WordOptStr = "[0:15] Baseline *4 [16:31] Extended Time Stamp"; break;
case 2 : extra2WordOptStr = "[0:9] Fine Time Stamp [10:15] Reserved [16:31] Extended Time Stamp"; break;
case 4 : extra2WordOptStr = "[0:15] Total Trigger Counter [16:31] Lost Trigger Counter"; break;
case 5 : extra2WordOptStr = "[0:15] Event After the Zero Crossing [16:31] Event Before the Zero Crossing"; break;
default: extra2WordOptStr = "Reserved"; break;
}
printf(" ch2ns : %.0f ns\n", ch2ns);
printf("==========----- input \n");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::RecordLength_G + (ch << 8), value); printf("%24s %5d samples = %5.0f ns \n", "Record Length", ((value[0] * 8) & MaxRecordLength), ((value[0] * 8) & MaxRecordLength) * ch2ns); ///Record length
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PreTrigger + (ch << 8), value); printf("%24s %5d samples = %5.0f ns \n", "Pre-tigger", value[0] * 4, value[0] * 4 * ch2ns); ///Pre-trigger
printf("%24s %5.0f samples, DPP-[20:22]\n", "baseline mean", pow(4, 1 + baseline)); ///Ns baseline
CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelDCOffset + (ch << 8), value); printf("%24s %.2f %% \n", "DC offset", 100.0 - value[0] * 100./ 0xFFFF); ///DC offset
CAEN_DGTZ_ReadRegister(handle, Register::DPP::InputDynamicRange + (ch << 8), value); printf("%24s %.1f Vpp \n", "input Dynamic", value[0] == 0 ? 2 : 0.5); ///InputDynamic
printf("%24s %s, DPP-[16]\n", "polarity", polarity == 0 ? "Positive" : "negative"); ///Polarity
printf("==========----- discriminator \n");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::TriggerThreshold + (ch << 8), value); printf("%24s %4d LSB\n", "Threshold", value[0]); ///Threshold
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::TriggerHoldOffWidth + (ch << 8), value); printf("%24s %4d samples, %5.0f ns \n", "trigger hold off", value[0], value[0] * 4 * ch2ns); ///Trigger Hold off
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::RCCR2SmoothingFactor + (ch << 8), value); printf("%24s %4d samples, %5.0f ns \n", "Fast Dis. smoothing", (value[0] & 0x1f) * 2, (value[0] & 0x1f) * 2 * ch2ns ); ///Fast Discriminator smoothing
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::ShapedTriggerWidth + (ch << 8), value); printf("%24s %4d samples, %5.0f ns \n", "Fast Dis. output width", value[0], value[0] * 4 * ch2ns); ///Fast Dis. output width
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::InputRiseTime + (ch << 8), value); printf("%24s %4d samples, %5.0f ns \n", "Input rise time ", value[0], value[0] * 4 * ch2ns); ///Input rise time
printf("==========----- Trapezoid \n");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::TrapezoidRiseTime + (ch << 8), value); printf("%24s %4d samples, %5.0f ns \n", "Trap. rise time", value[0], value[0] * 4 * ch2ns); ///Trap. rise time, 2 for 1 ch to 2ns
int riseTime = value[0] * 4 * ch2ns;
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::TrapezoidFlatTop + (ch << 8), value); printf("%24s %4d samples, %5.0f ns \n", "Trap. flat time", value[0], value[0] * 4 * ch2ns); ///Trap. flat time
int flatTopTime = value[0] * 4 * ch2ns;
double shift = log(riseTime * flatTopTime ) / log(2) - 2;
printf("%24s %4d bit =? %.1f = Ceil( Log(rise [ns] x decay [ns])/Log(2) ), DPP-[0:5]\n", "Trap. Rescaling", trapRescaling, shift ); ///Trap. Rescaling Factor
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::DecayTime + (ch << 8), value); printf("%24s %4d samples, %5.0f ns \n", "Decay time", value[0], value[0] * 4 * ch2ns); ///Trap. pole zero
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::PeakingTime + (ch << 8), value); printf("%24s %4d samples, %5.0f ns = %.2f %% of FlatTop\n", "Peaking time", value[0], value[0] * 4 * ch2ns, value[0] * 400. * ch2ns / flatTopTime ); ///Peaking time
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::PeakHoldOff + (ch << 8), value); printf("%24s %4d samples, %5.0f ns \n", "Peak hole off", value[0], value[0] * 4 *ch2ns ); ///Peak hold off
printf("%24s %4.0f samples, DPP-[12:13]\n", "Peak mean", pow(4, NsPeak)); ///Ns peak
printf("==========----- Other \n");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::FineGain + (ch << 8), value); printf("%24s %d = 0x%x\n", "Energy fine gain", value[0], value[0]); ///Energy fine gain
CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelADCTemperature + (ch << 8), value); printf("%24s %d C\n", "Temperature", value[0]); ///Temperature
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::RiseTimeValidationWindow + (ch << 8), value); printf("%24s %.0f ns \n", "RiseTime Vaild Win.", value[0] * ch2ns);
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::ChannelStopAcquisition + (ch << 8), value); printf("%24s %d = %s \n", "Stop Acq bit", value[0] & 1 , (value[0] & 1 ) == 0 ? "Run" : "Stop");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelStatus + (ch << 8), value); printf("%24s 0x%x \n", "Status bit", (value[0] & 0xff) );
CAEN_DGTZ_ReadRegister(handle, Register::DPP::AMCFirmwareRevision + (ch << 8), value); printf("%24s 0x%x \n", "AMC firmware rev.", value[0] );
CAEN_DGTZ_ReadRegister(handle, Register::DPP::VetoWidth + (ch << 8), value); printf("%24s 0x%x \n", "VetoWidth bit", value[0] );
printf("%24s %d = %s\n", "RollOverFlag, DPP-[26]", rollOver, rollOver ? "enable" : "disable" );
printf("%24s %d = %s\n", "Pile-upFlag, DPP-[27]", pileUp, pileUp ? "enable" : "disable" );
printf("%24s %d, %s \n", "Extra2 opt, DPP2-[8:10]", extras2WordOption, extra2WordOptStr.c_str());
printf("========= events storage and transfer\n");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::NumberEventsPerAggregate_G + (ch << 8), value); printf("%24s %d \n", "Event Aggregate", value[0] & 0x3FF);
CAEN_DGTZ_ReadRegister(handle, Register::DPP::AggregateOrganization, value); printf("%24s %d \n", "Buffer Division", ((value[0] & 0x007) < 2 ? 0 : (int)pow(2, value[0] & 7)));
CAEN_DGTZ_ReadRegister(handle, Register::DPP::MaxNumberOfAggregatePerBlackTransfer , value); printf("%24s %d \n", "Num of Agg. / ReadData", value[0] & 0x1FF);
printf("========================================= end of ch-%d\n", ch);
}