tested the QDC data acquistion using internal pulse. good

This commit is contained in:
carina@hades 2023-10-10 11:06:03 -04:00
parent 739fa105c5
commit c95673c697
6 changed files with 232 additions and 181 deletions

View File

@ -373,6 +373,11 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
return;
}
for( int ch = 0; ch < MaxNChannels; ch ++) {
NumEventsDecoded[ch] = 0;
NumNonPileUpDecoded[ch] = 0;
}
if( nByte == 0 ) return;
nw = 0;
@ -395,6 +400,7 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
switch(BoardID){
case 0x8 : DPPType = DPPType::DPP_PSD_CODE; break;
case 0xB : DPPType = DPPType::DPP_PHA_CODE; break;
case 0x7 : DPPType = DPPType::DPP_QDC_CODE; break;
}
}
@ -404,16 +410,11 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
nw = nw + 1;
unsigned int bdAggTimeTag = ReadBuffer(nw, verbose);
if( verbose >= 2 ) printf("Agg Counter : %u \n", bdAggTimeTag);
for( int ch = 0; ch < MaxNChannels; ch ++) {
NumEventsDecoded[ch] = 0;
NumNonPileUpDecoded[ch] = 0;
}
if( verbose >= 2 ) printf("Agg Time Tag : %u \n", bdAggTimeTag);
for( int chMask = 0; chMask < 8 ; chMask ++ ){ // the max numnber of RegChannel is 8 for PHA, PSD, QDC
if( ((ChannelMask >> chMask) & 0x1 ) == 0 ) continue;
if( verbose >= 2 ) printf("==================== Dual/Group Channel Block, ch Mask : %d, nw : %d\n", chMask *2, nw);
if( verbose >= 2 ) printf("==================== Dual/Group Channel Block, ch Mask : 0x%X, nw : %d\n", chMask *2, nw);
if( DPPType == DPPType::DPP_PHA_CODE ) {
if ( DecodePHADualChannelBlock(chMask, fastDecode, verbose) < 0 ) break;
@ -435,6 +436,8 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
///Calculate trigger rate and first and last Timestamp
for(int ch = 0; ch < MaxNChannels; ch++){
if( ch > numInputCh ) continue;
if( NumEventsDecoded[ch] > 0 ) {
// printf("%s | ch %d | %d %d \n", __func__, ch, LoopIndex[ch], DataIndex[ch]);
IsNotRollOverFakeAgg = true;
@ -510,6 +513,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
unsigned int nSample = 0; /// wave form;
unsigned int nEvents = 0;
unsigned int extra2Option = 0;
bool hasWaveForm = false;
bool hasExtra2 = false;
bool hasDualTrace = 0 ;
if( hasFormatInfo ){
@ -604,6 +608,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
if( fastDecode ){
nw += nSample/2;
}else{
if( hasWaveForm ){
for( unsigned int wi = 0; wi < nSample/2; wi++){
nw = nw +1 ; word = ReadBuffer(nw, verbose-2);
///The CAEN manual is wrong, the bit [31:16] is anaprobe 1
@ -655,6 +660,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
}
}
}
}
unsigned long long extTimeStamp = 0;
unsigned int extra2 = 0;
if( hasExtra2 ){
@ -708,7 +714,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
TotNumNonPileUpEvents[channel] ++;
}
if( !fastDecode ) {
if( !fastDecode && hasWaveForm) {
if( hasDualTrace ){
Waveform1[channel][DataIndex[channel]] = tempWaveform1;
Waveform2[channel][DataIndex[channel]] = tempWaveform2;
@ -836,6 +842,7 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
if( fastDecode ){
nw += nSample/2;
}else{
if( hasWaveForm ){
for( unsigned int wi = 0; wi < nSample/2; wi++){
nw = nw +1 ; word = ReadBuffer(nw, verbose-4);
bool dp2b = (( word >> 31 ) & 0x1 );
@ -864,6 +871,7 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
}
}
}
}
unsigned int extra = 0;
unsigned long long extTimeStamp = 0;
@ -902,7 +910,7 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
TotNumNonPileUpEvents[channel] ++;
}
if( !fastDecode ) {
if( !fastDecode && hasWaveForm) {
if( hasDualTrace ){
Waveform1[channel][DataIndex[channel]] = tempWaveform1;
Waveform2[channel][DataIndex[channel]] = tempWaveform2;
@ -942,7 +950,7 @@ inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fas
if( (word >> 31) != 1 ) return 0;
unsigned int aggSize = ( word & 0x3FFFFF ) ;
if( verbose >= 2 ) printf(" size : %d \n", aggSize);
if( verbose >= 2 ) printf(" Group agg. size : %d words\n", aggSize);
unsigned int nEvents = 0;
nw = nw + 1; word = ReadBuffer(nw, verbose);
@ -952,7 +960,7 @@ inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fas
bool hasExtra = ( (word >> 28 ) & 0x1 );
bool hasTimeStamp = ( (word >> 29 ) & 0x1 );
bool hasEnergy = ( (word >> 30 ) & 0x1 );
if( (word >> 31 ) != 1 ) return 0;
if( (word >> 31 ) != 0 ) return 0;
if( verbose >= 2 ) {
printf("Charge : %d, Time: %d, Wave : %d, Extra: %d\n", hasEnergy, hasTimeStamp, hasWaveForm, hasExtra);
@ -974,11 +982,8 @@ inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fas
unsigned int timeStamp0 = (word & 0xFFFFFFFF);
if( verbose >= 2 ) printf("timeStamp %u \n", timeStamp0);
// bool channelTag = ((word >> 31) & 0x1);
// int channel = ChannelMask*2 + channelTag;
///===== read waveform
if( !fastDecode ) {
if( !fastDecode && hasWaveForm ) {
tempWaveform1.clear();
tempDigiWaveform1.clear();
tempDigiWaveform2.clear();
@ -989,6 +994,7 @@ inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fas
if( fastDecode ){
nw += nSample/2;
}else{
if( hasWaveForm ){
for( unsigned int wi = 0; wi < nSample/2; wi++){
nw = nw +1 ; word = ReadBuffer(nw, verbose-4);
@ -1013,6 +1019,7 @@ inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fas
}
}
}
}
unsigned long long extTimeStamp = 0;
unsigned int baseline = 0;
@ -1022,13 +1029,14 @@ inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fas
extra = word;
baseline = (word & 0xFFF);
extTimeStamp = (word >> 16);
if( verbose >= 2 ) printf("extra : 0x%lx, baseline : %d\n", extra, baseline);
}
unsigned long long timeStamp = (extTimeStamp << 31) ;
timeStamp = timeStamp + timeStamp0;
nw = nw +1 ; word = ReadBuffer(nw, verbose);
unsigned int energy = (( word >> 16) & 0xFFFF);
unsigned int energy = ( word & 0xFFFF);
bool pileup = ((word >> 27) & 0x1);
bool OverRange = ((word >> 26)& 0x1);
unsigned short subCh = ((word >> 28)& 0xF);
@ -1050,7 +1058,7 @@ inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fas
TotNumNonPileUpEvents[channel] ++;
}
if( !fastDecode ) {
if( !fastDecode && hasWaveForm) {
Waveform1[channel][DataIndex[channel]] = tempWaveform1;
DigiWaveform1[channel][DataIndex[channel]] = tempDigiWaveform1;
DigiWaveform2[channel][DataIndex[channel]] = tempDigiWaveform2;
@ -1058,15 +1066,13 @@ inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fas
DigiWaveform4[channel][DataIndex[channel]] = tempDigiWaveform4;
}
if( verbose == 1 ) printf("ch : %2d, energy : %d, timestamp : %llu\n", channel, energy, timeStamp);
if( verbose > 1 ) printf("ch : %2d, energy : %d, timestamp : %llu, pileUp : %d, OverRange : %d\n", channel, energy, timeStamp, pileup, OverRange);
if( verbose >= 2 ) printf("extra : 0x%lx, baseline : %d\n", extra, baseline);
if( verbose >= 1 ) printf("ch : %2d, energy : %d, timestamp : %llu\n",
channel, energy, timeStamp);
if( verbose == 1) printf("Decoded : %d, total : %ld \n", NumEventsDecoded[channel], TotNumNonPileUpEvents[channel]);
}
return nw;
}

View File

@ -361,13 +361,18 @@ int Digitizer::ProgramBoard_QDC(){
void Digitizer::StartACQ(){
if ( AcqRun ) return;
unsigned int bufferSize = CalByteForBuffer();
unsigned int bufferSize = 0;
if( DPPType == V1730_DPP_PHA_CODE ){
bufferSize = CalByteForBuffer();
if( bufferSize > 160 * 1024 * 1024 ){
printf("============= buffer size bigger than 160 MB (%u)\n", bufferSize );
//return;
}
}
if( DPPType == V1730_DPP_PSD_CODE) bufferSize = 160 * 1024 * 1024; //TODO allocate 160 MB for PSD
if( DPPType == V1740_DPP_QDC_CODE) bufferSize = 160 * 1024 * 1024; //TODO allocate 160 MB for QDC
if( DPPType == V1730_DPP_PSD_CODE) bufferSize = 160 * 1024 * 1024; //TODO allocate 80 MB for PSD
data->AllocateMemory(bufferSize);
ret = CAEN_DGTZ_SWStartAcquisition(handle);

View File

@ -2381,7 +2381,6 @@ void DigiSettingsPanel::SetUpBoard_QDC(){
SetUpComboBoxBit(cbAnaProbe1[ID], "Ana. Probe ", bdCfgLayout[ID], 3, 0, DPP::Bit_BoardConfig::ListAnaProbe_QDC, DPP::BoardConfiguration, DPP::Bit_BoardConfig::AnalogProbe1, 1, 0);
SetUpComboBoxBit(cbExtTriggerMode[ID], "Ext. Trig. Mode ", bdCfgLayout[ID], 4, 0, DPP::Bit_BoardConfig::ListExtTriggerMode_QDC, DPP::BoardConfiguration, DPP::Bit_BoardConfig::ExtTriggerMode_QDC, 1, 0);
SetUpSpinBox(sbRecordLength_QDC[ID], "Record Length [ns] ", bdCfgLayout[ID], 5, 0, DPP::QDC::RecordLength, -1, true);
SetUpSpinBox(sbEventPreAgg_QDC[ID], "Event pre Agg. ", bdCfgLayout[ID], 6, 0, DPP::QDC::NumberEventsPerAggregate, -1, true);
}
@ -2451,13 +2450,14 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
QGridLayout * inputLayout = new QGridLayout(inputBox);
inputLayout->setSpacing(2);
SetUpSpinBox(sbPreTrigger[ID][numGroup], "Pre-Trigger [ns] : ", inputLayout, 1, 0, DPP::QDC::PreTrigger);
SetUpSpinBox(sbDCOffset[ID][numGroup], "DC Offset [%] : ", inputLayout, 1, 2, DPP::QDC::DCOffset);
SetUpComboBoxBit(cbPolarity[ID][numGroup], "Polarity : ", inputLayout, 2, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListPolarity, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::Polarity);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][numGroup], "Input Smoothing : ", inputLayout, 2, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor);
SetUpSpinBox(sbRecordLength[ID][numGroup], "Record Length [ns] : ", inputLayout, 1, 0, DPP::QDC::RecordLength, -1, true);
SetUpSpinBox(sbPreTrigger[ID][numGroup], "Pre-Trigger [ns] : ", inputLayout, 1, 2, DPP::QDC::PreTrigger);
SetUpSpinBox(sbDCOffset[ID][numGroup], "DC Offset [%] : ", inputLayout, 2, 0, DPP::QDC::DCOffset);
SetUpComboBoxBit(cbPolarity[ID][numGroup], "Polarity : ", inputLayout, 2, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListPolarity, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::Polarity);
SetUpSpinBox(sbFixedBaseline[ID][numGroup], "Fixed Baseline : ", inputLayout, 3, 0, DPP::QDC::FixedBaseline);
SetUpComboBoxBit(cbBaseLineAvg[ID][numGroup], "Baseline Avg. : ", inputLayout, 3, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListBaselineAvg, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::BaselineAvg);
SetUpSpinBox(sbFixedBaseline[ID][numGroup], "Fixed Baseline : ", inputLayout, 4, 0, DPP::QDC::FixedBaseline);
SetUpComboBoxBit(cbBaseLineAvg[ID][numGroup], "Baseline Avg. : ", inputLayout, 4, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListBaselineAvg, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::BaselineAvg);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][numGroup], "Input Smoothing : ", inputLayout, 3, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor);
connect(cbBaseLineAvg[ID][numGroup], &RComboBox::currentIndexChanged, this, [=](){
sbFixedBaseline[ID][numGroup]->setEnabled( cbBaseLineAvg[ID][numGroup]->currentData().toInt() == 0);
@ -2465,7 +2465,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
/// DC offset
QGroupBox * dcWidget = new QGroupBox("Fine DC offset [LSB]",inputBox);
inputLayout->addWidget(dcWidget, 4, 0, 1, 4);
inputLayout->addWidget(dcWidget, 5, 0, 1, 4);
QGridLayout * dcLayout = new QGridLayout(dcWidget);
dcLayout->setSpacing(2);
@ -2595,11 +2595,11 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
SetUpSpinBox(sbShortGate[ID][numGroup], "Gate Width [ns] : ", qdcLayout, 0, 0, DPP::QDC::GateWidth);
SetUpSpinBox(sbGateOffset[ID][numGroup], "Gate Offset [ns] : ", qdcLayout, 0, 2, DPP::QDC::GateOffset);
SetUpCheckBox(chkOverthreshold[ID][numGroup], "Enable OverThreshold Width ", qdcLayout, 1, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::OverThresholdWitdhEnable);
SetUpSpinBox(sbOverThresholdWidth[ID][numGroup], "OverThreshold Width [ns] : ", qdcLayout, 1, 2, DPP::QDC::OverThresholdWidth);
//SetUpCheckBox(chkOverthreshold[ID][numGroup], "Enable OverThreshold Width ", qdcLayout, 1, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::OverThresholdWitdhEnable);
//SetUpSpinBox(sbOverThresholdWidth[ID][numGroup], "OverThreshold Width [ns] : ", qdcLayout, 1, 2, DPP::QDC::OverThresholdWidth);
SetUpCheckBox(chkChargePedestal[ID][numGroup], "Enable Charge Pedes.", qdcLayout, 2, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::ChargePedestal);
SetUpComboBoxBit(cbChargeSensitivity[ID][numGroup], "Charge Sen. : ", qdcLayout, 2, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListChargeSensitivity, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::ChargeSensitivity);
SetUpCheckBox(chkChargePedestal[ID][numGroup], "Enable Charge Pedes.", qdcLayout, 1, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::ChargePedestal);
SetUpComboBoxBit(cbChargeSensitivity[ID][numGroup], "Charge Sen. : ", qdcLayout, 1, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListChargeSensitivity, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::ChargeSensitivity);
}
@ -2610,10 +2610,10 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
QGridLayout * otherLayout = new QGridLayout(otherBox);
otherLayout->setSpacing(2);
SetUpCheckBox(chkTestPule[ID][numGroup], "Int. Test Pulse", otherLayout, 1, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InternalTestPulse);
SetUpComboBoxBit(cbTestPulseRate[ID][numGroup], "Test Pulse Rate : ", otherLayout, 1, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListTestPulseRate, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::TestPulseRate);
SetUpCheckBox(chkTestPule[ID][numGroup], "Int. Test Pulse", otherLayout, 0, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InternalTestPulse);
SetUpComboBoxBit(cbTestPulseRate[ID][numGroup], "Test Pulse Rate : ", otherLayout, 1, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListTestPulseRate, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::TestPulseRate);
SetUpSpinBox(sbNumEventAgg[ID][numGroup], "Event pre Agg. : ", otherLayout, 2, 2, DPP::QDC::NumberEventsPerAggregate);
SetUpSpinBox(sbNumEventAgg[ID][numGroup], "Event pre Agg. : ", otherLayout, 0, 2, DPP::QDC::NumberEventsPerAggregate);
}
@ -2679,14 +2679,16 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
if( ch == 0 ){
QLabel * lb2 = new QLabel("DC offset [%]", this); lb2->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb2, 0, 2);
QLabel * lb4 = new QLabel("Pre-Trigger [ns]", this); lb4->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb4, 0, 4);
QLabel * lb6 = new QLabel("Polarity", this); lb6->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb6, 0, 6);
QLabel * lb7 = new QLabel("Input Smoothing", this); lb7->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb7, 0, 8);
QLabel * lb3 = new QLabel("Record Length [ns]", this); lb3->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb3, 0, 4);
QLabel * lb4 = new QLabel("Pre-Trigger [ns]", this); lb4->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb4, 0, 6);
QLabel * lb6 = new QLabel("Polarity", this); lb6->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb6, 0, 8);
QLabel * lb7 = new QLabel("Input Smoothing", this); lb7->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb7, 0, 10);
}
SetUpSpinBox(sbDCOffset[ID][ch], "", tabLayout, ch + 1, 1, DPP::QDC::DCOffset, ch);
SetUpSpinBox(sbPreTrigger[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::PreTrigger, ch);
SetUpComboBoxBit(cbPolarity[ID][ch], "", tabLayout, ch + 1, 5, DPP::QDC::Bit_DPPAlgorithmControl::ListPolarity, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::Polarity, 1, ch);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][ch], "", tabLayout, ch + 1, 7, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor, 1, ch);
SetUpSpinBox(sbRecordLength[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::RecordLength, ch);
SetUpSpinBox(sbPreTrigger[ID][ch], "", tabLayout, ch + 1, 5, DPP::QDC::PreTrigger, ch);
SetUpComboBoxBit(cbPolarity[ID][ch], "", tabLayout, ch + 1, 7, DPP::QDC::Bit_DPPAlgorithmControl::ListPolarity, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::Polarity, 1, ch);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][ch], "", tabLayout, ch + 1, 9, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor, 1, ch);
}
if ( i == 1 ){
@ -2772,7 +2774,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
tabLayout->setSpacing(2);
tabLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
QLabel * lb0 = new QLabel("Grp.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){
QLabel * chid = new QLabel(QString::number(ch), this);
@ -2789,7 +2791,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
SetUpComboBoxBit(cbTrigMode[ID][ch], "", tabLayout, ch + 1, 1, DPP::QDC::Bit_DPPAlgorithmControl::ListTrigMode, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::TriggerMode, 1, ch);
SetUpSpinBox(sbTriggerHoldOff[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::TriggerHoldOffWidth, ch);
SetUpSpinBox(sbShapedTrigWidth[ID][ch], "", tabLayout, ch + 1, 4, DPP::QDC::TRGOUTWidth, ch);
SetUpSpinBox(sbShapedTrigWidth[ID][ch], "", tabLayout, ch + 1, 5, DPP::QDC::TRGOUTWidth, ch);
}
@ -2838,10 +2840,12 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
}
if( i == 2 ){
if( ch == 0 ){
QLabel * lb0 = new QLabel("Event pre Agg.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 6);
}
SetUpCheckBox(chkDisableSelfTrigger[ID][ch], "Disable Self Trigger ", tabLayout, ch+1, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::DisableSelfTrigger, ch);
SetUpCheckBox(chkDisableTriggerHysteresis[ID][ch], "Disbale Trig. Hysteresis ", tabLayout, ch+1, 3, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::DisableTriggerHysteresis, ch, 2);
SetUpSpinBox(sbNumEventAgg[ID][ch], "Event pre Agg. : ", tabLayout, ch+1, 5, DPP::QDC::NumberEventsPerAggregate, ch);
SetUpSpinBox(sbNumEventAgg[ID][ch], "", tabLayout, ch+1, 5, DPP::QDC::NumberEventsPerAggregate, ch);
}
@ -2856,7 +2860,8 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
QTabWidget * trapTab = new QTabWidget(this);
trapLayout->addWidget(trapTab);
QStringList tabName = {"Common Settings", "OverThreshold"};
//QStringList tabName = {"Common Settings", "OverThreshold"};
QStringList tabName = {"Common Settings"};
const int nTab = tabName.count();
@ -2870,7 +2875,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
tabLayout->setSpacing(2);
tabLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
QLabel * lb0 = new QLabel("Grp.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){
@ -2893,15 +2898,15 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
SetUpCheckBox(chkChargePedestal[ID][ch], "Enable Charge Pedes.", tabLayout, ch + 1, 7, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::ChargePedestal, ch);
}
if ( i == 1 ){
if( ch == 0 ){
QLabel * lb1 = new QLabel("CFD Delay [ns]", this); lb1->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb1, 0, 2);
}
// if ( i == 1 ){
// if( ch == 0 ){
// QLabel * lb1 = new QLabel("OverThreshold Width [ns]", this); lb1->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb1, 0, 2);
// }
SetUpCheckBox(chkOverthreshold[ID][ch], "Enable OverThreshold Width ", tabLayout, ch + 1, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::OverThresholdWitdhEnable, ch);
SetUpSpinBox(sbOverThresholdWidth[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::OverThresholdWidth, ch);
// SetUpCheckBox(chkOverthreshold[ID][ch], "Enable OverThreshold Width ", tabLayout, ch + 1, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::OverThresholdWitdhEnable, ch);
// SetUpSpinBox(sbOverThresholdWidth[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::OverThresholdWidth, ch);
}
// }
}
}
@ -2927,7 +2932,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
tabLayout->setSpacing(2);
tabLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
QLabel * lb0 = new QLabel("Grp.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){
QLabel * chid = new QLabel(QString::number(ch), this);
@ -3254,11 +3259,6 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
//*======================================== QDC only
if( digi[ID]->GetDPPType() == V1740_DPP_QDC_CODE ){
uint32_t recordLength = digi[ID]->GetSettingFromMemory(DPP::QDC::RecordLength);
printf("QDC::RecordLenght: %d = %.0f ns \n", recordLength, (recordLength & 0x1FFF)*DPP::QDC::RecordLength.GetPartialStep() * digi[ID]->GetTick2ns());
sbRecordLength_QDC[ID]->setValue((recordLength & 0x1FFF)* DPP::QDC::RecordLength.GetPartialStep() * digi[ID]->GetTick2ns());
uint32_t eventPreAgg = digi[ID]->GetSettingFromMemory(DPP::QDC::NumberEventsPerAggregate);
sbEventPreAgg_QDC[ID]->setValue(eventPreAgg & 0x3FF);
}
@ -3676,6 +3676,7 @@ void DigiSettingsPanel::SyncAllChannelsTab_QDC(){
if( !enableSignalSlot ) return;
SyncSpinBox(sbRecordLength);
SyncSpinBox(sbPreTrigger);
SyncSpinBox(sbDCOffset);
SyncSpinBox(sbTriggerHoldOff);
@ -3683,11 +3684,11 @@ void DigiSettingsPanel::SyncAllChannelsTab_QDC(){
SyncSpinBox(sbNumEventAgg);
SyncSpinBox(sbShortGate);
SyncSpinBox(sbGateOffset);
SyncSpinBox(sbOverThresholdWidth);
//SyncSpinBox(sbOverThresholdWidth);
SyncCheckBox(chkDisableSelfTrigger);
SyncCheckBox(chkDisableTriggerHysteresis);
SyncCheckBox(chkOverthreshold);
//SyncCheckBox(chkOverthreshold);
SyncCheckBox(chkChargePedestal);
SyncCheckBox(chkTestPule);
@ -3748,6 +3749,7 @@ void DigiSettingsPanel::UpdateSettings_QDC(){
for(int grp = 0; grp < digi[ID]->GetNumRegChannels(); grp ++){
UpdateSpinBox(sbRecordLength[ID][grp], DPP::QDC::RecordLength, grp);
UpdateSpinBox(sbPreTrigger[ID][grp], DPP::QDC::PreTrigger, grp);
UpdateSpinBox(sbDCOffset[ID][grp], DPP::QDC::DCOffset, grp);
UpdateSpinBox(sbTriggerHoldOff[ID][grp], DPP::QDC::TriggerHoldOffWidth, grp);
@ -3755,7 +3757,7 @@ void DigiSettingsPanel::UpdateSettings_QDC(){
UpdateSpinBox(sbNumEventAgg[ID][grp], DPP::QDC::NumberEventsPerAggregate, grp);
UpdateSpinBox(sbShortGate[ID][grp], DPP::QDC::GateWidth, grp);
UpdateSpinBox(sbGateOffset[ID][grp], DPP::QDC::GateOffset, grp);
UpdateSpinBox(sbOverThresholdWidth[ID][grp], DPP::QDC::OverThresholdWidth, grp);
//UpdateSpinBox(sbOverThresholdWidth[ID][grp], DPP::QDC::OverThresholdWidth, grp);
uint32_t dpp = digi[ID]->GetSettingFromMemory(DPP::QDC::DPPAlgorithmControl, grp);
@ -3768,7 +3770,7 @@ void DigiSettingsPanel::UpdateSettings_QDC(){
chkDisableSelfTrigger[ID][grp]->setChecked( Digitizer::ExtractBits(dpp, DPP::QDC::Bit_DPPAlgorithmControl::DisableSelfTrigger) );
chkDisableTriggerHysteresis[ID][grp]->setChecked( Digitizer::ExtractBits(dpp, DPP::QDC::Bit_DPPAlgorithmControl::DisableTriggerHysteresis) );
chkOverthreshold[ID][grp]->setChecked( Digitizer::ExtractBits(dpp, DPP::QDC::Bit_DPPAlgorithmControl::OverThresholdWitdhEnable) );
//chkOverthreshold[ID][grp]->setChecked( Digitizer::ExtractBits(dpp, DPP::QDC::Bit_DPPAlgorithmControl::OverThresholdWitdhEnable) );
chkChargePedestal[ID][grp]->setChecked( Digitizer::ExtractBits(dpp, DPP::QDC::Bit_DPPAlgorithmControl::ChargePedestal));
chkTestPule[ID][grp]->setChecked( Digitizer::ExtractBits(dpp, DPP::QDC::Bit_DPPAlgorithmControl::InternalTestPulse));

View File

@ -270,7 +270,6 @@ private:
//------------------- QDC
RComboBox * cbExtTriggerMode[MaxNDigitizer];
RSpinBox * sbRecordLength_QDC[MaxNDigitizer];
RSpinBox * sbEventPreAgg_QDC[MaxNDigitizer];
//...... reuse varaible
@ -280,8 +279,8 @@ private:
//Trig Hold off with -> sbTriggerHoldOff
//Trig out width -> sbShapedTrigWidth
QCheckBox * chkOverthreshold[MaxNDigitizer][MaxRegChannel+1];
RSpinBox * sbOverThresholdWidth[MaxNDigitizer][MaxRegChannel + 1];
//QCheckBox * chkOverthreshold[MaxNDigitizer][MaxRegChannel+1]; //TODO need firmware version 4.25 & 135.17
//RSpinBox * sbOverThresholdWidth[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbSubChOffset[MaxNDigitizer][MaxRegChannel + 1][8];
RSpinBox * sbSubChThreshold[MaxNDigitizer][MaxRegChannel + 1][8];
QLabel * lbSubCh[MaxNDigitizer][8];

View File

@ -786,6 +786,7 @@ namespace DPP {
}
namespace QDC { // Register already grouped in channel. and there no control for indiviual channel except the Fine DC offset and threshold, so it is like no group
const Reg RecordLength ("Record Length" , 0x1024, RW::ReadWrite, false, 0x1FFF, 1); /// R/W
const Reg GateWidth ("GateWidth" , 0x1030, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg GateOffset ("GateOfset" , 0x1034, RW::ReadWrite, false, 0xFF, 1); /// R/W
const Reg FixedBaseline ("FixedBaseline" , 0x1038, RW::ReadWrite, false, 0xFFF, -1); /// R/W
@ -793,11 +794,11 @@ namespace DPP {
const Reg DPPAlgorithmControl ("DPPAlgorithmControl" , 0x1040, RW::ReadWrite, false, {}); /// R/W
const Reg TriggerHoldOffWidth ("Trigger Hold-off width" , 0x1074, RW::ReadWrite, false, 0xFFFF, 1); /// R/W
const Reg TRGOUTWidth ("Trigger out width" , 0x1078, RW::ReadWrite, false, 0xFFFF, 1); /// R/W
const Reg OverThresholdWidth ("Over Threshold width" , 0x107C, RW::ReadWrite, false, 0xFFFF, 1); /// R/W
//const Reg OverThresholdWidth ("Over Threshold width" , 0x107C, RW::ReadWrite, false, 0xFFFF, 1); /// R/W // need firmware version 4.25 & 135.17
const Reg GroupStatus_R ("Group Status" , 0x1088, RW::ReadONLY, false, {}); /// R/
const Reg AMCFirmwareRevision_R ("AMC firmware version" , 0x108C, RW::ReadONLY, false, {}); /// R/
const Reg DCOffset ("DC offset" , 0x1098, RW::ReadWrite, false, 0xFFFF, -1); /// R/W
const Reg ChannelMask ("Channel Group Mask" , 0x10A8, RW::ReadWrite, false, 0xFF, 1); /// R/W
const Reg SubChannelMask ("SubChannel Mask" , 0x10A8, RW::ReadWrite, false, 0xFF, 1); /// R/W
const Reg DCOffset_LowCh ("DC offset for low ch." , 0x10C0, RW::ReadWrite, false, 0xFFFFFFFF, -1); /// R/W
const Reg DCOffset_HighCh ("DC offset for high ch." , 0x10C4, RW::ReadWrite, false, 0xFFFFFFFF, -1); /// R/W
const Reg TriggerThreshold_sub0 ("Trigger Threshold sub0" , 0x10D0, RW::ReadWrite, false, 0xFFF, -1); /// R/W
@ -811,14 +812,13 @@ namespace DPP {
const Reg NumberEventsPerAggregate ("Number of Events per Aggregate", 0x8020, RW::ReadWrite, false, 0x3FF, 1); /// R/W
const Reg RecordLength ("Record Length" , 0x8024, RW::ReadWrite, false, 0x1FFF, 1); /// R/W
const Reg GroupEnableMask ("Group Enable Mask" , 0x8120, RW::ReadWrite, false, 0xFF, 1); /// R/W
namespace Bit_DPPAlgorithmControl {
const std::pair<unsigned short, unsigned short> ChargeSensitivity = {3, 0} ; /// length, smallest pos
const std::pair<unsigned short, unsigned short> InternalTestPulse = {1, 4};
const std::pair<unsigned short, unsigned short> TestPulseRate = {2, 5};
const std::pair<unsigned short, unsigned short> OverThresholdWitdhEnable = {1, 7};
//const std::pair<unsigned short, unsigned short> OverThresholdWitdhEnable = {1, 7}; ///need firmware version 4.25 & 135.17
const std::pair<unsigned short, unsigned short> ChargePedestal = {1, 8};
const std::pair<unsigned short, unsigned short> InputSmoothingFactor = {3, 12};
const std::pair<unsigned short, unsigned short> Polarity = {1, 16};
@ -926,6 +926,7 @@ const std::vector<Reg> RegisterChannelList_PSD = {
};
const std::vector<Reg> RegisterChannelList_QDC = {
DPP::QDC::RecordLength,
DPP::QDC::GateWidth,
DPP::QDC::GateOffset,
DPP::QDC::FixedBaseline,
@ -933,11 +934,11 @@ const std::vector<Reg> RegisterChannelList_QDC = {
DPP::QDC::DPPAlgorithmControl,
DPP::QDC::TriggerHoldOffWidth,
DPP::QDC::TRGOUTWidth,
DPP::QDC::OverThresholdWidth,
//DPP::QDC::OverThresholdWidth,
DPP::QDC::GroupStatus_R,
DPP::QDC::AMCFirmwareRevision_R,
DPP::QDC::DCOffset,
DPP::QDC::ChannelMask,
DPP::QDC::SubChannelMask,
DPP::QDC::DCOffset_LowCh,
DPP::QDC::DCOffset_HighCh,
DPP::QDC::TriggerThreshold_sub0,
@ -1024,7 +1025,6 @@ const std::vector<Reg> RegisterBoardList_QDC = {
DPP::BoardConfiguration ,
DPP::AggregateOrganization,
DPP::QDC::NumberEventsPerAggregate,
DPP::QDC::RecordLength ,
DPP::AcquisitionControl,
DPP::AcquisitionStatus_R,
DPP::SoftwareTrigger_W,

View File

@ -28,20 +28,62 @@ int main(int argc, char* argv[]){
Digitizer * digi = new Digitizer(0, 2, false, true);
digi->Reset();
digi->WriteRegister(DPP::SoftwareClear_W, 1);
digi->WriteRegister(DPP::QDC::RecordLength, 6000/16, -1);
digi->WriteRegister(DPP::QDC::GateWidth, 100/16, -1);
digi->WriteRegister(DPP::QDC::GateOffset, 0, -1);
digi->WriteRegister(DPP::QDC::FixedBaseline, 0, -1);
digi->WriteRegister(DPP::QDC::PreTrigger, 1000/16, -1);
//digi->WriteRegister(DPP::QDC::DPPAlgorithmControl, 0x300112); // with test pulse
digi->WriteRegister(DPP::QDC::DPPAlgorithmControl, 0x300102); // No test pulse
digi->WriteRegister(DPP::QDC::TriggerHoldOffWidth, 100/16, -1);
digi->WriteRegister(DPP::QDC::TRGOUTWidth, 100/16, -1);
//digi->WriteRegister(DPP::QDC::OverThresholdWidth, 100/16, -1);
//digi->WriteRegister(DPP::QDC::DCOffset, 100/16, -1);
digi->WriteRegister(DPP::QDC::SubChannelMask, 0xFF, -1);
digi->WriteRegister(DPP::QDC::TriggerThreshold_sub0, 100, -1);
digi->WriteRegister(DPP::QDC::TriggerThreshold_sub1, 100, -1);
digi->WriteRegister(DPP::QDC::TriggerThreshold_sub2, 100, -1);
digi->WriteRegister(DPP::QDC::TriggerThreshold_sub3, 100, -1);
digi->WriteRegister(DPP::QDC::TriggerThreshold_sub4, 100, -1);
digi->WriteRegister(DPP::QDC::TriggerThreshold_sub5, 100, -1);
digi->WriteRegister(DPP::QDC::TriggerThreshold_sub6, 100, -1);
digi->WriteRegister(DPP::QDC::TriggerThreshold_sub7, 100, -1);
digi->WriteRegister(DPP::BoardConfiguration, 0xC0110);
digi->WriteRegister(DPP::AggregateOrganization, 0x0);
digi->WriteRegister(DPP::QDC::NumberEventsPerAggregate, 0x7FF);
digi->WriteRegister(DPP::AcquisitionControl, 0x0);
digi->WriteRegister(DPP::GlobalTriggerMask, 0x0);
digi->WriteRegister(DPP::FrontPanelTRGOUTEnableMask, 0x0);
digi->WriteRegister(DPP::FrontPanelIOControl, 0x0);
digi->WriteRegister(DPP::QDC::GroupEnableMask, 0xFF);
digi->WriteRegister(DPP::MaxAggregatePerBlockTransfer, 0x3FF);
digi->WriteRegister(DPP::QDC::DPPAlgorithmControl, 0x300112, 0); // with pulse for grp 0
digi->WriteRegister(DPP::BoardID, 0x7);
// digi->PrintSettingFromMemory();
Data * data = digi->GetData();
data->ClearData();
data->PrintStat();
digi->StartACQ();
for( int i = 0; i < 9; i ++ ){
for( int i = 0; i < 10; i ++ ){
usleep(1000*1000);
digi->ReadData();
data->DecodeBuffer(false, 200);
data->DecodeBuffer(false, 0);
data->PrintStat();
//data->SaveData();
@ -82,8 +124,6 @@ int main(int argc, char* argv[]){
//dig[2]->ReadRegister(DPP::QDC::RecordLength, 0, 0, "");
/******************
Data * data = dig[0]->GetData();
data->ClearData();
@ -206,10 +246,9 @@ int main(int argc, char* argv[]){
delete dig[i];
}
delete [] dig;
*/
/*********************/
/**////##################### Demo for loading and change setting without open a digitizer
////##################### Demo for loading and change setting without open a digitizer
/**
Digitizer * dig = new Digitizer();