change nSample to ns
This commit is contained in:
parent
35278fc37b
commit
c0f9aa5eba
|
@ -60,6 +60,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool verbose){
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
if( verbose) printf("Can't open digitizer\n");
|
if( verbose) printf("Can't open digitizer\n");
|
||||||
|
return -1;
|
||||||
}else{
|
}else{
|
||||||
///----- Getting Board Info
|
///----- Getting Board Info
|
||||||
ret = (int) CAEN_DGTZ_GetInfo(handle, &BoardInfo);
|
ret = (int) CAEN_DGTZ_GetInfo(handle, &BoardInfo);
|
||||||
|
@ -240,16 +241,13 @@ int Digitizer::ProgramBoard(){
|
||||||
ret |= CAEN_DGTZ_SetChannelEnableMask(handle, channelMask);
|
ret |= CAEN_DGTZ_SetChannelEnableMask(handle, channelMask);
|
||||||
|
|
||||||
/// Set the number of samples for each waveform
|
/// Set the number of samples for each waveform
|
||||||
SetRecordLength(100); /// default 100 * 8 = 800 ch
|
SetRecordLength(2000); /// ns
|
||||||
///ret |= CAEN_DGTZ_SetRecordLength(handle, recordLength);
|
|
||||||
|
|
||||||
/// Set Extras 2 to enable, this override Accusition mode, focring list mode
|
/// Set Extras 2 to enable, this override Accusition mode, focring list mode
|
||||||
uint32_t value = 0x10E0114;
|
ret |= CAEN_DGTZ_WriteRegister(handle, Register::BoardConfiguration , 0x00E8114 );
|
||||||
ret |= CAEN_DGTZ_WriteRegister(handle, Register::BoardConfiguration , value );
|
|
||||||
|
|
||||||
/// Set how many events to accumulate in the board memory before being available for readout
|
/// Set how many events to accumulate in the board memory before being available for readout
|
||||||
SetEventAggregation(0); /// when zero, digitizer auto set
|
SetEventAggregation(0); /// when zero, digitizer auto set
|
||||||
///ret |= CAEN_DGTZ_SetDPPEventAggregation(handle, EventAggr, 0);
|
|
||||||
|
|
||||||
/// Set the digitizer acquisition mode (CAEN_DGTZ_SW_CONTROLLED or CAEN_DGTZ_S_IN_CONTROLLED)
|
/// Set the digitizer acquisition mode (CAEN_DGTZ_SW_CONTROLLED or CAEN_DGTZ_S_IN_CONTROLLED)
|
||||||
ret |= CAEN_DGTZ_SetAcquisitionMode(handle, CAEN_DGTZ_SW_CONTROLLED); /// software command
|
ret |= CAEN_DGTZ_SetAcquisitionMode(handle, CAEN_DGTZ_SW_CONTROLLED); /// software command
|
||||||
|
@ -300,10 +298,11 @@ void Digitizer::SetChannelMask(uint32_t mask){
|
||||||
ErrorMsg("SetChannelMask");
|
ErrorMsg("SetChannelMask");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Digitizer::SetRecordLength(unsigned int nSample, int ch) { WriteRegister( Register::DPP::RecordLength, nSample / 8, ch); ErrorMsg("SetRecordLength"); }
|
void Digitizer::SetRecordLength(unsigned int ns, int ch) { WriteRegister( Register::DPP::RecordLength, ns / ch2ns / 8 , ch); ErrorMsg("SetRecordLength"); }
|
||||||
void Digitizer::SetEventAggregation(unsigned int numEvent, int ch) { WriteRegister( Register::DPP::NumberEventsPerAggregate, numEvent, ch); ErrorMsg("SetEventAggregation"); }
|
void Digitizer::SetEventAggregation(unsigned int numEvent, int ch) { WriteRegister( Register::DPP::NumberEventsPerAggregate, numEvent, ch); ErrorMsg("SetEventAggregation"); }
|
||||||
void Digitizer::SetInputDynamicRange(unsigned int TwoVol_0_or_halfVol_1, int ch){ WriteRegister( Register::InputDynamicRange, TwoVol_0_or_halfVol_1, ch); ErrorMsg("SetInputDynamicRange");}
|
void Digitizer::SetInputDynamicRange(unsigned int TwoVol_0_or_halfVol_1, int ch){ WriteRegister( Register::InputDynamicRange, TwoVol_0_or_halfVol_1, ch); ErrorMsg("SetInputDynamicRange");}
|
||||||
void Digitizer::SetNumSamplePreTrigger(unsigned int nSample, int ch) { WriteRegister( Register::DPP::PreTrigger, nSample / 4, ch); ErrorMsg("SetNumSamplePreTrigger");}
|
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( ADCFullSize * offsetPrecentage), ch ); ErrorMsg("SetDCOffset");}
|
void Digitizer::SetDCOffset(float offsetPrecentage, int ch) { WriteRegister( Register::DPP::ChannelDCOffset, uint( ADCFullSize * offsetPrecentage), ch ); ErrorMsg("SetDCOffset");}
|
||||||
void Digitizer::SetVetoWidth(uint32_t bit, int ch) { WriteRegister( Register::DPP::VetoWidth, bit, ch); ErrorMsg("SetVetoWidth");}
|
void Digitizer::SetVetoWidth(uint32_t bit, int ch) { WriteRegister( Register::DPP::VetoWidth, bit, ch); ErrorMsg("SetVetoWidth");}
|
||||||
|
|
||||||
|
|
|
@ -58,10 +58,11 @@ class Digitizer{
|
||||||
|
|
||||||
///common for PHA and PSD digitizers
|
///common for PHA and PSD digitizers
|
||||||
void SetChannelMask(uint32_t mask);
|
void SetChannelMask(uint32_t mask);
|
||||||
void SetRecordLength(unsigned int nSample, int ch = -1); /// when ch == -1, mean set all channels
|
void SetRecordLength(unsigned int ns, int ch = -1); /// when ch == -1, mean set all channels
|
||||||
void SetEventAggregation(unsigned int numEvent, int ch = -1);
|
void SetEventAggregation(unsigned int numEvent, int ch = -1);
|
||||||
void SetInputDynamicRange(unsigned int TwoVol_0_or_halfVol_1, int ch = -1);
|
void SetInputDynamicRange(unsigned int TwoVol_0_or_halfVol_1, int ch = -1);
|
||||||
void SetNumSamplePreTrigger(unsigned int nSample, int ch = -1 );
|
void SetPreTriggerSample(unsigned int nSample, int ch = -1 );
|
||||||
|
void SetPreTriggerDuration(unsigned int ns, int ch = -1 );
|
||||||
void SetDCOffset(float offsetPrecentage, int ch = -1);
|
void SetDCOffset(float offsetPrecentage, int ch = -1);
|
||||||
void SetVetoWidth(uint32_t bit, int ch = -1); /// See manual
|
void SetVetoWidth(uint32_t bit, int ch = -1); /// See manual
|
||||||
void SetTriggerPolarity(bool RiseingIsZero, int ch = -1);
|
void SetTriggerPolarity(bool RiseingIsZero, int ch = -1);
|
||||||
|
|
|
@ -13,6 +13,7 @@ DigitizerPHA::~DigitizerPHA(){
|
||||||
}
|
}
|
||||||
|
|
||||||
int DigitizerPHA::ProgramBoard(){
|
int DigitizerPHA::ProgramBoard(){
|
||||||
|
Digitizer::ProgramBoard();
|
||||||
/// Set trigger propagation
|
/// Set trigger propagation
|
||||||
/// Set analog probe 1 to input
|
/// Set analog probe 1 to input
|
||||||
/// Set analog probe 2 to Tranpedoiz - Baseline
|
/// Set analog probe 2 to Tranpedoiz - Baseline
|
||||||
|
@ -58,6 +59,7 @@ void DigitizerPHA::SetRiseTimeValidWindow(unsigned int nSample, int ch ){ WriteR
|
||||||
|
|
||||||
|
|
||||||
void DigitizerPHA::PrintBoardConfiguration(){
|
void DigitizerPHA::PrintBoardConfiguration(){
|
||||||
|
if( !isConnected ) return;
|
||||||
uint32_t * value = new uint32_t[1];
|
uint32_t * value = new uint32_t[1];
|
||||||
CAEN_DGTZ_ReadRegister(handle, (uint32_t) Register::BoardConfiguration, value);
|
CAEN_DGTZ_ReadRegister(handle, (uint32_t) Register::BoardConfiguration, value);
|
||||||
printf(" 32 28 24 20 16 12 8 4 0\n");
|
printf(" 32 28 24 20 16 12 8 4 0\n");
|
||||||
|
@ -95,7 +97,7 @@ void DigitizerPHA::PrintBoardConfiguration(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void DigitizerPHA::GetChannelSettingFromDigitizer(int ch){
|
void DigitizerPHA::GetChannelSettingFromDigitizer(int ch){
|
||||||
|
if( !isConnected ) return;
|
||||||
uint32_t * value = new uint32_t[NChannel];
|
uint32_t * value = new uint32_t[NChannel];
|
||||||
printf("\e[33m================================================\n");
|
printf("\e[33m================================================\n");
|
||||||
printf("================ Setting for channel %d \n", ch);
|
printf("================ Setting for channel %d \n", ch);
|
||||||
|
@ -130,17 +132,19 @@ void DigitizerPHA::GetChannelSettingFromDigitizer(int ch){
|
||||||
printf(" ch2ns : %.0f ns\n", ch2ns);
|
printf(" ch2ns : %.0f ns\n", ch2ns);
|
||||||
|
|
||||||
printf("==========----- input \n");
|
printf("==========----- input \n");
|
||||||
CAEN_DGTZ_ReadRegister(handle, Register::DPP::RecordLength + (ch << 8), value); printf("%24s %5d samples \n", "Record Length", ((value[0] * 8) & MaxRecordLength)); ///Record length
|
CAEN_DGTZ_ReadRegister(handle, Register::DPP::RecordLength + (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 \n", "Pre-tigger", value[0] * 4); ///Pre-trigger
|
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
|
printf("%24s %5.0f samples, DPP-[20:22]\n", "baseline mean", pow(4, 1 + baseline)); ///Ns baseline
|
||||||
printf("%24s %s, DPP-[16]\n", "polarity", polarity == 0 ? "Positive" : "negative"); ///Polarity
|
|
||||||
CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelDCOffset + (ch << 8), value); printf("%24s %.2f %% of %d\n", "DC offset", value[0] * 100./ ADCFullSize, ADCFullSize); ///DC offset
|
CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelDCOffset + (ch << 8), value); printf("%24s %.2f %% of %d\n", "DC offset", value[0] * 100./ ADCFullSize, ADCFullSize); ///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
|
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
|
||||||
|
CAEN_DGTZ_TriggerPolarity_t * triggerPolarity;
|
||||||
|
CAEN_DGTZ_GetTriggerPolarity(handle, ch, triggerPolarity); printf("%24s %s \n", "trigger polarity", triggerPolarity[0] == 0 ? "Positive" : "negative"); ///Polarity
|
||||||
|
|
||||||
printf("==========----- discriminator \n");
|
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::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::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 \n", "Fast Dis. smoothing", (value[0] & 0x1f) * 2 ); ///Fast Discriminator smoothing
|
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::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
|
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
|
||||||
|
|
||||||
|
|
22
test.cpp
22
test.cpp
|
@ -20,16 +20,16 @@ int main(int argc, char* argv[]){
|
||||||
//dig[0].SetRecordLength(2000);
|
//dig[0].SetRecordLength(2000);
|
||||||
//dig[0].SetEventAggregation(0);
|
//dig[0].SetEventAggregation(0);
|
||||||
//dig[0].SetInputDynamicRange(0);
|
//dig[0].SetInputDynamicRange(0);
|
||||||
//dig[0].SetNumSamplePreTrigger(500);
|
//dig[0].SetPreTriggerDuration(500);
|
||||||
//dig[0].SetDCOffset(0.1);
|
//dig[0].SetDCOffset(0.1);
|
||||||
//dig[0].SetTriggerPolarity(0);
|
//dig[0].SetTriggerPolarity(0);
|
||||||
//
|
|
||||||
//dig[0].SetTrapezoidRescaling(31);
|
dig[0].SetTrapezoidRescaling(31);
|
||||||
//dig[0].SetPeakSampling(3);
|
dig[0].SetPeakSampling(3);
|
||||||
//dig[0].SetPulsePolarity(1);
|
dig[0].SetPulsePolarity(1);
|
||||||
//dig[0].SetBaselineSampling(4);
|
dig[0].SetBaselineSampling(4);
|
||||||
//dig[0].SetRollOverFlag(0);
|
dig[0].SetRollOverFlag(0);
|
||||||
//dig[0].SetPileUpFlag(1);
|
dig[0].SetPileUpFlag(1);
|
||||||
|
|
||||||
//dig[0].SetPulsePolarity(0, 1);
|
//dig[0].SetPulsePolarity(0, 1);
|
||||||
|
|
||||||
|
@ -38,13 +38,15 @@ int main(int argc, char* argv[]){
|
||||||
// printf(" %d %% \n", data );
|
// printf(" %d %% \n", data );
|
||||||
//}
|
//}
|
||||||
|
|
||||||
dig[0].SetTriggerThreshold(2400);
|
//dig[0].SetTriggerThreshold(200);
|
||||||
dig[0].SetTriggerHoldOff(100);
|
//dig[0].SetTriggerHoldOff(100);
|
||||||
|
|
||||||
dig[0].PrintBoardConfiguration();
|
dig[0].PrintBoardConfiguration();
|
||||||
dig[0].GetChannelSettingFromDigitizer(0);
|
dig[0].GetChannelSettingFromDigitizer(0);
|
||||||
dig[0].GetChannelSettingFromDigitizer(1);
|
dig[0].GetChannelSettingFromDigitizer(1);
|
||||||
|
|
||||||
|
//dig[0].SetAcqMode("mixed");
|
||||||
|
|
||||||
delete [] dig;
|
delete [] dig;
|
||||||
//delete psd;
|
//delete psd;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user