diff --git a/ClassData.h b/ClassData.h index 9f14c12..e5377d3 100644 --- a/ClassData.h +++ b/ClassData.h @@ -92,7 +92,7 @@ class Data{ protected: - const unsigned short numChannel; + const unsigned short numInputCh; unsigned int nw; ///for temperary @@ -122,7 +122,7 @@ class Data{ //========================================== -inline Data::Data(unsigned short numCh): numChannel(numCh){ +inline Data::Data(unsigned short numCh): numInputCh(numCh){ tick2ns = 2.0; boardSN = 0; DPPType = DPPType::DPP_PHA_CODE; @@ -297,7 +297,7 @@ inline void Data::PrintStat() const{ } printf("%2s | %6s | %9s | %9s | %6s | %6s(%4s)\n", "ch", "# Evt.", "Rate [Hz]", "Accept", "Tot. Evt.", "index", "loop"); printf("---+--------+-----------+-----------+----------\n"); - for(int ch = 0; ch < numChannel; ch++){ + for(int ch = 0; ch < numInputCh; ch++){ printf("%2d | %6d | %9.2f | %9.2f | %6lu | %6d(%2d)\n", ch, NumEventsDecoded[ch], TriggerRate[ch], NonPileUpRate[ch], TotNumNonPileUpEvents[ch], DataIndex[ch], LoopIndex[ch]); } printf("---+--------+-----------+-----------+----------\n"); @@ -311,7 +311,7 @@ inline void Data::PrintAllData(bool tableMode, unsigned int maxRowDisplay) const int MaxEntry = 0; printf("%4s|", ""); - for( int ch = 0; ch < numChannel; ch++){ + for( int ch = 0; ch < numInputCh; ch++){ if( LoopIndex[ch] > 0 ) { MaxEntry = MaxNData-1; }else{ @@ -325,7 +325,7 @@ inline void Data::PrintAllData(bool tableMode, unsigned int maxRowDisplay) const do{ printf("%4d|", entry ); - for( int ch = 0; ch < numChannel; ch++){ + for( int ch = 0; ch < numInputCh; ch++){ if( DataIndex[ch] < 0 ) continue; printf(" %5d,%12lld |", Energy[ch][entry], Timestamp[ch][entry]); } @@ -336,7 +336,7 @@ inline void Data::PrintAllData(bool tableMode, unsigned int maxRowDisplay) const }while(entry <= MaxEntry); }else{ - for( int ch = 0; ch < numChannel ; ch++){ + for( int ch = 0; ch < numInputCh ; ch++){ if( DataIndex[ch] < 0 ) continue; printf("------------ ch : %d, DataIndex : %d, loop : %d\n", ch, DataIndex[ch], LoopIndex[ch]); for( int ev = 0; ev <= (LoopIndex[ch] > 0 ? MaxNData : DataIndex[ch]) ; ev++){ @@ -411,9 +411,9 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){ NumNonPileUpDecoded[ch] = 0; } - for( int chMask = 0; chMask < MaxNChannels/2 ; chMask ++ ){ + 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 Channel Block, ch Mask : %d, nw : %d\n", chMask *2, nw); + if( verbose >= 2 ) printf("==================== Dual/Group Channel Block, ch Mask : %d, nw : %d\n", chMask *2, nw); if( DPPType == DPPType::DPP_PHA_CODE ) { if ( DecodePHADualChannelBlock(chMask, fastDecode, verbose) < 0 ) break; diff --git a/ClassDigitizer.cpp b/ClassDigitizer.cpp index d04f958..d7f8a7d 100644 --- a/ClassDigitizer.cpp +++ b/ClassDigitizer.cpp @@ -21,9 +21,9 @@ void Digitizer::Initalization(){ portID = -1; boardID = -1; handle = -1; - NChannel = 16; - NRegChannel = 16; - isChEqRegCh = true; + NumInputCh = 16; + NumRegChannel = 16; + isInputChEqRegCh = true; NCoupledCh = 8; ADCbits = 1; DPPType = 0; @@ -63,8 +63,8 @@ void Digitizer::Reset(){ void Digitizer::PrintBoard (){ printf("Connected to Model %s with handle %d using %s\n", BoardInfo.ModelName, handle, LinkType == CAEN_DGTZ_USB ? "USB" : "Optical Link"); printf(" Sampling rate : %.0f MHz = %.1f ns \n", 1000/tick2ns, tick2ns); - printf("No. of Input Channels : %d \n", NChannel); - printf(" No. of Reg Channels : %d, mask : 0x%X\n", NRegChannel, regChannelMask); + printf("No. of Input Channels : %d \n", NumInputCh); + printf(" No. of Reg Channels : %d, mask : 0x%X\n", NumRegChannel, regChannelMask); printf(" SerialNumber :\e[1m\e[33m %d\e[0m\n", BoardInfo.SerialNumber); printf(" DPPType : %d (%s)\n", DPPType, GetDPPString().c_str()); printf(" ADC bit : \e[33m%d\e[0m, %d = 0x%X\n", ADCbits, ADCFullSize, ADCFullSize); @@ -104,23 +104,23 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose if( verbose) printf("Can't read board info\n"); }else{ isConnected = true; - NRegChannel = BoardInfo.Channels; - NChannel = NRegChannel; - isChEqRegCh = true; - regChannelMask = pow(2, NChannel)-1; + NumRegChannel = BoardInfo.Channels; + NumInputCh = NumRegChannel; + isInputChEqRegCh = true; + regChannelMask = pow(2, NumInputCh)-1; switch(BoardInfo.Model){ - case CAEN_DGTZ_V1730: tick2ns = 2.0; NCoupledCh = NChannel/2; break; ///ns -> 500 MSamples/s - case CAEN_DGTZ_V1725: tick2ns = 4.0; NCoupledCh = NChannel/2; break; ///ns -> 250 MSamples/s + case CAEN_DGTZ_V1730: tick2ns = 2.0; NCoupledCh = NumInputCh/2; break; ///ns -> 500 MSamples/s + case CAEN_DGTZ_V1725: tick2ns = 4.0; NCoupledCh = NumInputCh/2; break; ///ns -> 250 MSamples/s case CAEN_DGTZ_V1740: { - NChannel = 64; - NCoupledCh = NRegChannel; - isChEqRegCh = false; + NumInputCh = 64; + NCoupledCh = NumRegChannel; + isInputChEqRegCh = false; tick2ns = 16.0; break; ///ns -> 62.5 MSamples/s } default : tick2ns = 4.0; break; } - data = new Data(NChannel); + data = new Data(NumInputCh); data->tick2ns = tick2ns; data->boardSN = BoardInfo.SerialNumber; ADCbits = BoardInfo.ADC_NBits; @@ -244,6 +244,15 @@ void Digitizer::SetRegChannelMask(uint32_t mask){ ErrorMsg(__func__); } +bool Digitizer::GetInputChannelOnOff(unsigned ch) { + regChannelMask = GetSettingFromMemory(DPP::RegChannelEnableMask); + + if( isInputChEqRegCh ) return (regChannelMask & ( 1 << ch) ); + + int grpID = ch/8; //may change for not grouped in 8; + return (regChannelMask & ( 1 << grpID) ); +} + void Digitizer::SetRegChannelOnOff(unsigned short ch, bool onOff){ if( !isConnected ) return; regChannelMask = ((regChannelMask & ~( 1 << ch) ) | ( onOff << ch)) ; @@ -408,8 +417,8 @@ unsigned int Digitizer::CalByteForBuffer(){ unsigned int numAggBLT; unsigned int chMask ; unsigned int boardCfg ; - unsigned int eventAgg[NChannel/2]; - unsigned int recordLength[NChannel/2]; + unsigned int eventAgg[NumInputCh/2]; + unsigned int recordLength[NumInputCh/2]; unsigned int aggOrgan; if( isConnected ){ @@ -418,7 +427,7 @@ unsigned int Digitizer::CalByteForBuffer(){ boardCfg = ReadRegister(DPP::BoardConfiguration, 0, false); aggOrgan = ReadRegister(DPP::AggregateOrganization, 0, false); - for( int pCh = 0; pCh < NChannel/2; pCh++){ + for( int pCh = 0; pCh < NumInputCh/2; pCh++){ eventAgg[pCh] = ReadRegister(DPP::NumberEventsPerAggregate_G, pCh * 2 , false); recordLength[pCh] = ReadRegister(DPP::RecordLength_G, pCh * 2 , false); } @@ -427,7 +436,7 @@ unsigned int Digitizer::CalByteForBuffer(){ chMask = GetSettingFromMemory(DPP::RegChannelEnableMask); boardCfg = GetSettingFromMemory(DPP::BoardConfiguration); aggOrgan = GetSettingFromMemory(DPP::AggregateOrganization); - for( int pCh = 0; pCh < NChannel/2; pCh++){ + for( int pCh = 0; pCh < NumInputCh/2; pCh++){ eventAgg[pCh] = GetSettingFromMemory(DPP::NumberEventsPerAggregate_G, pCh * 2 ); recordLength[pCh] = GetSettingFromMemory(DPP::RecordLength_G, pCh * 2); } @@ -438,13 +447,13 @@ unsigned int Digitizer::CalByteForBuffer(){ ///printf("Max number of Agg per Readout : %u \n", numAggBLT); ///printf(" is Extra2 enabed : %u \n", ((boardCfg >> 17) & 0x1) ); ///printf(" is Record wave : %u \n", ((boardCfg >> 16) & 0x1) ); - ///for( int pCh = 0; pCh < NChannel/2; pCh++){ + ///for( int pCh = 0; pCh < NumInputCh/2; pCh++){ /// printf("Paired Ch : %d, RecordLength (bit value): %u, Event per Agg. : %u \n", pCh, recordLength[pCh], eventAgg[pCh]); ///} unsigned int bufferSize = aggOrgan; // just for get rip of the warning in complier bufferSize = 0; - for( int pCh = 0; pCh < NChannel/2 ; pCh++){ + for( int pCh = 0; pCh < NumInputCh/2 ; pCh++){ if( (chMask & ( 3 << (2 * pCh) )) == 0 ) continue; bufferSize += 2 + ( 2 + ((boardCfg >> 17) & 0x1) + ((boardCfg >> 16) & 0x1)*recordLength[pCh]*4 ) * eventAgg[pCh] ; } @@ -512,7 +521,7 @@ void Digitizer::WriteRegister (Reg registerAddress, uint32_t value, int ch, bool if( ret == 0 && isSave2MemAndFile && registerAddress.GetRWType() == RW::ReadWrite) { if( ch < 0 ) { if( registerAddress.GetAddress() < 0x8000 ){ - for(int i = 0; i < NChannel; i++){ + for(int i = 0; i < NumInputCh; i++){ SetSettingToMemory(registerAddress, value, i); SaveSettingToFile(registerAddress, value, i); } @@ -638,7 +647,7 @@ void Digitizer::ReadAllSettingsFromBoard(bool force){ regChannelMask = GetSettingFromMemory(DPP::RegChannelEnableMask); /// Channels Setting - for( int ch = 0; ch < NChannel; ch ++){ + for( int ch = 0; ch < NumInputCh; ch ++){ if( DPPType == V1730_DPP_PHA_CODE ){ for( int p = 0; p < (int) RegisterChannelList_PHA.size(); p++){ if( RegisterChannelList_PHA[p].GetRWType() == RW::WriteONLY) continue; @@ -660,7 +669,7 @@ void Digitizer::ReadAllSettingsFromBoard(bool force){ } regChannelMask = GetSettingFromMemory(DPP::QDC::GroupEnableMask); - for( int ch = 0; ch < GetRegChannels(); ch ++){ + for( int ch = 0; ch < GetNumRegChannels(); ch ++){ for( int p = 0; p < (int) RegisterChannelList_QDC.size(); p++){ if( RegisterChannelList_QDC[p].GetRWType() == RW::WriteONLY) continue; ReadRegister(RegisterChannelList_QDC[p], ch); @@ -691,7 +700,7 @@ void Digitizer::ProgramSettingsToBoard(){ } } /// Channels Setting - for( int ch = 0; ch < NChannel; ch ++){ + for( int ch = 0; ch < NumInputCh; ch ++){ if( DPPType == V1730_DPP_PHA_CODE ){ for( int p = 0; p < (int) RegisterChannelList_PHA.size(); p++){ if( RegisterChannelList_PHA[p].GetRWType() == RW::ReadWrite ){ @@ -722,7 +731,7 @@ void Digitizer::ProgramSettingsToBoard(){ } } /// Channels Setting - for( int ch = 0; ch < GetRegChannels(); ch ++){ + for( int ch = 0; ch < GetNumRegChannels(); ch ++){ for( int p = 0; p < (int) RegisterChannelList_QDC.size(); p++){ if( RegisterChannelList_QDC[p].GetRWType() == RW::ReadWrite ){ haha = RegisterChannelList_QDC[p]; diff --git a/ClassDigitizer.h b/ClassDigitizer.h index 34551b9..db1cf41 100644 --- a/ClassDigitizer.h +++ b/ClassDigitizer.h @@ -27,9 +27,9 @@ class Digitizer{ int portID; /// port ID for optical link for using PCIe card, from 0, 1, 2, 3 int boardID; /// board identity int handle; /// i don't know why, but better separete the handle from boardID - int NChannel; /// number of physical input channel - int NRegChannel; /// number of Register channel - bool isChEqRegCh; /// is number of physical input channel = Register channel + int NumInputCh; /// number of physical input channel + int NumRegChannel; /// number of Register channel + bool isInputChEqRegCh; /// is number of physical input channel = Register channel int NCoupledCh; /// number of Coupled channel int ADCbits; /// ADC bit int DPPType; /// DPP verion @@ -38,7 +38,7 @@ class Digitizer{ CAEN_DGTZ_BoardInfo_t BoardInfo; //^----- adjustable parameters - uint32_t regChannelMask ; /// the channel mask from NChannel + uint32_t regChannelMask ; /// the channel mask from NumInputCh uint32_t VMEBaseAddress; /// For direct USB or Optical-link connection, VMEBaseAddress must be 0 CAEN_DGTZ_ConnectionType LinkType; /// USB or Optic CAEN_DGTZ_IOLevel_t IOlev; /// TTL signal (1 = 1.5 to 5V, 0 = 0 to 0.7V ) or NIM signal (1 = -1 to -0.8V, 0 = 0V) @@ -106,12 +106,12 @@ class Digitizer{ CAEN_DGTZ_BoardInfo_t GetBoardInfo() const {return BoardInfo;} std::string GetModelName() const {return BoardInfo.ModelName;} int GetSerialNumber() const {return BoardInfo.SerialNumber;} - int GetChannelMask() { regChannelMask = GetSettingFromMemory(DPP::RegChannelEnableMask); return regChannelMask;} - bool GetChannelOnOff(unsigned ch) { regChannelMask = GetSettingFromMemory(DPP::RegChannelEnableMask); return (regChannelMask & ( 1 << ch) );} - float GetTick2ns() const {return tick2ns;} - int GetNChannels() const {return NChannel;} - int GetRegChannels() const {return NRegChannel;} - bool IsChEqRegCh() const {return isChEqRegCh;} + int GetRegChannelMask() { regChannelMask = GetSettingFromMemory(DPP::RegChannelEnableMask); return regChannelMask;} + bool GetInputChannelOnOff(unsigned ch) ; + float GetTick2ns() const {return tick2ns;} + int GetNumInputCh() const {return NumInputCh;} + int GetNumRegChannels() const {return NumRegChannel;} + bool IsInputChEqRegCh() const {return isInputChEqRegCh;} int GetCoupledChannels() const {return NCoupledCh;} int GetHandle() const {return handle;} int GetDPPType() const {return DPPType;} diff --git a/DigiSettingsPanel.cpp b/DigiSettingsPanel.cpp index bd83d22..66ef9df 100644 --- a/DigiSettingsPanel.cpp +++ b/DigiSettingsPanel.cpp @@ -73,7 +73,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr SetUpInfo("Link Type ", digi[ID]->GetLinkType() == CAEN_DGTZ_USB ? "USB" : "Optical Link" , infoLayout[ID], 0, 4); SetUpInfo( "S/N No. ", std::to_string(digi[ID]->GetSerialNumber()), infoLayout[ID], 1, 0); - SetUpInfo("No. Input Ch. ", std::to_string(digi[ID]->GetNChannels()), infoLayout[ID], 1, 2); + SetUpInfo("No. Input Ch. ", std::to_string(digi[ID]->GetNumInputCh()), infoLayout[ID], 1, 2); SetUpInfo("Sampling Rate ", std::to_string((int) digi[ID]->GetTick2ns()) + " ns = " + std::to_string( (1000/digi[ID]->GetTick2ns())) + " MHz" , infoLayout[ID], 1, 4); SetUpInfo("ADC bit ", std::to_string(digi[ID]->GetADCBits()), infoLayout[ID], 2, 0); @@ -955,7 +955,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){ enableSignalSlot = false; cbCh->clear(); - for( int i = 0; i < digi[index]->GetNChannels(); i ++ ) cbCh->addItem("Ch-" + QString::number(i), i); + for( int i = 0; i < digi[index]->GetNumInputCh(); i ++ ) cbCh->addItem("Ch-" + QString::number(i), i); if( digi[index]->GetDPPType() == V1730_DPP_PHA_CODE ) chRegList = RegisterChannelList_PHA; if( digi[index]->GetDPPType() == V1730_DPP_PSD_CODE ) chRegList = RegisterChannelList_PSD; @@ -1108,7 +1108,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){ connect(rbCh[i], &QRadioButton::clicked, this, &DigiSettingsPanel::CheckRadioAndCheckedButtons); int id1 = cbFromBoard->currentIndex(); - if( i >= digi[id1]->GetRegChannels() ) rbCh[i]->setEnabled(false); + if( i >= digi[id1]->GetNumRegChannels() ) rbCh[i]->setEnabled(false); } //---------- Acton buttons @@ -1141,7 +1141,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){ connect(chkCh[i], &QCheckBox::clicked, this, &DigiSettingsPanel::CheckRadioAndCheckedButtons); int id1 = cbToBoard->currentIndex(); - if( i >= digi[id1]->GetRegChannels() ) chkCh[i]->setEnabled(false); + if( i >= digi[id1]->GetNumRegChannels() ) chkCh[i]->setEnabled(false); } bnCopyBoard->setEnabled(false); @@ -1164,7 +1164,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){ if( digi[fromIndex]->GetDPPType() == V1730_DPP_PHA_CODE ) regList = RegisterChannelList_PHA; if( digi[fromIndex]->GetDPPType() == V1730_DPP_PSD_CODE ) regList = RegisterChannelList_PSD; - for( int i = 0; i < digi[toIndex]->GetRegChannels() ; i++){ + for( int i = 0; i < digi[toIndex]->GetNumRegChannels() ; i++){ //Copy setting for( int k = 0; k < (int) regList.size(); k ++){ if( regList[k].GetRWType() != RW::ReadWrite ) continue; @@ -1232,8 +1232,8 @@ void DigiSettingsPanel::SetUpChannelMask(unsigned int digiID){ chLayout->setAlignment(Qt::AlignLeft); chLayout->setSpacing(0); - int nChGrp = digi[digiID]->GetRegChannels(); - if( digi[digiID]->GetDPPType() == DPPType::DPP_QDC_CODE ) nChGrp = digi[digiID]->GetRegChannels(); + int nChGrp = digi[digiID]->GetNumRegChannels(); + if( digi[digiID]->GetDPPType() == DPPType::DPP_QDC_CODE ) nChGrp = digi[digiID]->GetNumRegChannels(); for( int i = 0; i < nChGrp; i++){ bnChEnableMask[digiID][i] = new QPushButton(this); @@ -1390,7 +1390,7 @@ void DigiSettingsPanel::SetUpChannel_PHA(){ QHBoxLayout * papa = new QHBoxLayout(jaja); papa->setAlignment(Qt::AlignLeft); - const unsigned short numChannel = digi[ID]->GetRegChannels(); + const unsigned short numChannel = digi[ID]->GetNumRegChannels(); {//^============================== Channel selection QLabel * lbChSel = new QLabel ("Channel : ", this); @@ -1525,7 +1525,7 @@ void DigiSettingsPanel::SetUpChannel_PHA(){ connect(bnADCCali, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::ADCCalibration_W, 1); - for( int i = 0 ; i < digi[ID]->GetRegChannels(); i++ ) digi[ID]->ReadRegister(DPP::ChannelStatus_R, i); + for( int i = 0 ; i < digi[ID]->GetNumRegChannels(); i++ ) digi[ID]->ReadRegister(DPP::ChannelStatus_R, i); UpdatePanelFromMemory(); }); } @@ -1553,7 +1553,7 @@ void DigiSettingsPanel::SetUpChannel_PHA(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); @@ -1616,7 +1616,7 @@ void DigiSettingsPanel::SetUpChannel_PHA(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setFixedWidth(20); @@ -1676,7 +1676,7 @@ void DigiSettingsPanel::SetUpChannel_PHA(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); @@ -1740,7 +1740,7 @@ void DigiSettingsPanel::SetUpChannel_PHA(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setFixedWidth(20); @@ -1839,7 +1839,7 @@ void DigiSettingsPanel::SetUpChannel_PSD(){ QHBoxLayout * papa = new QHBoxLayout(jaja); papa->setAlignment(Qt::AlignLeft); - const unsigned short numChannel = digi[ID]->GetRegChannels(); + const unsigned short numChannel = digi[ID]->GetNumRegChannels(); {//^============================== Channel selection QLabel * lbChSel = new QLabel ("Ch : ", this); @@ -2024,7 +2024,7 @@ void DigiSettingsPanel::SetUpChannel_PSD(){ connect(bnADCCali, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::ADCCalibration_W, 1); - for( int i = 0 ; i < digi[ID]->GetRegChannels(); i++ ) digi[ID]->ReadRegister(DPP::ChannelStatus_R, i); + for( int i = 0 ; i < digi[ID]->GetNumRegChannels(); i++ ) digi[ID]->ReadRegister(DPP::ChannelStatus_R, i); UpdatePanelFromMemory(); }); } @@ -2052,7 +2052,7 @@ void DigiSettingsPanel::SetUpChannel_PSD(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); @@ -2163,7 +2163,7 @@ void DigiSettingsPanel::SetUpChannel_PSD(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setFixedWidth(20); @@ -2246,7 +2246,7 @@ void DigiSettingsPanel::SetUpChannel_PSD(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); @@ -2314,7 +2314,7 @@ void DigiSettingsPanel::SetUpChannel_PSD(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setFixedWidth(20); @@ -2419,7 +2419,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){ QHBoxLayout * papa = new QHBoxLayout(jaja); papa->setAlignment(Qt::AlignLeft); - const unsigned short numGroup = digi[ID]->GetRegChannels(); + const unsigned short numGroup = digi[ID]->GetNumRegChannels(); {//^============================== Group selection QLabel * lbChSel = new QLabel ("Group : ", this); @@ -2668,7 +2668,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){ QLabel * lb0 = new QLabel("Grp.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); @@ -2774,7 +2774,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setFixedWidth(20); @@ -2872,7 +2872,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); @@ -2929,7 +2929,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){ QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch++){ QLabel * chid = new QLabel(QString::number(ch), this); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setFixedWidth(20); @@ -3005,7 +3005,7 @@ void DigiSettingsPanel::UpdateBoardAndChannelsStatus(){ } //*========================================== Channel Status - for( int i = 0; i < digi[ID]->GetRegChannels(); i++){ + for( int i = 0; i < digi[ID]->GetNumRegChannels(); i++){ uint32_t chStatus = digi[ID]->ReadRegister(DPP::ChannelStatus_R, i); if( digi[ID]->GetDPPType() == DPPType::DPP_PHA_CODE || digi[ID]->GetDPPType() == DPPType::DPP_PSD_CODE ){ @@ -3123,7 +3123,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ } //*======================================== uint32_t chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask); - for( int i = 0; i < digi[ID]->GetRegChannels(); i++){ + for( int i = 0; i < digi[ID]->GetNumRegChannels(); i++){ if( (chMask >> i ) & 0x1 ) { bnChEnableMask[ID][i]->setStyleSheet("background-color: green;"); }else{ @@ -3191,7 +3191,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ uint32_t glbTrgMask = digi[ID]->GetSettingFromMemory(DPP::GlobalTriggerMask); if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE || digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ){ - for( int i = 0; i < digi[ID]->GetRegChannels(); i++){ + for( int i = 0; i < digi[ID]->GetNumRegChannels(); i++){ if( (glbTrgMask >> i ) & 0x1 ){ bnGlobalTriggerMask[ID][i]->setStyleSheet("background-color: green;"); }else{ @@ -3206,7 +3206,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ //*======================================== uint32_t TRGOUTMask = digi[ID]->GetSettingFromMemory(DPP::FrontPanelTRGOUTEnableMask); - for( int i = 0; i < digi[ID]->GetRegChannels(); i++){ + for( int i = 0; i < digi[ID]->GetNumRegChannels(); i++){ if( (TRGOUTMask >> i ) & 0x1 ){ bnTRGOUTMask[ID][i]->setStyleSheet("background-color: green;"); }else{ @@ -3328,7 +3328,7 @@ void DigiSettingsPanel::UpdateComboBoxBit(RComboBox * & cb, uint32_t fullBit, st void DigiSettingsPanel::SyncSpinBox(RSpinBox *(&spb)[][MaxRegChannel+1]){ if( !enableSignalSlot ) return; - const int nCh = digi[ID]->GetRegChannels(); + const int nCh = digi[ID]->GetNumRegChannels(); int ch = chSelection[ID]->currentData().toInt(); @@ -3360,7 +3360,7 @@ void DigiSettingsPanel::SyncSpinBox(RSpinBox *(&spb)[][MaxRegChannel+1]){ void DigiSettingsPanel::SyncComboBox(RComboBox *(&cb)[][MaxRegChannel+1]){ if( !enableSignalSlot ) return; - const int nCh = digi[ID]->GetRegChannels(); + const int nCh = digi[ID]->GetNumRegChannels(); int ch = chSelection[ID]->currentData().toInt(); @@ -3391,7 +3391,7 @@ void DigiSettingsPanel::SyncComboBox(RComboBox *(&cb)[][MaxRegChannel+1]){ void DigiSettingsPanel::SyncCheckBox(QCheckBox *(&chk)[][MaxRegChannel+1]){ if( !enableSignalSlot ) return; - const int nCh = digi[ID]->GetRegChannels(); + const int nCh = digi[ID]->GetNumRegChannels(); int ch = chSelection[ID]->currentData().toInt(); if( ch >= 0 ){ enableSignalSlot = false; @@ -3469,7 +3469,7 @@ void DigiSettingsPanel::UpdateSettings_PHA(){ //printf("------ %s \n", __func__); - for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch ++){ + for( int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch ++){ UpdateSpinBox(sbRecordLength[ID][ch], DPP::RecordLength_G, ch); UpdateSpinBox(sbPreTrigger[ID][ch], DPP::PreTrigger, ch); UpdateSpinBox(sbInputRiseTime[ID][ch], DPP::PHA::InputRiseTime, ch); @@ -3596,7 +3596,7 @@ void DigiSettingsPanel::UpdateSettings_PSD(){ // printf("------ %s \n", __func__); - for(int ch = 0; ch < digi[ID]->GetRegChannels(); ch ++){ + for(int ch = 0; ch < digi[ID]->GetNumRegChannels(); ch ++){ UpdateSpinBox(sbRecordLength[ID][ch], DPP::RecordLength_G, ch); UpdateSpinBox(sbPreTrigger[ID][ch], DPP::PreTrigger, ch); @@ -3700,7 +3700,7 @@ void DigiSettingsPanel::SyncAllChannelsTab_QDC(){ //Sync sub-DC-offset //SYnc Threshold - const int nGrp = digi[ID]->GetRegChannels(); + const int nGrp = digi[ID]->GetNumRegChannels(); int grp = chSelection[ID]->currentData().toInt(); @@ -3746,7 +3746,7 @@ void DigiSettingsPanel::SyncAllChannelsTab_QDC(){ void DigiSettingsPanel::UpdateSettings_QDC(){ enableSignalSlot = false; - for(int grp = 0; grp < digi[ID]->GetRegChannels(); grp ++){ + for(int grp = 0; grp < digi[ID]->GetNumRegChannels(); grp ++){ UpdateSpinBox(sbPreTrigger[ID][grp], DPP::QDC::PreTrigger, grp); UpdateSpinBox(sbDCOffset[ID][grp], DPP::QDC::DCOffset, grp); @@ -3822,8 +3822,8 @@ void DigiSettingsPanel::CheckRadioAndCheckedButtons(){ int id2 = cbToBoard->currentIndex(); for( int i = 0 ; i < MaxRegChannel; i++){ - if( i >= digi[id1]->GetRegChannels() ) rbCh[i]->setEnabled(false); - if( i >= digi[id2]->GetRegChannels() ) chkCh[i]->setEnabled(false); + if( i >= digi[id1]->GetNumRegChannels() ) rbCh[i]->setEnabled(false); + if( i >= digi[id2]->GetNumRegChannels() ) chkCh[i]->setEnabled(false); } if( digi[id1]->GetDPPType() != digi[id2]->GetDPPType() ){ @@ -3839,18 +3839,18 @@ void DigiSettingsPanel::CheckRadioAndCheckedButtons(){ } int chFromIndex = -1; - for( int i = 0 ; i < digi[id1]->GetRegChannels() ; i++){ + for( int i = 0 ; i < digi[id1]->GetNumRegChannels() ; i++){ if( rbCh[i]->isChecked() && cbFromBoard->currentIndex() == cbToBoard->currentIndex()){ chFromIndex = i; chkCh[i]->setChecked(false); } } - for( int i = 0 ; i < digi[id1]->GetRegChannels() ; i++) chkCh[i]->setEnabled(true); + for( int i = 0 ; i < digi[id1]->GetNumRegChannels() ; i++) chkCh[i]->setEnabled(true); if( chFromIndex >= 0 && cbFromBoard->currentIndex() == cbToBoard->currentIndex() ) chkCh[chFromIndex]->setEnabled(false); bool isToIndexCleicked = false; - for( int i = 0 ; i < digi[id1]->GetRegChannels() ; i++){ + for( int i = 0 ; i < digi[id1]->GetNumRegChannels() ; i++){ if( chkCh[i]->isChecked() ){ isToIndexCleicked = true; } diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index 4ff9161..299f6be 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -790,7 +790,7 @@ void MainWindow::SetupScalar(){ unsigned short maxNChannel = 0; for( unsigned int k = 0; k < nDigi; k ++ ){ - if( digi[k]->GetNChannels() > maxNChannel ) maxNChannel = digi[k]->GetNChannels(); + if( digi[k]->GetNumInputCh() > maxNChannel ) maxNChannel = digi[k]->GetNumInputCh(); } scalar->setGeometry(0, 0, 10 + nDigi * 200, 110 + maxNChannel * 20); @@ -829,10 +829,10 @@ void MainWindow::SetupScalar(){ leAccept = new QLineEdit**[nDigi]; for( unsigned int iDigi = 0; iDigi < nDigi; iDigi++){ rowID = 2; - leTrigger[iDigi] = new QLineEdit *[digi[iDigi]->GetNChannels()]; - leAccept[iDigi] = new QLineEdit *[digi[iDigi]->GetNChannels()]; - uint32_t chMask = digi[iDigi]->GetChannelMask(); - for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch++){ + leTrigger[iDigi] = new QLineEdit *[digi[iDigi]->GetNumInputCh()]; + leAccept[iDigi] = new QLineEdit *[digi[iDigi]->GetNumInputCh()]; + uint32_t chMask = digi[iDigi]->GetRegChannelMask(); + for( int ch = 0; ch < digi[iDigi]->GetNumInputCh(); ch++){ if( ch == 0 ){ QLabel * lbDigi = new QLabel("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()), scalar); @@ -860,11 +860,11 @@ void MainWindow::SetupScalar(){ leAccept[iDigi][ch]->setAlignment(Qt::AlignRight); leAccept[iDigi][ch]->setStyleSheet("background-color: #F0F0F0;"); - if( digi[iDigi]->IsChEqRegCh() ){ + if( digi[iDigi]->IsInputChEqRegCh() ){ leTrigger[iDigi][ch]->setEnabled( (chMask >> ch) & 0x1 ); leAccept[iDigi][ch]->setEnabled( (chMask >> ch) & 0x1 ); }else{ - int grpID = ch/digi[iDigi]->GetRegChannels(); + int grpID = ch/digi[iDigi]->GetNumRegChannels(); leTrigger[iDigi][ch]->setEnabled( (chMask >> grpID) & 0x1 ); leAccept[iDigi][ch]->setEnabled( (chMask >> grpID) & 0x1 ); } @@ -884,7 +884,7 @@ void MainWindow::CleanUpScalar(){ if( leTrigger == nullptr ) return; for( unsigned int i = 0; i < nDigi; i++){ - for( int ch = 0; ch < digi[i]->GetNChannels(); ch ++){ + for( int ch = 0; ch < digi[i]->GetNumInputCh(); ch ++){ delete leTrigger[i][ch]; delete leAccept[i][ch]; } @@ -925,11 +925,11 @@ void MainWindow::UpdateScalar(){ // printf("### %d ", iDigi); // digi[iDigi]->GetData()->PrintAllData(true, 10); if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize(); - for( int i = 0; i < digi[iDigi]->GetNChannels(); i++){ + for( int i = 0; i < digi[iDigi]->GetNumInputCh(); i++){ QString a = ""; QString b = ""; - if( digi[iDigi]->GetChannelOnOff(i) == true ) { + if( digi[iDigi]->GetInputChannelOnOff(i) == true ) { //printf(" %3d %2d | %7.2f %7.2f \n", digi[iDigi]->GetSerialNumber(), i, digi[iDigi]->GetData()->TriggerRate[i], digi[iDigi]->GetData()->NonPileUpRate[i]); QString a = QString::number(digi[iDigi]->GetData()->TriggerRate[i], 'f', 2); QString b = QString::number(digi[iDigi]->GetData()->NonPileUpRate[i], 'f', 2); @@ -1506,16 +1506,16 @@ void MainWindow::UpdateAllPanels(int panelID){ if(scalar) { for( unsigned int iDigi = 0; iDigi < nDigi; iDigi++){ - uint32_t chMask = digi[iDigi]->GetChannelMask(); - for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch++){ + uint32_t chMask = digi[iDigi]->GetRegChannelMask(); + for( int ch = 0; ch < digi[iDigi]->GetNumInputCh(); ch++){ // leTrigger[iDigi][i]->setEnabled( (chMask >> i) & 0x1 ); // leAccept[iDigi][i]->setEnabled( (chMask >> i) & 0x1 ); - if( digi[iDigi]->IsChEqRegCh() ){ + if( digi[iDigi]->IsInputChEqRegCh() ){ leTrigger[iDigi][ch]->setEnabled( (chMask >> ch) & 0x1 ); leAccept[iDigi][ch]->setEnabled( (chMask >> ch) & 0x1 ); }else{ - int grpID = ch/digi[iDigi]->GetRegChannels(); + int grpID = ch/digi[iDigi]->GetNumRegChannels(); leTrigger[iDigi][ch]->setEnabled( (chMask >> grpID) & 0x1 ); leAccept[iDigi][ch]->setEnabled( (chMask >> grpID) & 0x1 ); } diff --git a/Scope.cpp b/Scope.cpp index 114a64e..9d1209e 100644 --- a/Scope.cpp +++ b/Scope.cpp @@ -102,7 +102,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh ID = 0; cbScopeDigi->setCurrentIndex(0); - for( int i = 0; i < digi[0]->GetRegChannels(); i++) cbScopeCh->addItem("Ch-" + QString::number(i)); + for( int i = 0; i < digi[0]->GetNumRegChannels(); i++) cbScopeCh->addItem("Ch-" + QString::number(i)); tick2ns = digi[ID]->GetTick2ns(); factor = digi[ID]->IsDualTrace_PHA() ? 2 : 1; @@ -119,7 +119,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh enableSignalSlot = false; //---setup cbScopeCh cbScopeCh->clear(); - for( int i = 0; i < digi[ID]->GetRegChannels(); i++) cbScopeCh->addItem("Ch-" + QString::number(i)); + for( int i = 0; i < digi[ID]->GetNumRegChannels(); i++) cbScopeCh->addItem("Ch-" + QString::number(i)); //---Setup SettingGroup CleanUpSettingsGroupBox(); @@ -343,7 +343,7 @@ void Scope::UpdateScope(){ int ch = cbScopeCh->currentIndex(); - if( digi[ID]->GetChannelOnOff(ch) == false) return; + if( digi[ID]->GetInputChannelOnOff(ch) == false) return; // printf("### %d %d \n", ch, digi[ID]->GetData()->DataIndex[ch]); @@ -782,7 +782,7 @@ void Scope::UpdatePanelFromMomeory(){ if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) UpdatePHAPanel(); if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) UpdatePSDPanel(); - settingGroup->setEnabled(digi[ID]->GetChannelOnOff(ch)); + settingGroup->setEnabled(digi[ID]->GetInputChannelOnOff(ch)); } diff --git a/SingleSpectra.cpp b/SingleSpectra.cpp index 5731878..2fb52fc 100644 --- a/SingleSpectra.cpp +++ b/SingleSpectra.cpp @@ -70,7 +70,7 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD for( unsigned int i = 0; i < MaxNDigitizer; i++){ if( i >= nDigi ) continue; - for( int j = 0; j < digi[i]->GetNChannels(); j++){ + for( int j = 0; j < digi[i]->GetNumInputCh(); j++){ if( i < nDigi ) { hist[i][j] = new Histogram1D("Digi-" + QString::number(digi[i]->GetSerialNumber()) +", Ch-" + QString::number(j), "Raw Energy [ch]", nBin, xMin, xMax); }else{ @@ -99,7 +99,7 @@ SingleSpectra::~SingleSpectra(){ SaveSetting(); for( unsigned int i = 0; i < nDigi; i++ ){ - for( int ch = 0; ch < digi[i]->GetNChannels(); ch++){ + for( int ch = 0; ch < digi[i]->GetNumInputCh(); ch++){ delete hist[i][ch]; } } @@ -135,7 +135,7 @@ void SingleSpectra::FillHistograms(){ for( int i = 0; i < nDigi; i++){ digiMTX[i].lock(); - for( int ch = 0; ch < digi[i]->GetNChannels(); ch ++ ){ + for( int ch = 0; ch < digi[i]->GetNumInputCh(); ch ++ ){ int lastIndex = digi[i]->GetData()->DataIndex[ch]; int loopIndex = digi[i]->GetData()->LoopIndex[ch]; @@ -170,7 +170,7 @@ void SingleSpectra::SaveSetting(){ for( unsigned int i = 0; i < nDigi; i++){ file.write(("======= " + QString::number(digi[i]->GetSerialNumber()) + "\n").toStdString().c_str()); - for( int ch = 0; ch < digi[i]->GetNChannels() ; ch++){ + for( int ch = 0; ch < digi[i]->GetNumInputCh() ; ch++){ QString a = QString::number(ch).rightJustified(2, ' '); QString b = QString::number(hist[i][ch]->GetNBin()).rightJustified(6, ' '); QString c = QString::number(hist[i][ch]->GetXMin()).rightJustified(6, ' '); diff --git a/test.cpp b/test.cpp index 18ba99f..ed5e472 100644 --- a/test.cpp +++ b/test.cpp @@ -29,26 +29,34 @@ int main(int argc, char* argv[]){ Digitizer * digi = new Digitizer(0, 2, false, true); - digi->ReadAllSettingsFromBoard(); - printf("Record Length: 0x%d \n", digi->GetSettingFromMemory(DPP::QDC::RecordLength, 0)); + Data * data = digi->GetData(); + + data->ClearData(); + + + digi->StartACQ(); + + + for( int i = 0; i < 9; i ++ ){ + usleep(1000*1000); + digi->ReadData(); + data->DecodeBuffer(false, 200); + data->PrintStat(); + + //data->SaveData(); + + // int index = data->NumEventsDecoded[0]; + // printf("-------------- %ld \n", data->Waveform1[0][index].size()); + + //data->PrintAllData(); - for( int grp = 0; grp < 8; grp ++){ - printf("OverThreshold %d: 0x%d \n", grp, digi->GetSettingFromMemory(DPP::QDC::OverThresholdWidth, grp)); } - int ret; - //int ret = CAEN_DGTZ_WriteRegister(digi->GetHandle(), 0x8024, 0x60); - - digi->WriteRegister(DPP::QDC::RecordLength, 0x60, -1, true); - - unsigned int returnData; - ret = CAEN_DGTZ_ReadRegister(digi->GetHandle(), 0x8024, &returnData); - printf("ret : %d | 0x%08x\n", ret, returnData); + digi->StopACQ(); + - printf("Record Length: 0x%d \n", digi->GetSettingFromMemory(DPP::QDC::RecordLength, 0)); - digi->CloseDigitizer(); delete digi; diff --git a/test_indep.cpp b/test_indep.cpp index 72279a6..4a50e24 100644 --- a/test_indep.cpp +++ b/test_indep.cpp @@ -179,7 +179,7 @@ int main(int argc, char* argv[]){ CAEN_DGTZ_BoardInfo_t BoardInfo; ret = (int) CAEN_DGTZ_GetInfo(handle, &BoardInfo); - int NChannel = BoardInfo.Channels; + int NInputCh = BoardInfo.Channels; uint32_t regChannelMask = 0xFFFF; float tick2ns = 4.0; switch(BoardInfo.Model){ @@ -240,7 +240,7 @@ int main(int argc, char* argv[]){ printf("======== program Channels\n"); ///CAEN_DGTZ_DPP_PHA_Params_t DPPParams; ///memset(&DPPParams, 0, sizeof(CAEN_DGTZ_DPP_PHA_Params_t)); - ///for(int i = 0; i < NChannel; i++){ + ///for(int i = 0; i < NInputCh; i++){ /// DPPParams.M[i] = 5000; /// decay time [ns] /// DPPParams.m[i] = 992; /// flat-top [ns] /// DPPParams.k[i] = 96; /// rise-time [ns] @@ -301,7 +301,7 @@ int main(int argc, char* argv[]){ printf("allowcated %d byte ( %d words) for buffer\n", AllocatedSize, AllocatedSize/4); ret |= CAEN_DGTZ_MallocDPPEvents(handle, reinterpret_cast(&Events), &AllocatedSize) ; printf("allowcated %d byte for Events\n", AllocatedSize); - for( int i = 0 ; i < NChannel; i++){ + for( int i = 0 ; i < NInputCh; i++){ ret |= CAEN_DGTZ_MallocDPPWaveforms(handle, reinterpret_cast(&Waveform[i]), &AllocatedSize); printf("allowcated %d byte for waveform-%d\n", AllocatedSize, i); } @@ -333,7 +333,7 @@ int main(int argc, char* argv[]){ return 0; } - for (int ch = 0; ch < NChannel; ch++) { + for (int ch = 0; ch < NInputCh; ch++) { if( DataIndex[ch] > 0 ) printf("------------------------ %d, %d\n", ch, DataIndex[ch]); for (int ev = 0; ev < DataIndex[ch]; ev++) { ///TrgCnt[ch]++;