restructure the physical channel and Reg channel, only in the digitizer class

This commit is contained in:
carina@hades 2023-10-09 13:12:48 -04:00
parent d526579e53
commit d90f4a33ce
8 changed files with 475 additions and 387 deletions

View File

@ -22,6 +22,8 @@ void Digitizer::Initalization(){
boardID = -1;
handle = -1;
NChannel = 16;
NRegChannel = 16;
isChEqRegCh = true;
NCoupledCh = 8;
ADCbits = 1;
DPPType = 0;
@ -29,7 +31,7 @@ void Digitizer::Initalization(){
tick2ns = 0;
BoardInfo = {};
channelMask = 0xFFFF;
regChannelMask = 0xFFFF;
VMEBaseAddress = 0;
LinkType = CAEN_DGTZ_USB; /// default USB
IOlev = CAEN_DGTZ_IOLevel_NIM; ///default NIM
@ -60,13 +62,14 @@ 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("Number of Channels : %d = 0x%X\n", NChannel, channelMask);
printf("SerialNumber :\e[1m\e[33m %d\e[0m\n", BoardInfo.SerialNumber);
printf("DPPType : %d (%s)\n", DPPType, GetDPPString().c_str());
printf("ADC bit is \e[33m%d\e[0m, %d = 0x%X\n", ADCbits, ADCFullSize, ADCFullSize);
printf("ROC FPGA Release is %s\n", BoardInfo.ROC_FirmwareRel);
printf("AMC FPGA Release is %s\n", BoardInfo.AMC_FirmwareRel);
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(" 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);
printf(" ROC FPGA Release : %s\n", BoardInfo.ROC_FirmwareRel);
printf(" AMC FPGA Release : %s\n", BoardInfo.AMC_FirmwareRel);
}
int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose){
@ -101,12 +104,19 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
if( verbose) printf("Can't read board info\n");
}else{
isConnected = true;
NChannel = BoardInfo.Channels;
channelMask = pow(2, NChannel)-1;
NRegChannel = BoardInfo.Channels;
NChannel = NRegChannel;
isChEqRegCh = true;
regChannelMask = pow(2, NChannel)-1;
switch(BoardInfo.Model){
case CAEN_DGTZ_V1730: tick2ns = 2.0; NCoupledCh = 8; break; ///ns -> 500 MSamples/s
case CAEN_DGTZ_V1725: tick2ns = 4.0; NCoupledCh = 8; break; ///ns -> 250 MSamples/s
case CAEN_DGTZ_V1740: tick2ns = 16.0; NCoupledCh = 8; break; ///ns -> 62.5 MSamples/s
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_V1740: {
NChannel = 64;
NCoupledCh = NRegChannel;
isChEqRegCh = false;
tick2ns = 16.0; break; ///ns -> 62.5 MSamples/s
}
default : tick2ns = 4.0; break;
}
@ -134,7 +144,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
case 0x8B : data->DPPTypeStr = "PHA"; break; // x730
case 0x8C : data->DPPTypeStr = "ZLE"; break; // x730
case 0x8D : data->DPPTypeStr = "DAW"; break; // x730
default : data->DPPTypeStr = "STD"; break; // stardard
default : data->DPPTypeStr = "STD"; break; // stardard
}
/// change address 0xEF08 (5 bits), this will reflected in the 2nd word of the Board Agg. header.
ret = CAEN_DGTZ_WriteRegister(handle, DPP::BoardID, (DPPType & 0xF));
@ -143,63 +153,68 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
if (DPPType < 0x80 ) {
printf("This digitizer does not have DPP-PHA firmware\n");
}else {
printf("\t==== This digitizer has a DPP firmware!\n");
printf("\e[32m\t %s \e[0m", GetDPPString().c_str());
printf("\t==== This digitizer has a DPP firmware!");
printf("\e[32m\t %s \e[0m\n", GetDPPString().c_str());
}
}
ErrorMsg("========== Set BoardID");
///======================= Check virtual probe
int probes[MAX_SUPPORTED_PROBES];
int numProbes;
ret = CAEN_DGTZ_GetDPP_SupportedVirtualProbes(handle, 1, probes, &numProbes);
ErrorMsg("=== Get Supported Virtual Probes");
if( verbose ){
printf("\t==== supported virtual probe (number of Probe : %d)\n", numProbes);
for( int i = 0 ; i < numProbes; i++){
switch (probes[i]){
case 0: printf("\t\t CAEN_DGTZ_DPP_VIRTUALPROBE_Input\n"); break;
case 1: printf("\t\t CAEN_DGTZ_DPP_VIRTUALPROBE_Delta\n"); break;
case 2: printf("\t\t CAEN_DGTZ_DPP_VIRTUALPROBE_Delta2\n"); break;
case 3: printf("\t\t CAEN_DGTZ_DPP_VIRTUALPROBE_Trapezoid\n"); break;
case 4: printf("\t\t CAEN_DGTZ_DPP_VIRTUALPROBE_TrapezoidReduced\n"); break;
case 5: printf("\t\t CAEN_DGTZ_DPP_VIRTUALPROBE_Baseline\n"); break;
case 6: printf("\t\t CAEN_DGTZ_DPP_VIRTUALPROBE_Threshold\n"); break;
case 7: printf("\t\t CAEN_DGTZ_DPP_VIRTUALPROBE_CFD\n"); break;
case 8: printf("\t\t CAEN_DGTZ_DPP_VIRTUALPROBE_SmoothedInput\n"); break;
case 9: printf("\t\t CAEN_DGTZ_DPP_VIRTUALPROBE_None\n"); break;
case 10: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_TRGWin\n"); break;
case 11: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_Armed\n"); break;
case 12: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_PkRun\n"); break;
case 13: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_Peaking\n"); break;
case 14: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_CoincWin\n"); break;
case 15: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_BLHoldoff\n"); break;
case 16: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_TRGHoldoff\n"); break;
case 17: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_TRGVal\n"); break;
case 18: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_ACQVeto\n"); break;
case 19: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_BFMVeto\n"); break;
case 20: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_ExtTRG\n"); break;
case 21: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_OverThr\n"); break;
case 22: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_TRGOut\n"); break;
case 23: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_Coincidence \n"); break;
case 24: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_PileUp \n"); break;
case 25: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_Gate \n"); break;
case 26: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_GateShort \n"); break;
case 27: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_Trigger \n"); break;
case 28: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_None \n"); break;
case 29: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_BLFreeze \n"); break;
case 30: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_Busy \n"); break;
case 31: printf("\t\t CAEN_DGTZ_DPP_DIGITALPROBE_PrgVeto \n"); break;
}
if( DPPType != DPPType::DPP_QDC_CODE ){
int probes[MAX_SUPPORTED_PROBES];
int numProbes;
ret = CAEN_DGTZ_GetDPP_SupportedVirtualProbes(handle, 1, probes, &numProbes);
ErrorMsg("=== Get Supported Virtual Probes");
if( verbose ){
printf("\t==== supported virtual probe (number of Probe : %d)\n", numProbes);
for( int i = 0 ; i < numProbes; i++){
printf("\t\t %8d ", probes[i]);
switch (probes[i]){
case 0: printf("CAEN_DGTZ_DPP_VIRTUALPROBE_Input\n" ); break;
case 1: printf("CAEN_DGTZ_DPP_VIRTUALPROBE_Delta\n" ); break;
case 2: printf("CAEN_DGTZ_DPP_VIRTUALPROBE_Delta2\n" ); break;
case 3: printf("CAEN_DGTZ_DPP_VIRTUALPROBE_Trapezoid\n" ); break;
case 4: printf("CAEN_DGTZ_DPP_VIRTUALPROBE_TrapezoidReduced\n" ); break;
case 5: printf("CAEN_DGTZ_DPP_VIRTUALPROBE_Baseline\n" ); break;
case 6: printf("CAEN_DGTZ_DPP_VIRTUALPROBE_Threshold\n" ); break;
case 7: printf("CAEN_DGTZ_DPP_VIRTUALPROBE_CFD\n" ); break;
case 8: printf("CAEN_DGTZ_DPP_VIRTUALPROBE_SmoothedInput\n" ); break;
case 9: printf("CAEN_DGTZ_DPP_VIRTUALPROBE_None\n" ); break;
case 10: printf("CAEN_DGTZ_DPP_DIGITALPROBE_TRGWin\n" ); break;
case 11: printf("CAEN_DGTZ_DPP_DIGITALPROBE_Armed\n" ); break;
case 12: printf("CAEN_DGTZ_DPP_DIGITALPROBE_PkRun\n" ); break;
case 13: printf("CAEN_DGTZ_DPP_DIGITALPROBE_Peaking\n" ); break;
case 14: printf("CAEN_DGTZ_DPP_DIGITALPROBE_CoincWin\n" ); break;
case 15: printf("CAEN_DGTZ_DPP_DIGITALPROBE_BLHoldoff\n" ); break;
case 16: printf("CAEN_DGTZ_DPP_DIGITALPROBE_TRGHoldoff\n" ); break;
case 17: printf("CAEN_DGTZ_DPP_DIGITALPROBE_TRGVal\n" ); break;
case 18: printf("CAEN_DGTZ_DPP_DIGITALPROBE_ACQVeto\n" ); break;
case 19: printf("CAEN_DGTZ_DPP_DIGITALPROBE_BFMVeto\n" ); break;
case 20: printf("CAEN_DGTZ_DPP_DIGITALPROBE_ExtTRG\n" ); break;
case 21: printf("CAEN_DGTZ_DPP_DIGITALPROBE_OverThr\n" ); break;
case 22: printf("CAEN_DGTZ_DPP_DIGITALPROBE_TRGOut\n" ); break;
case 23: printf("CAEN_DGTZ_DPP_DIGITALPROBE_Coincidence \n" ); break;
case 24: printf("CAEN_DGTZ_DPP_DIGITALPROBE_PileUp \n" ); break;
case 25: printf("CAEN_DGTZ_DPP_DIGITALPROBE_Gate \n" ); break;
case 26: printf("CAEN_DGTZ_DPP_DIGITALPROBE_GateShort \n" ); break;
case 27: printf("CAEN_DGTZ_DPP_DIGITALPROBE_Trigger \n" ); break;
case 28: printf("CAEN_DGTZ_DPP_DIGITALPROBE_None \n" ); break;
case 29: printf("CAEN_DGTZ_DPP_DIGITALPROBE_BLFreeze \n" ); break;
case 30: printf("CAEN_DGTZ_DPP_DIGITALPROBE_Busy \n" ); break;
case 31: printf("CAEN_DGTZ_DPP_DIGITALPROBE_PrgVeto \n" ); break;
default : printf("Unknown probe\n"); break;
}
}
}
}
}
ErrorMsg("end of OpenDigitizer");
if( isConnected ) isDummy = false;
if( isConnected && program) {
ProgramBoard();
if( DPPType == DPPType::DPP_PHA_CODE ) ProgramBoard_PHA();
if( DPPType == DPPType::DPP_PSD_CODE ) ProgramBoard_PSD();
if( DPPType == DPPType::DPP_QDC_CODE ) ProgramBoard_QDC();
}
//if( isConnected ) ReadAllSettingsFromBoard();
@ -220,77 +235,22 @@ int Digitizer::CloseDigitizer(){
}
void Digitizer::SetChannelMask(uint32_t mask){
void Digitizer::SetRegChannelMask(uint32_t mask){
if( !isConnected ) return;
channelMask = mask;
ret |= CAEN_DGTZ_SetChannelEnableMask(handle, channelMask);
SaveSettingToFile(DPP::ChannelEnableMask, mask);
SetSettingToMemory(DPP::ChannelEnableMask, mask);
regChannelMask = mask;
ret |= CAEN_DGTZ_SetChannelEnableMask(handle, regChannelMask);
SaveSettingToFile(DPP::RegChannelEnableMask, mask);
SetSettingToMemory(DPP::RegChannelEnableMask, mask);
ErrorMsg(__func__);
}
void Digitizer::SetChannelOnOff(unsigned short ch, bool onOff){
void Digitizer::SetRegChannelOnOff(unsigned short ch, bool onOff){
if( !isConnected ) return;
channelMask = ((channelMask & ~( 1 << ch) ) | ( onOff << ch)) ;
SetChannelMask(channelMask);
regChannelMask = ((regChannelMask & ~( 1 << ch) ) | ( onOff << ch)) ;
SetRegChannelMask(regChannelMask);
}
int Digitizer::ProgramBoard(){
printf("----- program Board\n");
ret = CAEN_DGTZ_Reset(handle);
if (ret) {
printf("ERROR: can't reset the digitizer.\n");
return -1;
}
/// Board Configuration without PHA or PSD fireware
///bx0000 0000 0000 0000 0000 0000 0001 0000 =
/// | | +- (1) trigger overlap not allowed
/// | +- (3) test pattern disable
/// + (6) Self-trigger polarity, 1 = negative, 0 = Positive
ret = CAEN_DGTZ_WriteRegister(handle, (uint32_t) BoardConfiguration , 0x000E0114); /// Channel Control Reg (indiv trg, seq readout) ??
/// Set the I/O level (CAEN_DGTZ_IOLevel_NIM or CAEN_DGTZ_IOLevel_TTL)
ret |= CAEN_DGTZ_SetIOLevel(handle, IOlev);
/// Set the enabled channels
ret |= CAEN_DGTZ_SetChannelEnableMask(handle, channelMask);
/// Set the number of samples for each waveform
ret |= CAEN_DGTZ_SetRecordLength(handle, 2000);
/// Set Extras 2 to enable, this override Accusition mode, focring list mode
ret |= CAEN_DGTZ_WriteRegister(handle, BoardConfiguration , 0x00E8114 );
/// 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
CAEN_DGTZ_DPP_AcqMode_t AcqMode = CAEN_DGTZ_DPP_ACQ_MODE_List;
ret |= CAEN_DGTZ_SetDPPAcquisitionMode(handle, AcqMode, CAEN_DGTZ_DPP_SAVE_PARAM_EnergyAndTime);
/** Set the digitizer's behaviour when an external trigger arrives:
CAEN_DGTZ_TRGMODE_DISABLED: do nothing
CAEN_DGTZ_TRGMODE_EXTOUT_ONLY: generate the Trigger Output signal
CAEN_DGTZ_TRGMODE_ACQ_ONLY = generate acquisition trigger
CAEN_DGTZ_TRGMODE_ACQ_AND_EXTOUT = generate both Trigger Output and acquisition trigger
see CAENDigitizer user manual, chapter "Trigger configuration" for details */
//TODO set bit
ret |= CAEN_DGTZ_SetExtTriggerInputMode(handle, CAEN_DGTZ_TRGMODE_ACQ_ONLY);
ret |= CAEN_DGTZ_SetRunSynchronizationMode(handle, CAEN_DGTZ_RUN_SYNC_Disabled);
/// Set how many events to accumulate in the board memory before being available for readout
ret |= CAEN_DGTZ_WriteRegister(handle, DPP::NumberEventsPerAggregate_G + 0x7000, 100);
ret |= CAEN_DGTZ_WriteRegister(handle, DPP::AggregateOrganization, 0);
ret |= CAEN_DGTZ_WriteRegister(handle, DPP::MaxAggregatePerBlockTransfer, 50);
ErrorMsg(__func__);
return ret;
}
int Digitizer::ProgramPHABoard(){
int Digitizer::ProgramBoard_PHA(){
printf("===== Digitizer::%s\n", __func__);
@ -344,7 +304,7 @@ int Digitizer::ProgramPHABoard(){
return ret;
}
int Digitizer::ProgramPSDBoard(){
int Digitizer::ProgramBoard_PSD(){
printf("===== Digitizer::%s\n", __func__);
@ -375,7 +335,7 @@ int Digitizer::ProgramPSDBoard(){
return ret;
}
int Digitizer::ProgramQDCBoard(){
int Digitizer::ProgramBoard_QDC(){
printf("===== Digitizer::%s\n", __func__);
Reset();
@ -454,7 +414,7 @@ unsigned int Digitizer::CalByteForBuffer(){
if( isConnected ){
numAggBLT = ReadRegister(DPP::MaxAggregatePerBlockTransfer, 0, false);
chMask = ReadRegister(DPP::ChannelEnableMask, 0, false);
chMask = ReadRegister(DPP::RegChannelEnableMask, 0, false);
boardCfg = ReadRegister(DPP::BoardConfiguration, 0, false);
aggOrgan = ReadRegister(DPP::AggregateOrganization, 0, false);
@ -464,7 +424,7 @@ unsigned int Digitizer::CalByteForBuffer(){
}
}else{
numAggBLT = GetSettingFromMemory(DPP::MaxAggregatePerBlockTransfer);
chMask = GetSettingFromMemory(DPP::ChannelEnableMask);
chMask = GetSettingFromMemory(DPP::RegChannelEnableMask);
boardCfg = GetSettingFromMemory(DPP::BoardConfiguration);
aggOrgan = GetSettingFromMemory(DPP::AggregateOrganization);
for( int pCh = 0; pCh < NChannel/2; pCh++){
@ -564,8 +524,10 @@ void Digitizer::WriteRegister (Reg registerAddress, uint32_t value, int ch, bool
}
}
}
ErrorMsg("WriteRegister:" + std::to_string(registerAddress));
std::stringstream ss;
ss << std::hex << registerAddress.ActualAddress(ch);
ErrorMsg("WriteRegister:0x" + ss.str()+ "(" + registerAddress.GetName() + ")");
}
uint32_t Digitizer::ReadRegister(Reg registerAddress, unsigned short ch, bool isSave2MemAndFile, std::string str ){
@ -574,11 +536,16 @@ uint32_t Digitizer::ReadRegister(Reg registerAddress, unsigned short ch, bool is
ret = CAEN_DGTZ_ReadRegister(handle, registerAddress.ActualAddress(ch), &returnData);
if( ret == 0 && isSave2MemAndFile) {
//if( ret == 0 && isSave2MemAndFile) {
if( isSave2MemAndFile) {
SetSettingToMemory(registerAddress, returnData, ch);
SaveSettingToFile(registerAddress, returnData, ch);
}
ErrorMsg("ReadRegister:" + std::to_string(registerAddress));
std::stringstream ss;
ss << std::hex << registerAddress.ActualAddress(ch);
ErrorMsg("ReadRegister:0x" + ss.str() + "(" + registerAddress.GetName() + ")");
if( str != "" ) printf("%s : 0x%04X(0x%04X) is 0x%08X \n", str.c_str(),
registerAddress.ActualAddress(ch), registerAddress.GetAddress(), returnData);
return returnData;
@ -606,27 +573,42 @@ Reg Digitizer::FindRegister(uint32_t address){
Reg tempReg;
///========= Find Match Register
for( int p = 0; p < (int) RegisterPHAPSDBoardList[p]; p++){
if( address == RegisterPHAPSDBoardList[p].GetAddress() ) {
tempReg = RegisterPHAPSDBoardList[p];
break;
if( DPPType == DPPType::DPP_PHA_CODE || DPPType == DPPType::DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterBoardList_PHAPSD[p]; p++){
if( address == RegisterBoardList_PHAPSD[p].GetAddress() ) {
tempReg = RegisterBoardList_PHAPSD[p];
break;
}
}
}
if( tempReg.GetName() == ""){
if( DPPType == V1730_DPP_PHA_CODE ){
for( int p = 0; p < (int) RegisterPHAList[p]; p++){
if( address == RegisterPHAList[p].GetAddress() ) {
tempReg = RegisterPHAList[p];
break;
if( tempReg.GetName() == ""){
if( DPPType == V1730_DPP_PHA_CODE ){
for( int p = 0; p < (int) RegisterChannelList_PHA[p]; p++){
if( address == RegisterChannelList_PHA[p].GetAddress() ) {
tempReg = RegisterChannelList_PHA[p];
break;
}
}
}
if( DPPType == V1730_DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterChannelList_PSD[p]; p++){
if( address == RegisterChannelList_PSD[p].GetAddress() ) {
tempReg = RegisterChannelList_PSD[p];
break;
}
}
}
}
if( DPPType == V1730_DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterPSDList[p]; p++){
if( address == RegisterPSDList[p].GetAddress() ) {
tempReg = RegisterPSDList[p];
break;
}
}else{
for( int p = 0; p < (int) RegisterBoardList_QDC[p]; p++){
if( address == RegisterBoardList_QDC[p].GetAddress() ) {
tempReg = RegisterBoardList_QDC[p];
break;
}
}
for( int p = 0; p < (int) RegisterChannelList_QDC[p]; p++){
if( address == RegisterChannelList_QDC[p].GetAddress() ) {
tempReg = RegisterChannelList_QDC[p];
break;
}
}
}
@ -639,31 +621,49 @@ void Digitizer::ReadAllSettingsFromBoard(bool force){
if( AcqRun ) return;
if( isSettingFilledinMemeory && !force) return;
printf("===== Digitizer::%s \n", __func__);
printf("===== Digitizer(%d)::%s \n", GetSerialNumber(), __func__);
/// board setting
for( int p = 0; p < (int) RegisterPHAPSDBoardList.size(); p++){
if( RegisterPHAPSDBoardList[p].GetRWType() == RW::WriteONLY) continue;
ReadRegister(RegisterPHAPSDBoardList[p]);
}
channelMask = GetSettingFromMemory(DPP::ChannelEnableMask);
/// Channels Setting
for( int ch = 0; ch < NChannel; ch ++){
if( DPPType == V1730_DPP_PHA_CODE ){
for( int p = 0; p < (int) RegisterPHAList.size(); p++){
if( RegisterPHAList[p].GetRWType() == RW::WriteONLY) continue;
ReadRegister(RegisterPHAList[p], ch);
if( DPPType == DPPType::DPP_PHA_CODE || DPPType == DPPType::DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterBoardList_PHAPSD.size(); p++){
if( RegisterBoardList_PHAPSD[p].GetRWType() == RW::WriteONLY) continue;
ReadRegister(RegisterBoardList_PHAPSD[p]);
}
regChannelMask = GetSettingFromMemory(DPP::RegChannelEnableMask);
/// Channels Setting
for( int ch = 0; ch < NChannel; 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;
ReadRegister(RegisterChannelList_PHA[p], ch);
}
}
if( DPPType == V1730_DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterChannelList_PSD.size(); p++){
if( RegisterChannelList_PSD[p].GetRWType() == RW::WriteONLY) continue;
ReadRegister(RegisterChannelList_PSD[p], ch);
}
}
}
if( DPPType == V1730_DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterPSDList.size(); p++){
if( RegisterPSDList[p].GetRWType() == RW::WriteONLY) continue;
ReadRegister(RegisterPSDList[p], ch);
}else{
for( int p = 0; p < (int) RegisterBoardList_QDC.size(); p++){
if( RegisterBoardList_QDC[p].GetRWType() == RW::WriteONLY) continue;
ReadRegister(RegisterBoardList_QDC[p]);
}
regChannelMask = GetSettingFromMemory(DPP::QDC::GroupEnableMask);
for( int ch = 0; ch < GetRegChannels(); ch ++){
for( int p = 0; p < (int) RegisterChannelList_QDC.size(); p++){
if( RegisterChannelList_QDC[p].GetRWType() == RW::WriteONLY) continue;
ReadRegister(RegisterChannelList_QDC[p], ch);
}
}
}
isSettingFilledinMemeory = true;
}
@ -675,34 +675,58 @@ void Digitizer::ProgramSettingsToBoard(){
Reg haha;
/// board setting
for( int p = 0; p < (int) RegisterPHAPSDBoardList.size(); p++){
if( RegisterPHAPSDBoardList[p].GetRWType() == RW::ReadWrite) {
haha = RegisterPHAPSDBoardList[p];
WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
usleep(1 * 1000);
if( DPPType == DPPType::DPP_PHA_CODE || DPPType == DPPType::DPP_PSD_CODE ){
/// board setting
for( int p = 0; p < (int) RegisterBoardList_PHAPSD.size(); p++){
if( RegisterBoardList_PHAPSD[p].GetRWType() == RW::ReadWrite) {
haha = RegisterBoardList_PHAPSD[p];
WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
usleep(1 * 1000);
}
}
}
/// Channels Setting
for( int ch = 0; ch < NChannel; ch ++){
if( DPPType == V1730_DPP_PHA_CODE ){
for( int p = 0; p < (int) RegisterPHAList.size(); p++){
if( RegisterPHAList[p].GetRWType() == RW::ReadWrite ){
haha = RegisterPHAList[p];
WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false);
usleep(1 * 1000);
}
}
}
if( DPPType == V1730_DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterPSDList.size(); p++){
if( RegisterPSDList[p].GetRWType() == RW::ReadWrite){
haha = RegisterPSDList[p];
/// Channels Setting
for( int ch = 0; ch < NChannel; ch ++){
if( DPPType == V1730_DPP_PHA_CODE ){
for( int p = 0; p < (int) RegisterChannelList_PHA.size(); p++){
if( RegisterChannelList_PHA[p].GetRWType() == RW::ReadWrite ){
haha = RegisterChannelList_PHA[p];
WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false);
usleep(1 * 1000);
}
}
}
if( DPPType == V1730_DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterChannelList_PSD.size(); p++){
if( RegisterChannelList_PSD[p].GetRWType() == RW::ReadWrite){
haha = RegisterChannelList_PSD[p];
WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false);
usleep(1 * 1000);
}
}
}
}
}else{
/// board setting
for( int p = 0; p < (int) RegisterBoardList_QDC.size(); p++){
if( RegisterBoardList_QDC[p].GetRWType() == RW::ReadWrite) {
haha = RegisterBoardList_QDC[p];
WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
usleep(1 * 1000);
}
}
/// Channels Setting
for( int ch = 0; ch < GetRegChannels(); ch ++){
for( int p = 0; p < (int) RegisterChannelList_QDC.size(); p++){
if( RegisterChannelList_QDC[p].GetRWType() == RW::ReadWrite ){
haha = RegisterChannelList_QDC[p];
WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false);
usleep(1 * 1000);
}
}
}
}
}
@ -852,19 +876,33 @@ void Digitizer::SaveAllSettingsAsText(std::string fileName){
haha.SetName("");
uint32_t actualAddress = haha.CalAddress(i);
///printf("%7d--- 0x%04X, 0x%04X\n", i, haha->GetAddress(), haha->ActualAddress());
for( int p = 0; p < (int) RegisterPHAPSDBoardList.size(); p++){
if( haha.GetAddress() == (uint32_t) RegisterPHAPSDBoardList[p] ) haha = RegisterPHAPSDBoardList[p];
}
if( DPPType == V1730_DPP_PHA_CODE) {
for( int p = 0; p < (int) RegisterPHAList.size(); p++){
if( haha.GetAddress() == (uint32_t) RegisterPHAList[p] ) haha = RegisterPHAList[p];
if ( DPPType == V1730_DPP_PHA_CODE || DPPType == V1730_DPP_PSD_CODE ){
///printf("%7d--- 0x%04X, 0x%04X\n", i, haha->GetAddress(), haha->ActualAddress());
for( int p = 0; p < (int) RegisterBoardList_PHAPSD.size(); p++){
if( haha.GetAddress() == (uint32_t) RegisterBoardList_PHAPSD[p] ) haha = RegisterBoardList_PHAPSD[p];
}
}
if( DPPType == V1730_DPP_PSD_CODE) {
for( int p = 0; p < (int) RegisterPSDList.size(); p++){
if( haha.GetAddress() == (uint32_t) RegisterPSDList[p] ) haha = RegisterPSDList[p];
if( DPPType == V1730_DPP_PHA_CODE) {
for( int p = 0; p < (int) RegisterChannelList_PHA.size(); p++){
if( haha.GetAddress() == (uint32_t) RegisterChannelList_PHA[p] ) haha = RegisterChannelList_PHA[p];
}
}
if( DPPType == V1730_DPP_PSD_CODE) {
for( int p = 0; p < (int) RegisterChannelList_PSD.size(); p++){
if( haha.GetAddress() == (uint32_t) RegisterChannelList_PSD[p] ) haha = RegisterChannelList_PSD[p];
}
}
}else{
for( int p = 0; p < (int) RegisterBoardList_QDC.size(); p++){
if( haha.GetAddress() == (uint32_t) RegisterBoardList_QDC[p] ) haha = RegisterBoardList_QDC[p];
}
for( int p = 0; p < (int) RegisterChannelList_QDC.size(); p++){
if( haha.GetAddress() == (uint32_t) RegisterChannelList_QDC[p] ) haha = RegisterChannelList_QDC[p];
}
}
if( haha.GetName() != "" ) {
std::string typeStr ;
@ -902,40 +940,40 @@ std::string Digitizer::GetDPPString(int DPPType){
void Digitizer::ErrorMsg(std::string header){
switch (ret){
///case CAEN_DGTZ_Success : /** 0 */ printf("%s | Operation completed successfully.\n", header.c_str()); break;
case CAEN_DGTZ_CommError : /** -1 */ printf("%s %d | Communication Error.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_GenericError : /** -2 */ printf("%s %d | Unspecified error.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_InvalidParam : /** -3 */ printf("%s %d | Invalid parameter.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_InvalidLinkType : /** -4 */ printf("%s %d | Invalid Link Type.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_InvalidHandle : /** -5 */ printf("%s %d | Invalid device handler.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_MaxDevicesError : /** -6 */ printf("%s %d | Maximum number of devices exceeded.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_BadBoardType : /** -7 */ printf("%s %d | Operation not allowed on this type of board.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_BadInterruptLev : /** -8 */ printf("%s %d | The interrupt level is not allowed.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_BadEventNumber : /** -9 */ printf("%s %d | The event number is bad.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_ReadDeviceRegisterFail : /** -10 */ printf("%s %d | Unable to read the registry.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_WriteDeviceRegisterFail : /** -11 */ printf("%s %d | Unable to write the registry.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_InvalidChannelNumber : /** -13 */ printf("%s %d | The channel number is invalid.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_ChannelBusy : /** -14 */ printf("%s %d | The channel is busy.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_FPIOModeInvalid : /** -15 */ printf("%s %d | Invalid FPIO mode.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_WrongAcqMode : /** -16 */ printf("%s %d | Wrong Acquistion mode.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_FunctionNotAllowed : /** -17 */ printf("%s %d | This function is not allowed on this module.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_Timeout : /** -18 */ printf("%s %d | Communication Timeout.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_InvalidBuffer : /** -19 */ printf("%s %d | The buffer is invalid.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_EventNotFound : /** -20 */ printf("%s %d | The event is not found.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_InvalidEvent : /** -21 */ printf("%s %d | The event is invalid.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_OutOfMemory : /** -22 */ printf("%s %d | Out of memory.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_CalibrationError : /** -23 */ printf("%s %d | Unable to calibrate the board.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_DigitizerNotFound : /** -24 */ printf("%s %d | Unbale to open the digitizer.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_DigitizerAlreadyOpen : /** -25 */ printf("%s %d | The digitizer is already open.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_DigitizerNotReady : /** -26 */ printf("%s %d | The digitizer is not ready.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_InterruptNotConfigured : /** -27 */ printf("%s %d | The digitizer has no IRQ configured.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_DigitizerMemoryCorrupted: /** -28 */ printf("%s %d | The digitizer flash memory is corrupted.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_DPPFirmwareNotSupported : /** -29 */ printf("%s %d | The digitier DPP firmware is not supported in this lib version.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_InvalidLicense : /** -30 */ printf("%s %d | Invalid firmware licence.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_InvalidDigitizerStatus : /** -31 */ printf("%s %d | The digitizer is found in a corrupted status.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_UnsupportedTrace : /** -32 */ printf("%s %d | The given trace is not supported.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_InvalidProbe : /** -33 */ printf("%s %d | The given probe is not supported.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_UnsupportedBaseAddress : /** -34 */ printf("%s %d | The base address is not supported.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_NotYetImplemented : /** -99 */ printf("%s %d | The function is not yet implemented.\n", header.c_str(), BoardInfo.SerialNumber); break;
case CAEN_DGTZ_CommError : /** -1 */ printf("%s %d | %d, Communication Error.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_GenericError : /** -2 */ printf("%s %d | %d, Unspecified error.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidParam : /** -3 */ printf("%s %d | %d, Invalid parameter.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidLinkType : /** -4 */ printf("%s %d | %d, Invalid Link Type.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidHandle : /** -5 */ printf("%s %d | %d, Invalid device handler.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_MaxDevicesError : /** -6 */ printf("%s %d | %d, Maximum number of devices exceeded.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_BadBoardType : /** -7 */ printf("%s %d | %d, Operation not allowed on this type of board.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_BadInterruptLev : /** -8 */ printf("%s %d | %d, The interrupt level is not allowed.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_BadEventNumber : /** -9 */ printf("%s %d | %d, The event number is bad.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_ReadDeviceRegisterFail : /** -10 */ printf("%s %d | %d, Unable to read the registry.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_WriteDeviceRegisterFail : /** -11 */ printf("%s %d | %d, Unable to write the registry.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidChannelNumber : /** -13 */ printf("%s %d | %d, The channel number is invalid.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_ChannelBusy : /** -14 */ printf("%s %d | %d, The channel is busy.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_FPIOModeInvalid : /** -15 */ printf("%s %d | %d, Invalid FPIO mode.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_WrongAcqMode : /** -16 */ printf("%s %d | %d, Wrong Acquistion mode.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_FunctionNotAllowed : /** -17 */ printf("%s %d | %d, This function is not allowed on this module.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_Timeout : /** -18 */ printf("%s %d | %d, Communication Timeout.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidBuffer : /** -19 */ printf("%s %d | %d, The buffer is invalid.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_EventNotFound : /** -20 */ printf("%s %d | %d, The event is not found.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidEvent : /** -21 */ printf("%s %d | %d, The event is invalid.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_OutOfMemory : /** -22 */ printf("%s %d | %d, Out of memory.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_CalibrationError : /** -23 */ printf("%s %d | %d, Unable to calibrate the board.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerNotFound : /** -24 */ printf("%s %d | %d, Unbale to open the digitizer.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerAlreadyOpen : /** -25 */ printf("%s %d | %d, The digitizer is already open.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerNotReady : /** -26 */ printf("%s %d | %d, The digitizer is not ready.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InterruptNotConfigured : /** -27 */ printf("%s %d | %d, The digitizer has no IRQ configured.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerMemoryCorrupted: /** -28 */ printf("%s %d | %d, The digitizer flash memory is corrupted.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DPPFirmwareNotSupported : /** -29 */ printf("%s %d | %d, The digitier DPP firmware is not supported in this lib version.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidLicense : /** -30 */ printf("%s %d | %d, Invalid firmware licence.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidDigitizerStatus : /** -31 */ printf("%s %d | %d, The digitizer is found in a corrupted status.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_UnsupportedTrace : /** -32 */ printf("%s %d | %d, The given trace is not supported.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidProbe : /** -33 */ printf("%s %d | %d, The given probe is not supported.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_UnsupportedBaseAddress : /** -34 */ printf("%s %d | %d, The base address is not supported.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_NotYetImplemented : /** -99 */ printf("%s %d | %d, The function is not yet implemented.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
}
}

View File

@ -27,7 +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 channel
int NChannel; /// number of physical input channel
int NRegChannel; /// number of Register channel
bool isChEqRegCh; /// is number of physical input channel = Register channel
int NCoupledCh; /// number of Coupled channel
int ADCbits; /// ADC bit
int DPPType; /// DPP verion
@ -36,7 +38,7 @@ class Digitizer{
CAEN_DGTZ_BoardInfo_t BoardInfo;
//^----- adjustable parameters
uint32_t channelMask ; /// the channel mask from NChannel
uint32_t regChannelMask ; /// the channel mask from NChannel
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)
@ -67,8 +69,8 @@ class Digitizer{
//^------ portID is for optical link for using PCIe card, from 0, 1, 2, 3
int OpenDigitizer(int boardID, int portID = 0, bool program = false, bool verbose = false);
void SetDPPType (int type) { this->DPPType = type;} /// for manual override, or, digitizer does not open
void SetChannelMask (uint32_t mask);
void SetChannelOnOff (unsigned short ch, bool onOff);
void SetRegChannelMask (uint32_t mask);
void SetRegChannelOnOff (unsigned short ch, bool onOff);
int CloseDigitizer();
void Initalization();
void Reset();
@ -76,10 +78,9 @@ class Digitizer{
bool IsConnected() {return isConnected;}
void PrintBoard() ;
virtual int ProgramBoard() ; /// program a generic board, no program channel
int ProgramPHABoard() ; /// program a default PHA board with dual trace
int ProgramPSDBoard() ;
int ProgramQDCBoard() ;
int ProgramBoard_PHA() ; /// program a default PHA board with dual trace
int ProgramBoard_PSD() ;
int ProgramBoard_QDC() ;
//^================ ACQ control
void StopACQ();
@ -105,12 +106,13 @@ 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() { channelMask = GetSettingFromMemory(DPP::ChannelEnableMask); return channelMask;}
bool GetChannelOnOff(unsigned ch) { channelMask = GetSettingFromMemory(DPP::ChannelEnableMask); return (channelMask & ( 1 << ch) );}
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 DPPType == DPPType::DPP_QDC_CODE ? NCoupledCh : NChannel;}
int GetNCoupledCh() const {return NCoupledCh;}
int GetRegChannels() const {return NRegChannel;}
bool IsChEqRegCh() const {return isChEqRegCh;}
int GetCoupledChannels() const {return NCoupledCh;}
int GetHandle() const {return handle;}
int GetDPPType() const {return DPPType;}
std::string GetDPPString(int DPPType = 0); /// if no input, use digitizer DPPType

View File

@ -9,7 +9,7 @@ This can be loaded to root and run the DataReader()
void DataReader(std::string fileName, int DPPType){
Data * data = new Data();
Data * data = new Data(64);
data->DPPType = DPPType;
FILE * haha = fopen(fileName.c_str(), "r");

View File

@ -184,8 +184,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
bnProgramPreDefined = new QPushButton("Program Default", this);
buttonLayout->addWidget(bnProgramPreDefined, rowID, 1);
connect(bnProgramPreDefined, &QPushButton::clicked, this, [=](){
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) digi[ID]->ProgramPHABoard();
if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) digi[ID]->ProgramPSDBoard();
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) digi[ID]->ProgramBoard_PHA();
if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) digi[ID]->ProgramBoard_PSD();
usleep(1000*500); // wait for 0.2 sec
@ -595,7 +595,7 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
int coupledNum = 2;
if( digi[ID]->GetDPPType() == DPPType::DPP_QDC_CODE ) coupledNum = 8;
for( int i = 0; i < digi[ID]->GetNCoupledCh(); i++){
for( int i = 0; i < digi[ID]->GetCoupledChannels(); i++){
if( i % 2 == 0 ){
QLabel * chIDLabel = new QLabel(QString::number(coupledNum*i) + "-" + QString::number(coupledNum*(i+1) - 1), this);
@ -780,10 +780,10 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
QLabel * info = new QLabel ("Each Row define the trigger requested by other coupled channels.", this);
bdTriggerLayout[ID]->addWidget(info, 0, 0, 1, 13 );
for( int i = 0; i < digi[ID]->GetNCoupledCh() ; i++){
for( int i = 0; i < digi[ID]->GetCoupledChannels() ; i++){
if( i == 0 ) {
for( int j = 0; j < digi[ID]->GetNCoupledCh(); j++) {
for( int j = 0; j < digi[ID]->GetCoupledChannels(); j++) {
QLabel * lb0 = new QLabel(QString::number(2*j) + "-" + QString::number(2*j+1), this);
lb0->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
bdTriggerLayout[ID]->addWidget(lb0, 1, j + 1 );
@ -791,26 +791,26 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
QLabel * lb1 = new QLabel("Logic", this);
lb1->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
bdTriggerLayout[ID]->addWidget(lb1, 1, digi[ID]->GetNCoupledCh() + 1 );
bdTriggerLayout[ID]->addWidget(lb1, 1, digi[ID]->GetCoupledChannels() + 1 );
QLabel * lb2 = new QLabel("Maj. Lvl.", this);
lb2->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
bdTriggerLayout[ID]->addWidget(lb2, 1, digi[ID]->GetNCoupledCh() + 2 );
bdTriggerLayout[ID]->addWidget(lb2, 1, digi[ID]->GetCoupledChannels() + 2 );
QLabel * lb3 = new QLabel("Ext.", this);
lb3->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
bdTriggerLayout[ID]->addWidget(lb3, 1, digi[ID]->GetNCoupledCh() + 3 );
bdTriggerLayout[ID]->addWidget(lb3, 1, digi[ID]->GetCoupledChannels() + 3 );
QLabel * lb4 = new QLabel("SW", this);
lb4->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
bdTriggerLayout[ID]->addWidget(lb4, 1, digi[ID]->GetNCoupledCh() + 4 );
bdTriggerLayout[ID]->addWidget(lb4, 1, digi[ID]->GetCoupledChannels() + 4 );
}
QLabel * lbCh = new QLabel(QString::number(2*i) + "-" + QString::number(2*i+1), this);
lbCh->setAlignment(Qt::AlignCenter | Qt::AlignRight);
bdTriggerLayout[ID]->addWidget(lbCh, i + 2, 0 );
for( int j = 0; j < digi[ID]->GetNCoupledCh(); j++){
for( int j = 0; j < digi[ID]->GetCoupledChannels(); j++){
bnTriggerMask[ID][i][j] = new QPushButton(this);
bdTriggerLayout[ID]->addWidget(bnTriggerMask[ID][i][j] , i + 2, j + 1 );
@ -831,7 +831,7 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
cbMaskLogic[ID][i]->addItem("OR", 0);
cbMaskLogic[ID][i]->addItem("AND", 1);
cbMaskLogic[ID][i]->addItem("Maj.", 2);
bdTriggerLayout[ID]->addWidget(cbMaskLogic[ID][i], i + 2, digi[ID]->GetNCoupledCh() + 1);
bdTriggerLayout[ID]->addWidget(cbMaskLogic[ID][i], i + 2, digi[ID]->GetCoupledChannels() + 1);
connect(cbMaskLogic[ID][i], &RComboBox::currentIndexChanged, this, [=](int index){
if( !enableSignalSlot) return;
digi[ID]->SetBits(DPP::TriggerValidationMask_G, {2, 8}, index, 2*i);
@ -844,7 +844,7 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
sbMaskMajorLevel[ID][i]->setMaximum(7);
sbMaskMajorLevel[ID][i]->setSingleStep(1);
sbMaskMajorLevel[ID][i]->setEnabled(false);
bdTriggerLayout[ID]->addWidget(sbMaskMajorLevel[ID][i], i + 2, digi[ID]->GetNCoupledCh() + 2);
bdTriggerLayout[ID]->addWidget(sbMaskMajorLevel[ID][i], i + 2, digi[ID]->GetCoupledChannels() + 2);
connect(sbMaskMajorLevel[ID][i], &RSpinBox::valueChanged, this, [=](){
if( !enableSignalSlot ) return;
sbMaskMajorLevel[ID][i]->setStyleSheet("color : blue;");
@ -857,7 +857,7 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
chkMaskExtTrigger[ID][i] = new QCheckBox("",this);
chkMaskExtTrigger[ID][i]->setLayoutDirection(Qt::RightToLeft);
bdTriggerLayout[ID]->addWidget(chkMaskExtTrigger[ID][i], i + 2, digi[ID]->GetNCoupledCh() + 3);
bdTriggerLayout[ID]->addWidget(chkMaskExtTrigger[ID][i], i + 2, digi[ID]->GetCoupledChannels() + 3);
connect(chkMaskExtTrigger[ID][i], &QCheckBox::stateChanged, this, [=](int state){
if( !enableSignalSlot ) return;
digi[ID]->SetBits(DPP::TriggerValidationMask_G, {1, 30} , state ? 1 : 0 , 2*i);
@ -865,7 +865,7 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
chkMaskSWTrigger[ID][i] = new QCheckBox("",this);
chkMaskSWTrigger[ID][i]->setLayoutDirection(Qt::RightToLeft);
bdTriggerLayout[ID]->addWidget(chkMaskSWTrigger[ID][i], i + 2, digi[ID]->GetNCoupledCh() + 4);
bdTriggerLayout[ID]->addWidget(chkMaskSWTrigger[ID][i], i + 2, digi[ID]->GetCoupledChannels() + 4);
connect(chkMaskSWTrigger[ID][i], &QCheckBox::stateChanged, this, [=](int state){
if( !enableSignalSlot ) return;
digi[ID]->SetBits(DPP::TriggerValidationMask_G, {1, 31} , state ? 1 : 0 , 2*i);
@ -904,8 +904,8 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
RComboBox * cbBdReg = new RComboBox(inquiryBox);
cbBdReg->setFixedWidth(300);
for( int i = 0; i < (int) RegisterPHAPSDBoardList.size() ; i++ ){
cbBdReg->addItem( QString::fromStdString(RegisterPHAPSDBoardList[i].GetName()) + " [0x" + QString::number(RegisterPHAPSDBoardList[i].GetAddress(), 16).toUpper() + "]", RegisterPHAPSDBoardList[i].GetAddress());
for( int i = 0; i < (int) RegisterBoardList_PHAPSD.size() ; i++ ){
cbBdReg->addItem( QString::fromStdString(RegisterBoardList_PHAPSD[i].GetName()) + " [0x" + QString::number(RegisterBoardList_PHAPSD[i].GetAddress(), 16).toUpper() + "]", RegisterBoardList_PHAPSD[i].GetAddress());
}
regLayout->addWidget(cbBdReg, 1, 1);
@ -952,8 +952,8 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
cbCh->clear();
for( int i = 0; i < digi[index]->GetNChannels(); i ++ ) cbCh->addItem("Ch-" + QString::number(i), i);
if( digi[index]->GetDPPType() == V1730_DPP_PHA_CODE ) chRegList = RegisterPHAList;
if( digi[index]->GetDPPType() == V1730_DPP_PSD_CODE ) chRegList = RegisterPSDList;
if( digi[index]->GetDPPType() == V1730_DPP_PHA_CODE ) chRegList = RegisterChannelList_PHA;
if( digi[index]->GetDPPType() == V1730_DPP_PSD_CODE ) chRegList = RegisterChannelList_PSD;
cbChReg->clear();
for( int i = 0; i < (int) chRegList.size(); i++ ){
@ -967,23 +967,23 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
connect(cbBdReg, &RComboBox::currentIndexChanged, this, [=](int index){
if( !enableSignalSlot ) return;
if( RegisterPHAPSDBoardList[index].GetRWType() == RW::WriteONLY ) {
if( RegisterBoardList_PHAPSD[index].GetRWType() == RW::WriteONLY ) {
leBdRegRW->setText("Write ONLY" );
leBdRegValue->setText("");
leBdRegSet->setEnabled(true);
return;
}
uint32_t value = digi[ cbDigi->currentIndex() ] ->ReadRegister(RegisterPHAPSDBoardList[index]);
uint32_t value = digi[ cbDigi->currentIndex() ] ->ReadRegister(RegisterBoardList_PHAPSD[index]);
leBdRegValue->setText( "0x" + QString::number(value, 16).toUpper());
if( RegisterPHAPSDBoardList[index].GetRWType() == RW::ReadONLY ) {
if( RegisterBoardList_PHAPSD[index].GetRWType() == RW::ReadONLY ) {
leBdRegRW->setText("Read ONLY" );
leBdRegSet->setEnabled(false);
return;
}
if( RegisterPHAPSDBoardList[index].GetRWType() == RW::ReadWrite ) {
if( RegisterBoardList_PHAPSD[index].GetRWType() == RW::ReadWrite ) {
leBdRegRW->setText("Read/Write" );
leBdRegSet->setEnabled(true);
}
@ -1037,7 +1037,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
uint32_t value = std::stoul(text.toStdString(), nullptr, 16);
int index = cbDigi->currentIndex();
int regID = cbBdReg->currentIndex();
digi[index]->WriteRegister(RegisterPHAPSDBoardList[regID], value);
digi[index]->WriteRegister(RegisterBoardList_PHAPSD[regID], value);
leBdRegSet->setStyleSheet("");
cbBdReg->currentIndexChanged(regID);
@ -1149,15 +1149,15 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
SendLogMsg("Copy Settings from DIG:" + QString::number(digi[fromIndex]->GetSerialNumber()) + " to DIG:" + QString::number(digi[toIndex]->GetSerialNumber()));
//Copy Board Setting
for( int i = 0; i < (int) RegisterPHAPSDBoardList.size(); i++){
if( RegisterPHAPSDBoardList[i].GetRWType() != RW::WriteONLY ) continue;
uint32_t value = digi[fromIndex]->GetSettingFromMemory(RegisterPHAPSDBoardList[i]);
digi[toIndex]->WriteRegister(RegisterPHAPSDBoardList[i], value);
for( int i = 0; i < (int) RegisterBoardList_PHAPSD.size(); i++){
if( RegisterBoardList_PHAPSD[i].GetRWType() != RW::WriteONLY ) continue;
uint32_t value = digi[fromIndex]->GetSettingFromMemory(RegisterBoardList_PHAPSD[i]);
digi[toIndex]->WriteRegister(RegisterBoardList_PHAPSD[i], value);
}
std::vector<Reg> regList;
if( digi[fromIndex]->GetDPPType() == V1730_DPP_PHA_CODE ) regList = RegisterPHAList;
if( digi[fromIndex]->GetDPPType() == V1730_DPP_PSD_CODE ) regList = RegisterPSDList;
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++){
//Copy setting
@ -1181,8 +1181,8 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
int toIndex = cbToBoard->currentIndex();
std::vector<Reg> regList;
if( digi[fromIndex]->GetDPPType() == V1730_DPP_PHA_CODE ) regList = RegisterPHAList;
if( digi[fromIndex]->GetDPPType() == V1730_DPP_PSD_CODE ) regList = RegisterPSDList;
if( digi[fromIndex]->GetDPPType() == V1730_DPP_PHA_CODE ) regList = RegisterChannelList_PHA;
if( digi[fromIndex]->GetDPPType() == V1730_DPP_PSD_CODE ) regList = RegisterChannelList_PSD;
int fromCh = -1;
for( int i = 0; i < MaxRegChannel; i++) {
@ -1228,7 +1228,7 @@ void DigiSettingsPanel::SetUpChannelMask(unsigned int digiID){
chLayout->setSpacing(0);
int nChGrp = digi[digiID]->GetRegChannels();
if( digi[digiID]->GetDPPType() == DPPType::DPP_QDC_CODE ) nChGrp = digi[digiID]->GetNCoupledCh();
if( digi[digiID]->GetDPPType() == DPPType::DPP_QDC_CODE ) nChGrp = digi[digiID]->GetRegChannels();
for( int i = 0; i < nChGrp; i++){
bnChEnableMask[digiID][i] = new QPushButton(this);
@ -1249,14 +1249,14 @@ void DigiSettingsPanel::SetUpChannelMask(unsigned int digiID){
if( digi[digiID]->GetDPPType() == DPPType::DPP_QDC_CODE ){
digi[digiID]->SetBits(DPP::QDC::GroupEnableMask, {1, i}, 1, i);
}else{
digi[digiID]->SetBits(DPP::ChannelEnableMask, {1, i}, 1, i);
digi[digiID]->SetBits(DPP::RegChannelEnableMask, {1, i}, 1, i);
}
}else{
bnChEnableMask[digiID][i]->setStyleSheet("");
if( digi[digiID]->GetDPPType() == DPPType::DPP_QDC_CODE ){
digi[digiID]->SetBits(DPP::QDC::GroupEnableMask, {1, i}, 0, i);
}else{
digi[digiID]->SetBits(DPP::ChannelEnableMask, {1, i}, 0, i);
digi[digiID]->SetBits(DPP::RegChannelEnableMask, {1, i}, 0, i);
}
}
@ -2410,7 +2410,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
QHBoxLayout * papa = new QHBoxLayout(jaja);
papa->setAlignment(Qt::AlignLeft);
const unsigned short numGroup = digi[ID]->GetNCoupledCh();
const unsigned short numGroup = digi[ID]->GetRegChannels();
{//^============================== Group selection
QLabel * lbChSel = new QLabel ("Group : ", this);
@ -2434,13 +2434,13 @@ 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_G);
SetUpSpinBox(sbDCOffset[ID][numGroup], "DC Offset [%] : ", inputLayout, 2, 0, DPP::QDC::DCOffset_G);
SetUpComboBoxBit(cbPolarity[ID][numGroup], "Polarity : ", inputLayout, 2, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListPolarity, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::Polarity);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][numGroup], "Input Smoothing : ", inputLayout, 3, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor);
SetUpSpinBox(sbPreTrigger[ID][numGroup], "Pre-Trigger [ns] : ", inputLayout, 1, 0, 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);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][numGroup], "Input Smoothing : ", inputLayout, 3, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor);
SetUpSpinBox(sbFixedBaseline[ID][numGroup], "Fixed Baseline : ", inputLayout, 4, 0, DPP::QDC::FixedBaseline_G);
SetUpComboBoxBit(cbBaseLineAvg[ID][numGroup], "Baseline Avg. : ", inputLayout, 4, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListBaselineAvg, DPP::QDC::DPPAlgorithmControl_G, 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);
connect(cbBaseLineAvg[ID][numGroup], &RComboBox::currentIndexChanged, this, [=](){
sbFixedBaseline[ID][numGroup]->setEnabled( cbBaseLineAvg[ID][numGroup]->currentData().toInt() == 0);
@ -2487,9 +2487,9 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
//TODO, that will overwrite other subCh
if( i < 4 ){
digi[ID]->WriteRegister(DPP::QDC::DCOffset_LowCh_G, value, grpID);
digi[ID]->WriteRegister(DPP::QDC::DCOffset_LowCh, value, grpID);
}else{
digi[ID]->WriteRegister(DPP::QDC::DCOffset_HighCh_G, value, grpID);
digi[ID]->WriteRegister(DPP::QDC::DCOffset_HighCh, value, grpID);
}
UpdatePanelFromMemory();
@ -2509,11 +2509,11 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
QGridLayout * triggerLayout = new QGridLayout(triggerBox);
triggerLayout->setSpacing(2);
SetUpComboBoxBit(cbTrigMode[ID][numGroup], "Trig. Mode : ", triggerLayout, 1, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListTrigMode, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::TriggerMode);
SetUpCheckBox(chkDisableSelfTrigger[ID][numGroup], "Disable Self Trigger ", triggerLayout, 2, 0, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::DisableSelfTrigger);
SetUpCheckBox(chkDisableTriggerHysteresis[ID][numGroup], "Disbale Trig. Hysteresis ", triggerLayout, 3, 0, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::DisableTriggerHysteresis, -1, 2);
SetUpSpinBox(sbTriggerHoldOff[ID][numGroup], "Trig. Holdoff [ns] : ", triggerLayout, 4, 0, DPP::QDC::TriggerHoldOffWidth_G);
SetUpSpinBox(sbShapedTrigWidth[ID][numGroup], "Trig. Out Width [ns] : ", triggerLayout, 5, 0, DPP::QDC::TRGOUTWidth_G);
SetUpComboBoxBit(cbTrigMode[ID][numGroup], "Trig. Mode : ", triggerLayout, 1, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListTrigMode, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::TriggerMode);
SetUpCheckBox(chkDisableSelfTrigger[ID][numGroup], "Disable Self Trigger ", triggerLayout, 2, 0, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::DisableSelfTrigger);
SetUpCheckBox(chkDisableTriggerHysteresis[ID][numGroup], "Disbale Trig. Hysteresis ", triggerLayout, 3, 0, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::DisableTriggerHysteresis, -1, 2);
SetUpSpinBox(sbTriggerHoldOff[ID][numGroup], "Trig. Holdoff [ns] : ", triggerLayout, 4, 0, DPP::QDC::TriggerHoldOffWidth);
SetUpSpinBox(sbShapedTrigWidth[ID][numGroup], "Trig. Out Width [ns] : ", triggerLayout, 5, 0, DPP::QDC::TRGOUTWidth);
/// Trigger Threshold
QWidget * widget = new QWidget(triggerBox);
@ -2552,14 +2552,14 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
sbSubChThreshold[ID][8][i]->setStyleSheet("");
switch(i){
case 0: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_G_sub0, value, grpID); break;
case 1: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_G_sub1, value, grpID); break;
case 2: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_G_sub2, value, grpID); break;
case 3: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_G_sub3, value, grpID); break;
case 4: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_G_sub4, value, grpID); break;
case 5: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_G_sub5, value, grpID); break;
case 6: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_G_sub6, value, grpID); break;
case 7: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_G_sub7, value, grpID); break;
case 0: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_sub0, value, grpID); break;
case 1: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_sub1, value, grpID); break;
case 2: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_sub2, value, grpID); break;
case 3: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_sub3, value, grpID); break;
case 4: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_sub4, value, grpID); break;
case 5: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_sub5, value, grpID); break;
case 6: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_sub6, value, grpID); break;
case 7: digi[ID]->WriteRegister(DPP::QDC::TriggerThreshold_sub7, value, grpID); break;
}
UpdatePanelFromMemory();
@ -2579,13 +2579,13 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
qdcLayout->setSpacing(2);
SetUpSpinBox(sbShortGate[ID][numGroup], "Gate Width [ns] : ", qdcLayout, 5, 0, DPP::QDC::GateWidth_G);
SetUpSpinBox(sbGateOffset[ID][numGroup], "Gate Offset [ns] : ", qdcLayout, 6, 0, DPP::QDC::GateOffset_G);
SetUpSpinBox(sbShortGate[ID][numGroup], "Gate Width [ns] : ", qdcLayout, 5, 0, DPP::QDC::GateWidth);
SetUpSpinBox(sbGateOffset[ID][numGroup], "Gate Offset [ns] : ", qdcLayout, 6, 0, DPP::QDC::GateOffset);
SetUpCheckBox(chkOverthreshold[ID][numGroup], "Enable OverThreshold Width ", qdcLayout, 9, 0, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::OverThresholdWitdhEnable);
SetUpSpinBox(sbOverThresholdWidth[ID][numGroup], "OverThreshold Width [ns] : ", qdcLayout, 9, 2, DPP::QDC::OverThresholdWidth_G);
SetUpCheckBox(chkOverthreshold[ID][numGroup], "Enable OverThreshold Width ", qdcLayout, 9, 0, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::OverThresholdWitdhEnable);
SetUpSpinBox(sbOverThresholdWidth[ID][numGroup], "OverThreshold Width [ns] : ", qdcLayout, 9, 2, DPP::QDC::OverThresholdWidth);
SetUpComboBoxBit(cbChargeSensitivity[ID][numGroup], "Charge Sen. : ", qdcLayout, 10, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListChargeSensitivity, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::ChargeSensitivity);
SetUpComboBoxBit(cbChargeSensitivity[ID][numGroup], "Charge Sen. : ", qdcLayout, 10, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListChargeSensitivity, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::ChargeSensitivity);
}
@ -2596,8 +2596,8 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
QGridLayout * otherLayout = new QGridLayout(otherBox);
otherLayout->setSpacing(2);
SetUpCheckBox(chkTestPule[ID][numGroup], "Int. Test Pulse", otherLayout, 1, 0, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::InternalTestPulse);
SetUpComboBoxBit(cbTestPulseRate[ID][numGroup], "Test Pulse Rate : ", otherLayout, 1, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListTestPulseRate, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::TestPulseRate);
SetUpCheckBox(chkTestPule[ID][numGroup], "Int. Test Pulse", otherLayout, 1, 0, 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);
}
@ -2667,10 +2667,10 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
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);
}
SetUpSpinBox(sbDCOffset[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::DCOffset_G, ch);
SetUpSpinBox(sbPreTrigger[ID][ch], "", tabLayout, ch + 1, 5, DPP::QDC::PreTrigger_G, ch);
SetUpComboBoxBit(cbPolarity[ID][ch], "", tabLayout, ch + 1, 7, DPP::QDC::Bit_DPPAlgorithmControl::ListPolarity, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::Polarity, 1, ch);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][ch], "", tabLayout, ch + 1, 9, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor, 1, ch);
SetUpSpinBox(sbDCOffset[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::DCOffset, 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 ){
@ -2679,8 +2679,8 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
QLabel * lb2 = new QLabel("Baseline Avg. ", this); lb2->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb2, 0, 2);
}
SetUpSpinBox(sbFixedBaseline[ID][ch], "", tabLayout, ch + 1, 1, DPP::QDC::FixedBaseline_G, ch);
SetUpComboBoxBit(cbBaseLineAvg[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::Bit_DPPAlgorithmControl::ListBaselineAvg, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::BaselineAvg, 1, ch);
SetUpSpinBox(sbFixedBaseline[ID][ch], "", tabLayout, ch + 1, 1, DPP::QDC::FixedBaseline, ch);
SetUpComboBoxBit(cbBaseLineAvg[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::Bit_DPPAlgorithmControl::ListBaselineAvg, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::BaselineAvg, 1, ch);
}
if( i == 2 ){
@ -2710,9 +2710,9 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
sbSubChOffset[ID][ch][subCh]->setStyleSheet("");
//TODO, that will overwrite other subCh
if( subCh < 4 ){
digi[ID]->WriteRegister(DPP::QDC::DCOffset_LowCh_G, value, ch);
digi[ID]->WriteRegister(DPP::QDC::DCOffset_LowCh, value, ch);
}else{
digi[ID]->WriteRegister(DPP::QDC::DCOffset_HighCh_G, value, ch);
digi[ID]->WriteRegister(DPP::QDC::DCOffset_HighCh, value, ch);
}
UpdatePanelFromMemory();
@ -2899,7 +2899,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
}
}
//*========================================
uint32_t chMask = digi[ID]->GetSettingFromMemory(DPP::ChannelEnableMask);
uint32_t chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask);
for( int i = 0; i < digi[ID]->GetRegChannels(); i++){
if( (chMask >> i ) & 0x1 ) {
bnChEnableMask[ID][i]->setStyleSheet("background-color: green;");
@ -2968,7 +2968,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]->GetNCoupledCh(); i++){
for( int i = 0; i < digi[ID]->GetRegChannels(); i++){
if( (glbTrgMask >> i ) & 0x1 ){
bnGlobalTriggerMask[ID][i]->setStyleSheet("background-color: green;");
}else{
@ -2983,7 +2983,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
//*========================================
uint32_t TRGOUTMask = digi[ID]->GetSettingFromMemory(DPP::FrontPanelTRGOUTEnableMask);
for( int i = 0; i < digi[ID]->GetNCoupledCh(); i++){
for( int i = 0; i < digi[ID]->GetRegChannels(); i++){
if( (TRGOUTMask >> i ) & 0x1 ){
bnTRGOUTMask[ID][i]->setStyleSheet("background-color: green;");
}else{
@ -3009,7 +3009,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
//*========================================
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE || digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ){
for( int i = 0; i < digi[ID]->GetNCoupledCh(); i++){
for( int i = 0; i < digi[ID]->GetRegChannels(); i++){
uint32_t trigger = digi[ID]->GetSettingFromMemory(DPP::TriggerValidationMask_G, 2*i );
cbMaskLogic[ID][i]->setCurrentIndex( (trigger >> 8 ) & 0x3 );
@ -3019,7 +3019,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
chkMaskExtTrigger[ID][i]->setChecked( ( trigger >> 30 ) & 0x1 );
chkMaskSWTrigger[ID][i]->setChecked( ( trigger >> 31 ) & 0x1 );
for( int j = 0; j < digi[ID]->GetNCoupledCh(); j++){
for( int j = 0; j < digi[ID]->GetRegChannels(); j++){
if( ( trigger >> j ) & 0x1 ) {
bnTriggerMask[ID][i][j]->setStyleSheet("background-color: green;");
}else{

View File

@ -624,13 +624,19 @@ void MainWindow::OpenDigitizers(){
if( !file.open(QIODevice::Text | QIODevice::ReadOnly) ) {
if( digi[i]->GetDPPType() == V1730_DPP_PHA_CODE ) {
//digi[i]->ProgramPHABoard();
//digi[i]->ProgramBoard_PHA();
//LogMsg("<b>" + fileName + "</b> not found. Program predefined PHA settings.");
LogMsg("<b>" + fileName + "</b> not found.");
}
if( digi[i]->GetDPPType() == V1730_DPP_PSD_CODE ){
//digi[i]->ProgramPSDBoard();
//digi[i]->ProgramBoard_PSD();
//LogMsg("<b>" + fileName + "</b> not found. Program predefined PSD settings.");
LogMsg("<b>" + fileName + "</b> not found.");
}
if( digi[i]->GetDPPType() == V1740_DPP_QDC_CODE ){
//digi[i]->ProgramBoard_QDC();
//LogMsg("<b>" + fileName + "</b> not found. Program predefined PSD settings.");
LogMsg("<b>" + fileName + "</b> not found.");
}
@ -756,6 +762,8 @@ void MainWindow::WaitForDigitizersOpen(bool onOff){
//***************************************************************
void MainWindow::SetupScalar(){
// printf("%s\n", __func__);
scalar = new QMainWindow(this);
scalar->setWindowTitle("Scalar");
@ -824,7 +832,7 @@ void MainWindow::SetupScalar(){
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 < maxNChannel; ch++){
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch++){
if( ch == 0 ){
QLabel * lbDigi = new QLabel("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()), scalar);
@ -852,12 +860,21 @@ void MainWindow::SetupScalar(){
leAccept[iDigi][ch]->setAlignment(Qt::AlignRight);
leAccept[iDigi][ch]->setStyleSheet("background-color: #F0F0F0;");
leTrigger[iDigi][ch]->setEnabled( (chMask >> ch) & 0x1 );
leAccept[iDigi][ch]->setEnabled( (chMask >> ch) & 0x1 );
if( digi[iDigi]->IsChEqRegCh() ){
leTrigger[iDigi][ch]->setEnabled( (chMask >> ch) & 0x1 );
leAccept[iDigi][ch]->setEnabled( (chMask >> ch) & 0x1 );
}else{
int grpID = ch/digi[iDigi]->GetRegChannels();
leTrigger[iDigi][ch]->setEnabled( (chMask >> grpID) & 0x1 );
leAccept[iDigi][ch]->setEnabled( (chMask >> grpID) & 0x1 );
}
scalarLayout->addWidget(leAccept[iDigi][ch], rowID, 2*iDigi+2);
}
}
printf("=================== z \n");
}
void MainWindow::CleanUpScalar(){
@ -1558,6 +1575,9 @@ void MainWindow::CheckElog(){
if( elogIP != "" && elogName != "" && elogUser != "" && elogPWD != "" ){
WriteElog("Testing communication.", "Testing communication.", "Other", 0);
AppendElog("test append elog.");
}else{
LogMsg("Elog missing inputs. skip.");
return;
}
if( elogID >= 0 ) {

View File

@ -171,7 +171,7 @@ const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110,
const Reg PostTrigger ("PostTrigger" , 0x8114, RW::ReadWrite, false, {}); /// R/W
const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite, false, {}); /// R/W
const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite, false, {}); /// R/W
const Reg ChannelEnableMask ("ChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W
const Reg RegChannelEnableMask ("RegChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W
const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY , false, {}); /// R
const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY , false, {}); /// R
const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite, false, {}); /// R/W
@ -543,7 +543,7 @@ namespace DPP {
const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110, RW::ReadWrite, false, {}); /// R/W
const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite, false, {}); /// R/W
const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite, false, {}); /// R/W
const Reg ChannelEnableMask ("ChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W
const Reg RegChannelEnableMask ("RegChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W
const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY , false, {}); /// R
const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY , false, {}); /// R
const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite, false, {}); /// R/W
@ -785,29 +785,29 @@ namespace DPP {
}
namespace QDC {
const Reg GateWidth_G ("GateWidth" , 0x1030, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg GateOffset_G ("GateOfset" , 0x1034, RW::ReadWrite, true, 0xFF, 1); /// R/W
const Reg FixedBaseline_G ("FixedBaseline" , 0x1038, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg PreTrigger_G ("PreTrigger" , 0x103C, RW::ReadWrite, true, 0xFF, 1); /// R/W
const Reg DPPAlgorithmControl_G ("DPPAlgorithmControl" , 0x1040, RW::ReadWrite, true, {}); /// R/W
const Reg TriggerHoldOffWidth_G ("Trigger Hold-off width" , 0x1074, RW::ReadWrite, true, 0xFFFF, 1); /// R/W
const Reg TRGOUTWidth_G ("Trigger out width" , 0x1078, RW::ReadWrite, true, 0xFFFF, 1); /// R/W
const Reg OverThresholdWidth_G ("Over Threshold width" , 0x107C, RW::ReadWrite, true, 0xFFFF, 1); /// R/W
const Reg GroupStatus_RG ("Group Status" , 0x1088, RW::ReadONLY, true, {}); /// R/
const Reg AMCFirmwareRevision_RG ("AMC firmware version" , 0x108C, RW::ReadONLY, true, {}); /// R/
const Reg DCOffset_G ("DC offset" , 0x1098, RW::ReadWrite, true, 0xFFFF, 1); /// R/W
const Reg ChannelMask_G ("Channel Group Mask" , 0x10A8, RW::ReadWrite, true, 0xFF, 1); /// R/W
const Reg DCOffset_LowCh_G ("DC offset for low ch." , 0x10C0, RW::ReadWrite, true, {}); /// R/W
const Reg DCOffset_HighCh_G ("DC offset for high ch." , 0x10C4, RW::ReadWrite, true, {}); /// R/W
const Reg TriggerThreshold_G_sub0 ("Trigger Threshold sub0" , 0x10D0, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_G_sub1 ("Trigger Threshold sub1" , 0x10D4, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_G_sub2 ("Trigger Threshold sub2" , 0x10D8, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_G_sub3 ("Trigger Threshold sub3" , 0x10DC, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_G_sub4 ("Trigger Threshold sub4" , 0x10E0, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_G_sub5 ("Trigger Threshold sub5" , 0x10E4, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_G_sub6 ("Trigger Threshold sub6" , 0x10E8, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_G_sub7 ("Trigger Threshold sub7" , 0x10EC, RW::ReadWrite, true, 0xFFF, 1); /// R/W
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 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
const Reg PreTrigger ("PreTrigger" , 0x103C, RW::ReadWrite, false, 0xFF, 1); /// R/W
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 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 DCOffset_LowCh ("DC offset for low ch." , 0x10C0, RW::ReadWrite, false, {}); /// R/W
const Reg DCOffset_HighCh ("DC offset for high ch." , 0x10C4, RW::ReadWrite, false, {}); /// R/W
const Reg TriggerThreshold_sub0 ("Trigger Threshold sub0" , 0x10D0, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_sub1 ("Trigger Threshold sub1" , 0x10D4, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_sub2 ("Trigger Threshold sub2" , 0x10D8, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_sub3 ("Trigger Threshold sub3" , 0x10DC, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_sub4 ("Trigger Threshold sub4" , 0x10E0, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_sub5 ("Trigger Threshold sub5" , 0x10E4, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_sub6 ("Trigger Threshold sub6" , 0x10E8, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg TriggerThreshold_sub7 ("Trigger Threshold sub7" , 0x10EC, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg NumberEventsPerAggregate ("Number of Events per Aggregate", 0x8020, RW::ReadWrite, false, 0x3FF, 1); /// R/W
@ -865,7 +865,7 @@ namespace DPP {
} // end of DPP namepace Register
const std::vector<Reg> RegisterPHAList = {
const std::vector<Reg> RegisterChannelList_PHA = {
DPP::RecordLength_G ,
DPP::InputDynamicRange ,
DPP::NumberEventsPerAggregate_G ,
@ -895,7 +895,7 @@ const std::vector<Reg> RegisterPHAList = {
DPP::TriggerValidationMask_G
};
const std::vector<Reg> RegisterPSDList = {
const std::vector<Reg> RegisterChannelList_PSD = {
DPP::RecordLength_G ,
DPP::InputDynamicRange ,
DPP::NumberEventsPerAggregate_G ,
@ -925,33 +925,33 @@ const std::vector<Reg> RegisterPSDList = {
DPP::TriggerValidationMask_G
};
const std::vector<Reg> RegisterQDCList = {
DPP::QDC::GateWidth_G,
DPP::QDC::GateOffset_G,
DPP::QDC::FixedBaseline_G,
DPP::QDC::PreTrigger_G,
DPP::QDC::DPPAlgorithmControl_G,
DPP::QDC::TriggerHoldOffWidth_G,
DPP::QDC::TRGOUTWidth_G,
DPP::QDC::OverThresholdWidth_G,
DPP::QDC::GroupStatus_RG,
DPP::QDC::AMCFirmwareRevision_RG,
DPP::QDC::DCOffset_G,
DPP::QDC::ChannelMask_G,
DPP::QDC::DCOffset_LowCh_G,
DPP::QDC::DCOffset_HighCh_G,
DPP::QDC::TriggerThreshold_G_sub0,
DPP::QDC::TriggerThreshold_G_sub1,
DPP::QDC::TriggerThreshold_G_sub2,
DPP::QDC::TriggerThreshold_G_sub3,
DPP::QDC::TriggerThreshold_G_sub4,
DPP::QDC::TriggerThreshold_G_sub5,
DPP::QDC::TriggerThreshold_G_sub6,
DPP::QDC::TriggerThreshold_G_sub7
const std::vector<Reg> RegisterChannelList_QDC = {
DPP::QDC::GateWidth,
DPP::QDC::GateOffset,
DPP::QDC::FixedBaseline,
DPP::QDC::PreTrigger,
DPP::QDC::DPPAlgorithmControl,
DPP::QDC::TriggerHoldOffWidth,
DPP::QDC::TRGOUTWidth,
DPP::QDC::OverThresholdWidth,
DPP::QDC::GroupStatus_R,
DPP::QDC::AMCFirmwareRevision_R,
DPP::QDC::DCOffset,
DPP::QDC::ChannelMask,
DPP::QDC::DCOffset_LowCh,
DPP::QDC::DCOffset_HighCh,
DPP::QDC::TriggerThreshold_sub0,
DPP::QDC::TriggerThreshold_sub1,
DPP::QDC::TriggerThreshold_sub2,
DPP::QDC::TriggerThreshold_sub3,
DPP::QDC::TriggerThreshold_sub4,
DPP::QDC::TriggerThreshold_sub5,
DPP::QDC::TriggerThreshold_sub6,
DPP::QDC::TriggerThreshold_sub7
};
/// Only Board Setting
const std::vector<Reg> RegisterPHAPSDBoardList = {
const std::vector<Reg> RegisterBoardList_PHAPSD = {
DPP::BoardConfiguration ,
DPP::AggregateOrganization ,
@ -964,7 +964,7 @@ const std::vector<Reg> RegisterPHAPSDBoardList = {
DPP::FrontPanelTRGOUTEnableMask ,
DPP::LVDSIOData ,
DPP::FrontPanelIOControl ,
DPP::ChannelEnableMask ,
DPP::RegChannelEnableMask ,
DPP::ROCFPGAFirmwareRevision_R ,
DPP::EventStored_R ,
DPP::VoltageLevelModeConfig ,
@ -1019,7 +1019,7 @@ const std::vector<Reg> RegisterPHAPSDBoardList = {
};
const std::vector<Reg> RegisterQDCBoardList = {
const std::vector<Reg> RegisterBoardList_QDC = {
DPP::BoardConfiguration ,
DPP::AggregateOrganization,

View File

@ -26,6 +26,29 @@ int getch(void);
//^======================================
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));
for( int grp = 0; grp < 8; grp ++){
printf("OverThreshold %d: 0x%d \n", grp, digi->GetSettingFromMemory(DPP::QDC::OverThresholdWidth, grp));
}
unsigned int returnData;
int ret = CAEN_DGTZ_ReadRegister(digi->GetHandle(), 0x8024, &returnData);
printf("ret : %d | 0x%08x\n", ret, returnData);
printf("Record Length: 0x%d \n", digi->GetSettingFromMemory(DPP::QDC::RecordLength, 0));
digi->CloseDigitizer();
delete digi;
/*
const int nBoard = 1;
Digitizer **dig = new Digitizer *[nBoard];
@ -35,14 +58,18 @@ int main(int argc, char* argv[]){
dig[i] = new Digitizer(board, port, false, true);
}
dig[0]->StopACQ();
// dig[i]->StopACQ();
// dig[0]->WriteRegister(DPP::SoftwareClear_W, 1);
// dig[0]->ProgramBoard();
// dig[0]->ProgramPSDBoard();
// dig[0]->ProgramBoard_PSD();
// const float tick2ns = dig[0]->GetTick2ns();
//dig[2]->ReadRegister(DPP::QDC::RecordLength, 0, 0, "");
/******************
Data * data = dig[0]->GetData();
data->ClearData();
@ -69,7 +96,7 @@ int main(int argc, char* argv[]){
dig[0]->StopACQ();
*/
@ -158,6 +185,7 @@ int main(int argc, char* argv[]){
app->Run();
*/
/*
printf("Closing digitizers..............\n");
for( int i = 0; i < nBoard; i++){
if(dig[i]->IsConnected()) dig[i]->StopACQ();
@ -175,7 +203,7 @@ int main(int argc, char* argv[]){
dig->LoadSettingBinaryToMemory("expDir/settings/setting_323.bin");
//dig->ProgramPHABoard();
//dig->ProgramBoard_PHA();
//dig->OpenSettingBinary("setting_323.bin");
//dig->ReadAllSettingsFromBoard();

View File

@ -180,7 +180,7 @@ int main(int argc, char* argv[]){
CAEN_DGTZ_BoardInfo_t BoardInfo;
ret = (int) CAEN_DGTZ_GetInfo(handle, &BoardInfo);
int NChannel = BoardInfo.Channels;
uint32_t channelMask = 0xFFFF;
uint32_t regChannelMask = 0xFFFF;
float tick2ns = 4.0;
switch(BoardInfo.Model){
case CAEN_DGTZ_V1730: tick2ns = 2.0; break; ///ns -> 500 MSamples/s
@ -259,7 +259,7 @@ int main(int argc, char* argv[]){
/// 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);
///ret = CAEN_DGTZ_SetDPPParameters(handle, regChannelMask, &DPPParams);
ret |= CAEN_DGTZ_WriteRegister(handle, DPP::PHA::DecayTime + 0x7000 , 5000 );
ret |= CAEN_DGTZ_WriteRegister(handle, DPP::PHA::TrapezoidFlatTop + 0x7000 , 62 );