added registerSetting.h/cpp for controlling all register for all channels

This commit is contained in:
carina@hades 2022-10-04 16:54:01 -04:00
parent 3d4a621c94
commit 97413b41dd
15 changed files with 861 additions and 190 deletions

View File

@ -75,6 +75,8 @@ class Data{
int DecodePHADualChannelBlock(unsigned int ChannelMask, int verbose); int DecodePHADualChannelBlock(unsigned int ChannelMask, int verbose);
int DecodePSDDualChannelBlock(unsigned int ChannelMask, int verbose); int DecodePSDDualChannelBlock(unsigned int ChannelMask, int verbose);
unsigned short saveFileIndex;
}; };
//========================================== //==========================================
@ -87,6 +89,7 @@ inline Data::Data(){
ClearData(); ClearData();
SaveWaveformToMemory = true; SaveWaveformToMemory = true;
nw = 0; nw = 0;
saveFileIndex = 0;
} }
inline Data::~Data(){ inline Data::~Data(){
@ -152,8 +155,24 @@ inline unsigned int Data::ReadBuffer(unsigned int nWord, int verbose){
} }
inline void Data::SaveBuffer(const char * fileName){ inline void Data::SaveBuffer(const char * fileName){
FILE * haha = fopen(fileName, "a+");
char saveFileName[100];
sprintf(saveFileName, "%s_%03u.bin", fileName , saveFileIndex);
FILE * haha = fopen(saveFileName, "a+");
fseek(haha, 0L, SEEK_END);
unsigned int inFileSize = ftell(haha); /// unsigned int = Max ~ 4 GB
///printf("file Size = %u Byte\n", inFileSize);
if( inFileSize > (unsigned int)MaxSaveFileSize ) { /// 2 GB
fclose(haha);
saveFileIndex ++;
sprintf(saveFileName, "%s_%03u.bin", fileName , saveFileIndex);
FILE * haha = fopen(saveFileName, "a+");
}
fwrite(buffer, nByte, 1, haha); fwrite(buffer, nByte, 1, haha);
fclose(haha); fclose(haha);
} }

View File

@ -50,8 +50,8 @@ void Digitizer::Reset(){
ret = CAEN_DGTZ_Reset(handle); ret = CAEN_DGTZ_Reset(handle);
if( ret != 0 ) ErrorMsg(__func__); if( ret != 0 ) ErrorMsg(__func__);
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::SoftwareClear, 1); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::SoftwareClear_W, 1);
if( ret != 0 ) ErrorMsg("Reset-SoftwareClear"); if( ret != 0 ) ErrorMsg("Reset-SoftwareClear_W");
} }
@ -118,17 +118,17 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
sscanf(BoardInfo.AMC_FirmwareRel, "%d", &DPPType); sscanf(BoardInfo.AMC_FirmwareRel, "%d", &DPPType);
data->DPPType = DPPType; data->DPPType = DPPType;
switch (DPPType){ switch (DPPType){
case V1724_DPP_PHA_CODE: DPPTypeStr = "DPP-PHA x724"; break; case V1724_DPP_PHA_CODE: DPPTypeStr = "DPP-PHA x724"; break; /// 0x80
case V1720_DPP_CI_CODE : DPPTypeStr = "DPP-CI x720"; break; case V1720_DPP_CI_CODE : DPPTypeStr = "DPP-CI x720"; break; /// 0x82
case V1720_DPP_PSD_CODE: DPPTypeStr = "DPP-PSD x720"; break; case V1720_DPP_PSD_CODE: DPPTypeStr = "DPP-PSD x720"; break; /// 0x83
case V1751_DPP_PSD_CODE: DPPTypeStr = "DPP-PSD x751"; break; case V1751_DPP_PSD_CODE: DPPTypeStr = "DPP-PSD x751"; break; /// 0x84
case V1751_DPP_ZLE_CODE: DPPTypeStr = "DPP-ZLE x751"; break; case V1751_DPP_ZLE_CODE: DPPTypeStr = "DPP-ZLE x751"; break; /// 0x85
case V1743_DPP_CI_CODE: DPPTypeStr = "DPP-PSD x743"; break; case V1743_DPP_CI_CODE: DPPTypeStr = "DPP-PSD x743"; break; /// 0x86
case V1740_DPP_QDC_CODE: DPPTypeStr = "DPP-QDC x740"; break; case V1740_DPP_QDC_CODE: DPPTypeStr = "DPP-QDC x740"; break; /// 0x87
case V1730_DPP_PSD_CODE: DPPTypeStr = "DPP-PSD x730"; break; case V1730_DPP_PSD_CODE: DPPTypeStr = "DPP-PSD x730"; break; /// 0x88
case V1730_DPP_PHA_CODE: DPPTypeStr = "DPP-PHA x730"; break; case V1730_DPP_PHA_CODE: DPPTypeStr = "DPP-PHA x730"; break; /// 0x8B
case V1730_DPP_ZLE_CODE: DPPTypeStr = "DPP-ZLE x730"; break; case V1730_DPP_ZLE_CODE: DPPTypeStr = "DPP-ZLE x730"; break; /// 0x8C
case V1730_DPP_DAW_CODE: DPPTypeStr = "DPP-DAW x730"; break; case V1730_DPP_DAW_CODE: DPPTypeStr = "DPP-DAW x730"; break; /// 0x8D
} }
if (DPPType >= 0x80 && verbose) { if (DPPType >= 0x80 && verbose) {
printf("\t==== This digitizer has a DPP firmware!\n"); printf("\t==== This digitizer has a DPP firmware!\n");
@ -438,7 +438,7 @@ void Digitizer::SetFrontPanelIOControl(uint32_t bit){
} }
void Digitizer::SetTriggerValidationMask(uint32_t bit){ void Digitizer::SetTriggerValidationMask(uint32_t bit){
WriteRegister( Register::DPP::TriggerValidationMask, bit); WriteRegister( Register::DPP::TriggerValidationMask_G, bit);
ErrorMsg(__func__); ErrorMsg(__func__);
} }
@ -561,7 +561,7 @@ uint32_t Digitizer::PrintRegister(uint32_t address, std::string msg){
void Digitizer::PrintACQStatue(){ void Digitizer::PrintACQStatue(){
if( !isConnected ) return; if( !isConnected ) return;
unsigned int status = ReadRegister(Register::DPP::AcquisitionStatus); unsigned int status = ReadRegister(Register::DPP::AcquisitionStatus_R);
printf("=================== Print ACQ status \n"); printf("=================== Print ACQ status \n");
printf(" 32 28 24 20 16 12 8 4 0\n"); printf(" 32 28 24 20 16 12 8 4 0\n");
@ -680,18 +680,18 @@ void Digitizer::CreateAndSaveSettingBinary(string fileName){
SaveSettingEditByteByRegister(Register::DPP::AggregateOrganization); /// 0x800C SaveSettingEditByteByRegister(Register::DPP::AggregateOrganization); /// 0x800C
SaveSettingEditByteByRegister(Register::DPP::GlobalTriggerMask); /// 0x810C SaveSettingEditByteByRegister(Register::DPP::GlobalTriggerMask); /// 0x810C
SaveSettingEditByteByRegister(Register::DPP::ChannelEnableMask); /// 0x8120 SaveSettingEditByteByRegister(Register::DPP::ChannelEnableMask); /// 0x8120
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardVersion); /// 0xF030 SaveSettingEditByteByRegister(Register::DPP::ROM_BoardVersion_R); /// 0xF030
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardFromFactor); /// 0xF034 SaveSettingEditByteByRegister(Register::DPP::ROM_BoardFromFactor_R); /// 0xF034
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardIDByte1); /// 0xF038 SaveSettingEditByteByRegister(Register::DPP::ROM_BoardIDByte1_R); /// 0xF038
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardIDByte0); /// 0xF03C SaveSettingEditByteByRegister(Register::DPP::ROM_BoardIDByte0_R); /// 0xF03C
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardSerialNumByte1); /// 0xF080 SaveSettingEditByteByRegister(Register::DPP::ROM_BoardSerialNumByte1_R); /// 0xF080
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardSerialNumByte0); /// 0xF084 SaveSettingEditByteByRegister(Register::DPP::ROM_BoardSerialNumByte0_R); /// 0xF084
SaveSettingEditByteByRegister(Register::DPP::FrontPanelTRGOUTEnableMask); /// 0x8110 SaveSettingEditByteByRegister(Register::DPP::FrontPanelTRGOUTEnableMask); /// 0x8110
SaveSettingEditByteByRegister(Register::DPP::FrontPanelIOControl); /// 0x811C SaveSettingEditByteByRegister(Register::DPP::FrontPanelIOControl); /// 0x811C
SaveSettingEditByteByRegister(Register::DPP::ROCFPGAFirmwareRevision); /// 0x8124 SaveSettingEditByteByRegister(Register::DPP::ROCFPGAFirmwareRevision_R); /// 0x8124
SaveSettingEditByteByRegister(Register::DPP::BoardInfo); /// 0x8140 SaveSettingEditByteByRegister(Register::DPP::BoardInfo_R); /// 0x8140
SaveSettingEditByteByRegister(Register::DPP::DisableExternalTrigger); /// 0x817C SaveSettingEditByteByRegister(Register::DPP::DisableExternalTrigger); /// 0x817C
SaveSettingEditByteByRegister(Register::DPP::TriggerValidationMask); /// 0x8180 SaveSettingEditByteByRegister(Register::DPP::TriggerValidationMask_G); /// 0x8180
SaveSettingEditByteByRegister(Register::DPP::MaxAggregatePerBlockTransfer); /// 0xEF1C SaveSettingEditByteByRegister(Register::DPP::MaxAggregatePerBlockTransfer); /// 0xEF1C
@ -704,7 +704,7 @@ void Digitizer::CreateAndSaveSettingBinary(string fileName){
SaveSettingEditByteByRegister(Register::DPP::ChannelDCOffset, ch); SaveSettingEditByteByRegister(Register::DPP::ChannelDCOffset, ch);
SaveSettingEditByteByRegister(Register::DPP::NumberEventsPerAggregate_G, ch); SaveSettingEditByteByRegister(Register::DPP::NumberEventsPerAggregate_G, ch);
SaveSettingEditByteByRegister(Register::DPP::DPPAlgorithmControl, ch); SaveSettingEditByteByRegister(Register::DPP::DPPAlgorithmControl, ch);
SaveSettingEditByteByRegister(Register::DPP::AMCFirmwareRevision, ch); SaveSettingEditByteByRegister(Register::DPP::AMCFirmwareRevision_R, ch);
SaveSettingEditByteByRegister(Register::DPP::VetoWidth, ch); SaveSettingEditByteByRegister(Register::DPP::VetoWidth, ch);
if( DPPType == V1730_DPP_PHA_CODE ) { /// DPP-PHA if( DPPType == V1730_DPP_PHA_CODE ) { /// DPP-PHA
@ -727,7 +727,6 @@ void Digitizer::CreateAndSaveSettingBinary(string fileName){
if( DPPType == V1730_DPP_PSD_CODE ) { /// DPP-PSD if( DPPType == V1730_DPP_PSD_CODE ) { /// DPP-PSD
SaveSettingEditByteByRegister(Register::DPP::PSD::CFDSetting, ch); SaveSettingEditByteByRegister(Register::DPP::PSD::CFDSetting, ch);
SaveSettingEditByteByRegister(Register::DPP::PSD::ForcedDataFlush, ch);
SaveSettingEditByteByRegister(Register::DPP::PSD::ChargeZeroSuppressionThreshold, ch); SaveSettingEditByteByRegister(Register::DPP::PSD::ChargeZeroSuppressionThreshold, ch);
SaveSettingEditByteByRegister(Register::DPP::PSD::ShortGateWidth, ch); SaveSettingEditByteByRegister(Register::DPP::PSD::ShortGateWidth, ch);
SaveSettingEditByteByRegister(Register::DPP::PSD::LongGateWidth, ch); SaveSettingEditByteByRegister(Register::DPP::PSD::LongGateWidth, ch);

View File

@ -29,6 +29,7 @@ enum MenuIdentifiers{
M_TRIGGER_SUMMARY, M_TRIGGER_SUMMARY,
M_CH_SETTING_PHA, M_CH_SETTING_PHA,
M_CH_SETTING_PSD, M_CH_SETTING_PSD,
M_REGISTER_SETTING,
M_BOARD_SETTINGS, M_BOARD_SETTINGS,
M_PROGRAM_SETTINGS, M_PROGRAM_SETTINGS,
M_FINDPEAKS, M_FINDPEAKS,
@ -98,6 +99,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
fMenuDigitizers->AddEntry("Digitizer &Settings", M_BOARD_SETTINGS); fMenuDigitizers->AddEntry("Digitizer &Settings", M_BOARD_SETTINGS);
fMenuDigitizers->AddEntry("&Channel Settings (PHA)", M_CH_SETTING_PHA); fMenuDigitizers->AddEntry("&Channel Settings (PHA)", M_CH_SETTING_PHA);
fMenuDigitizers->AddEntry("&Channel Settings (PSD)", M_CH_SETTING_PSD); fMenuDigitizers->AddEntry("&Channel Settings (PSD)", M_CH_SETTING_PSD);
fMenuDigitizers->AddEntry("&Register Setting", M_REGISTER_SETTING);
fMenuDigitizers->AddSeparator(); fMenuDigitizers->AddSeparator();
fMenuDigitizers->AddEntry("&Program Settings", M_PROGRAM_SETTINGS); fMenuDigitizers->AddEntry("&Program Settings", M_PROGRAM_SETTINGS);
fMenuDigitizers->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)"); fMenuDigitizers->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
@ -213,7 +215,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
boardSetting = NULL; boardSetting = NULL;
channelSettingPHA = NULL; channelSettingPHA = NULL;
///settingsSummary = NULL; registerSetting = NULL;
///scalarPanel = NULL; ///scalarPanel = NULL;
LogMsg((char*)"Please \"Open Digitizers\" to start."); LogMsg((char*)"Please \"Open Digitizers\" to start.");
@ -222,6 +224,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
//HandleMenu(M_BOARD_SETTINGS); //HandleMenu(M_BOARD_SETTINGS);
//HandleMenu(M_CH_SETTING_PHA); //HandleMenu(M_CH_SETTING_PHA);
//HandleMenu(M_CH_SETTING_PSD); //HandleMenu(M_CH_SETTING_PSD);
HandleMenu(M_REGISTER_SETTING);
gAnaTrace1 = new TGraph(); gAnaTrace1 = new TGraph();
gAnaTrace2 = new TGraph(); gAnaTrace2 = new TGraph();
@ -258,7 +261,7 @@ MainWindow::~MainWindow() {
delete channelSettingPHA; delete channelSettingPHA;
delete channelSettingPSD; delete channelSettingPSD;
//delete settingsSummary; delete registerSetting;
//delete scalarPanel; //delete scalarPanel;
//delete saveDataThread; //delete saveDataThread;
@ -326,6 +329,13 @@ void MainWindow::HandleMenu(Int_t id){
boardSetting->Connect("Haha(Int_t)", "MainWindow", this, "OpenChannelSetting(Int_t)"); boardSetting->Connect("Haha(Int_t)", "MainWindow", this, "OpenChannelSetting(Int_t)");
}break; }break;
///========================= Setting Summary
case M_REGISTER_SETTING:{
registerSetting = new RegisterSetting(gClient->GetRoot(), 600, 600, digi, nDigi, Register::DPP::RecordLength_G);
///registerSetting->Connect("SendChangeSignal()", "ChannelSettingPHA", this, "ChangeCh()");
///registerSetting->Connect("SendChangeSignal()", "ChannelSettingPSD", this, "ChangeCh()");
}break;
///========================= Program setting ///========================= Program setting
case M_PROGRAM_SETTINGS:{ case M_PROGRAM_SETTINGS:{
LogMsg((char*)"[Program settings] Not impelmented"); LogMsg((char*)"[Program settings] Not impelmented");
@ -646,7 +656,7 @@ void * MainWindow::FillHistogram(void * ptr){
uint32_t ElapsedTime = 0; uint32_t ElapsedTime = 0;
TString dataFileName = dataPrefix->GetText(); TString dataFileName = dataPrefix->GetText();
dataFileName += Form("_run_%03d.bin", (int) runIDEntry->GetNumber()); dataFileName += Form("%03d_run_%03d", (int) digi[boardID]->GetSerialNumber(), (int) runIDEntry->GetNumber());
printf("|%s|\n", dataFileName.Data()); printf("|%s|\n", dataFileName.Data());

View File

@ -21,6 +21,7 @@
#include "boardSetting.h" #include "boardSetting.h"
#include "channelSettingPHA.h" #include "channelSettingPHA.h"
#include "channelSettingPSD.h" #include "channelSettingPSD.h"
#include "registerSetting.h"
///#include "settingsSummary.h" ///#include "settingsSummary.h"
///#include "scalarPanel.h" ///#include "scalarPanel.h"
@ -61,7 +62,7 @@ private:
BoardSetting * boardSetting; BoardSetting * boardSetting;
ChannelSettingPHA * channelSettingPHA; ChannelSettingPHA * channelSettingPHA;
ChannelSettingPSD * channelSettingPSD; ChannelSettingPSD * channelSettingPSD;
//SettingsSummary * settingsSummary; RegisterSetting * registerSetting;
//ScalarPanel * scalarPanel; //ScalarPanel * scalarPanel;
// //

View File

@ -12,7 +12,7 @@ CAENLIBS = -lCAENDigitizer
ROOTLIBS = `root-config --cflags --glibs` ROOTLIBS = `root-config --cflags --glibs`
#OBJS = channelSettingPSD.o channelSettingPHA.o boardSetting.o ClassDigitizer.o DigitizerPHA.o DigitizerPSD.o FSUDAQ.o #OBJS = channelSettingPSD.o channelSettingPHA.o boardSetting.o ClassDigitizer.o DigitizerPHA.o DigitizerPSD.o FSUDAQ.o
OBJS = channelSettingPSD.o channelSettingPHA.o boardSetting.o ClassDigitizer.o FSUDAQ.o OBJS = registerSetting.o channelSettingPSD.o channelSettingPHA.o boardSetting.o ClassDigitizer.o FSUDAQ.o
######################################################################### #########################################################################
@ -63,6 +63,10 @@ channelSettingPSD.o : channelSettingPSD.h channelSettingPSD.cpp
@echo "----------- creating channelSettingPSD.o" @echo "----------- creating channelSettingPSD.o"
$(CC) $(COPTS) -c channelSettingPSD.cpp $(ROOTLIBS) $(CC) $(COPTS) -c channelSettingPSD.cpp $(ROOTLIBS)
registerSetting.o : registerSetting.h registerSetting.cpp
@echo "----------- creating registerSetting.o"
$(CC) $(COPTS) -c registerSetting.cpp $(ROOTLIBS)
#CutsCreator: $(OBJS3) src/CutsCreator.c #CutsCreator: $(OBJS3) src/CutsCreator.c
# g++ -std=c++17 -pthread src/CutsCreator.c -o CutsCreator $(ROOTLIBS) # g++ -std=c++17 -pthread src/CutsCreator.c -o CutsCreator $(ROOTLIBS)

View File

@ -7,7 +7,7 @@
/// Group register, 2m and 2m+1 channels setting are shared. and the name will have _G as prefix /// Group register, 2m and 2m+1 channels setting are shared. and the name will have _G as prefix
/// Most 0x8XXX registers are common, which share for all channel /// Most 0x8XXX registers are common, which share for all channel
#define GET_NAME(name) #name /// this give out the name, printf("%s", GET_NAME(Register::EventReadOutBuffer)); #define GET_NAME(address) #address /// this give out the name, printf("%s", GET_NAME(Register::EventReadOutBuffer));
namespace Register { namespace Register {
@ -19,43 +19,43 @@ namespace Register {
const uint32_t ChannelPulseWidth = 0x1070; /// R/W const uint32_t ChannelPulseWidth = 0x1070; /// R/W
const uint32_t ChannelTriggerThreshold = 0x1080; /// R/W const uint32_t ChannelTriggerThreshold = 0x1080; /// R/W
const uint32_t CoupleSelfTriggerLogic_G = 0x1084; /// R/W const uint32_t CoupleSelfTriggerLogic_G = 0x1084; /// R/W
const uint32_t ChannelStatus = 0x1088; /// R const uint32_t ChannelStatus_R = 0x1088; /// R
const uint32_t AMCFirmwareRevision = 0x108C; /// R const uint32_t AMCFirmwareRevision_ = 0x108C; /// R
const uint32_t ChannelDCOffset = 0x1098; /// R/W const uint32_t ChannelDCOffset = 0x1098; /// R/W
const uint32_t ChannelADCTemperature = 0x10A8; /// R const uint32_t ChannelADCTemperature_R = 0x10A8; /// R
const uint32_t ChannelSelfTriggerRateMeter = 0x10EC; /// R const uint32_t ChannelSelfTriggerRateMeter_R = 0x10EC; /// R
///========== Board ///========== Board
const uint32_t BoardConfiguration = 0x8000; /// R/W const uint32_t BoardConfiguration = 0x8000; /// R/W
const uint32_t BufferOrganization = 0x800C; /// R/W const uint32_t BufferOrganization = 0x800C; /// R/W
const uint32_t CustomSize = 0x8020; /// R/W const uint32_t CustomSize = 0x8020; /// R/W
const uint32_t ADCCalibration = 0x809C; /// W const uint32_t ADCCalibration_W = 0x809C; /// W
const uint32_t AcquisitionControl = 0x8100; /// R/W const uint32_t AcquisitionControl = 0x8100; /// R/W
const uint32_t AcquisitionStatus = 0x8104; /// R const uint32_t AcquisitionStatus_R = 0x8104; /// R
const uint32_t SoftwareTrigger = 0x8108; /// W const uint32_t SoftwareTrigger_W = 0x8108; /// W
const uint32_t GlobalTriggerMask = 0x810C; /// R/W const uint32_t GlobalTriggerMask = 0x810C; /// R/W
const uint32_t FrontPanelTRGOUTEnableMask = 0x8110; /// R/W const uint32_t FrontPanelTRGOUTEnableMask = 0x8110; /// R/W
const uint32_t PostTrigger = 0x8114; /// R/W const uint32_t PostTrigger = 0x8114; /// R/W
const uint32_t LVDSIOData = 0x8118; /// R/W const uint32_t LVDSIOData = 0x8118; /// R/W
const uint32_t FrontPanelIOControl = 0x811C; /// R/W const uint32_t FrontPanelIOControl = 0x811C; /// R/W
const uint32_t ChannelEnableMask = 0x8120; /// R/W const uint32_t ChannelEnableMask = 0x8120; /// R/W
const uint32_t ROCFPGAFirmwareRevision = 0x8124; /// R const uint32_t ROCFPGAFirmwareRevision_R = 0x8124; /// R
const uint32_t EventStored = 0x812C; /// R const uint32_t EventStored_R = 0x812C; /// R
const uint32_t VoltageLevelModeConfig = 0x8138; /// R/W const uint32_t VoltageLevelModeConfig = 0x8138; /// R/W
const uint32_t SoftwareClockSync = 0x813C; /// W const uint32_t SoftwareClockSync_W = 0x813C; /// W
const uint32_t BoardInfo = 0x8140; /// R const uint32_t BoardInfo_R = 0x8140; /// R
const uint32_t AnalogMonitorMode = 0x8144; /// R/W const uint32_t AnalogMonitorMode = 0x8144; /// R/W
const uint32_t EventSize = 0x814C; /// R const uint32_t EventSize_R = 0x814C; /// R
const uint32_t FanSpeedControl = 0x8168; /// R/W const uint32_t FanSpeedControl = 0x8168; /// R/W
const uint32_t MemoryBufferAlmostFullLevel = 0x816C; /// R/W const uint32_t MemoryBufferAlmostFullLevel = 0x816C; /// R/W
const uint32_t RunStartStopDelay = 0x8170; /// R/W const uint32_t RunStartStopDelay = 0x8170; /// R/W
const uint32_t BoardFailureStatus = 0x8178; /// R const uint32_t BoardFailureStatus_R = 0x8178; /// R
const uint32_t FrontPanelLVDSIONewFeatures = 0x81A0; /// R/W const uint32_t FrontPanelLVDSIONewFeatures = 0x81A0; /// R/W
const uint32_t BufferOccupancyGain = 0x81B4; /// R/W const uint32_t BufferOccupancyGain = 0x81B4; /// R/W
const uint32_t ChannelsShutdown = 0x81C0; /// W const uint32_t ChannelsShutdown_W = 0x81C0; /// W
const uint32_t ExtendedVetoDelay = 0x81C4; /// R/W const uint32_t ExtendedVetoDelay = 0x81C4; /// R/W
const uint32_t ReadoutControl = 0xEF00; /// R/W const uint32_t ReadoutControl = 0xEF00; /// R/W
const uint32_t ReadoutStatus = 0xEF04; /// R const uint32_t ReadoutStatus_R = 0xEF04; /// R
const uint32_t BoardID = 0xEF08; /// R/W const uint32_t BoardID = 0xEF08; /// R/W
const uint32_t MCSTBaseAddressAndControl = 0xEF0C; /// R/W const uint32_t MCSTBaseAddressAndControl = 0xEF0C; /// R/W
const uint32_t RelocationAddress = 0xEF10; /// R/W const uint32_t RelocationAddress = 0xEF10; /// R/W
@ -63,8 +63,8 @@ namespace Register {
const uint32_t InterruptEventNumber = 0xEF18; /// R/W const uint32_t InterruptEventNumber = 0xEF18; /// R/W
const uint32_t MaxAggregatePerBlockTransfer = 0xEF1C; /// R/W const uint32_t MaxAggregatePerBlockTransfer = 0xEF1C; /// R/W
const uint32_t Scratch = 0xEF20; /// R/W const uint32_t Scratch = 0xEF20; /// R/W
const uint32_t SoftwareReset = 0xEF24; /// W const uint32_t SoftwareReset_W = 0xEF24; /// W
const uint32_t SoftwareClear = 0xEF28; /// W const uint32_t SoftwareClear_W = 0xEF28; /// W
///====== Common for PHA and PSD ///====== Common for PHA and PSD
namespace DPP { namespace DPP {
@ -76,44 +76,44 @@ namespace Register {
const uint32_t TriggerThreshold = 0x106C; /// R/W const uint32_t TriggerThreshold = 0x106C; /// R/W
const uint32_t TriggerHoldOffWidth = 0x1074; /// R/W const uint32_t TriggerHoldOffWidth = 0x1074; /// R/W
const uint32_t DPPAlgorithmControl = 0x1080; /// R/W const uint32_t DPPAlgorithmControl = 0x1080; /// R/W
const uint32_t ChannelStatus = 0x1088; /// R const uint32_t ChannelStatus_R = 0x1088; /// R
const uint32_t AMCFirmwareRevision = 0x108C; /// R const uint32_t AMCFirmwareRevision_R = 0x108C; /// R
const uint32_t ChannelDCOffset = 0x1098; /// R/W const uint32_t ChannelDCOffset = 0x1098; /// R/W
const uint32_t ChannelADCTemperature = 0x10A8; /// R const uint32_t ChannelADCTemperature_R = 0x10A8; /// R
const uint32_t IndividualSoftwareTrigger = 0x10C0; /// W const uint32_t IndividualSoftwareTrigger_W = 0x10C0; /// W
const uint32_t VetoWidth = 0x10D4; /// R/W const uint32_t VetoWidth = 0x10D4; /// R/W
/// I know there are many duplication, it is the design. /// I know there are many duplication, it is the design.
const uint32_t BoardConfiguration = 0x8000; /// R/W const uint32_t BoardConfiguration = 0x8000; /// R/W
const uint32_t AggregateOrganization = 0x800C; /// R/W const uint32_t AggregateOrganization = 0x800C; /// R/W
const uint32_t ADCCalibration = 0x809C; /// W const uint32_t ADCCalibration_W = 0x809C; /// W
const uint32_t ChannelShutdown = 0x80BC; /// W const uint32_t ChannelShutdown_W = 0x80BC; /// W
const uint32_t AcquisitionControl = 0x8100; /// R/W const uint32_t AcquisitionControl = 0x8100; /// R/W
const uint32_t AcquisitionStatus = 0x8104; /// R const uint32_t AcquisitionStatus_R = 0x8104; /// R
const uint32_t SoftwareTrigger = 0x8108; /// W const uint32_t SoftwareTrigger_W = 0x8108; /// W
const uint32_t GlobalTriggerMask = 0x810C; /// R/W const uint32_t GlobalTriggerMask = 0x810C; /// R/W
const uint32_t FrontPanelTRGOUTEnableMask = 0x8110; /// R/W const uint32_t FrontPanelTRGOUTEnableMask = 0x8110; /// R/W
const uint32_t LVDSIOData = 0x8118; /// R/W const uint32_t LVDSIOData = 0x8118; /// R/W
const uint32_t FrontPanelIOControl = 0x811C; /// R/W const uint32_t FrontPanelIOControl = 0x811C; /// R/W
const uint32_t ChannelEnableMask = 0x8120; /// R/W const uint32_t ChannelEnableMask = 0x8120; /// R/W
const uint32_t ROCFPGAFirmwareRevision = 0x8124; /// R const uint32_t ROCFPGAFirmwareRevision_R = 0x8124; /// R
const uint32_t EventStored = 0x812C; /// R const uint32_t EventStored_R = 0x812C; /// R
const uint32_t VoltageLevelModeConfig = 0x8138; /// R/W const uint32_t VoltageLevelModeConfig = 0x8138; /// R/W
const uint32_t SoftwareClockSync = 0x813C; /// W const uint32_t SoftwareClockSync_W = 0x813C; /// W
const uint32_t BoardInfo = 0x8140; /// R /// [0:7] 0x0E = 725, 0x0B = 730, [8:15] 0x01 = 640 kSample, 0x08 = 5.12 MSample, [16:23] channel number const uint32_t BoardInfo_R = 0x8140; /// R /// [0:7] 0x0E = 725, 0x0B = 730, [8:15] 0x01 = 640 kSample, 0x08 = 5.12 MSample, [16:23] channel number
const uint32_t AnalogMonitorMode = 0x8144; /// R/W const uint32_t AnalogMonitorMode = 0x8144; /// R/W
const uint32_t EventSize = 0x814C; /// R const uint32_t EventSize_R = 0x814C; /// R
const uint32_t TimeBombDowncounter = 0x8158; /// R const uint32_t TimeBombDowncounter_R = 0x8158; /// R
const uint32_t FanSpeedControl = 0x8168; /// R/W const uint32_t FanSpeedControl = 0x8168; /// R/W
const uint32_t RunStartStopDelay = 0x8170; /// R/W const uint32_t RunStartStopDelay = 0x8170; /// R/W
const uint32_t BoardFailureStatus = 0x8178; /// R const uint32_t BoardFailureStatus_R = 0x8178; /// R
const uint32_t DisableExternalTrigger = 0x817C; /// R/W const uint32_t DisableExternalTrigger = 0x817C; /// R/W
const uint32_t TriggerValidationMask = 0x8180; /// R/W, 0x8180 + 4n const uint32_t TriggerValidationMask_G = 0x8180; /// R/W, 0x8180 + 4n
const uint32_t FrontPanelLVDSIONewFeatures = 0x81A0; /// R/W const uint32_t FrontPanelLVDSIONewFeatures = 0x81A0; /// R/W
const uint32_t BufferOccupancyGain = 0x81B4; /// R/W const uint32_t BufferOccupancyGain = 0x81B4; /// R/W
const uint32_t ExtendedVetoDelay = 0x81C4; /// R/W const uint32_t ExtendedVetoDelay = 0x81C4; /// R/W
const uint32_t ReadoutControl = 0xEF00; /// R/W const uint32_t ReadoutControl = 0xEF00; /// R/W
const uint32_t ReadoutStatus = 0xEF04; /// R const uint32_t ReadoutStatus_R = 0xEF04; /// R
const uint32_t BoardID = 0xEF08; /// R/W /// Geo address on VME crate const uint32_t BoardID = 0xEF08; /// R/W /// Geo address on VME crate
const uint32_t MCSTBaseAddressAndControl = 0xEF0C; /// R/W const uint32_t MCSTBaseAddressAndControl = 0xEF0C; /// R/W
const uint32_t RelocationAddress = 0xEF10; /// R/W const uint32_t RelocationAddress = 0xEF10; /// R/W
@ -121,36 +121,36 @@ namespace Register {
const uint32_t InterruptEventNumber = 0xEF18; /// R/W const uint32_t InterruptEventNumber = 0xEF18; /// R/W
const uint32_t MaxAggregatePerBlockTransfer = 0xEF1C; /// R/W const uint32_t MaxAggregatePerBlockTransfer = 0xEF1C; /// R/W
const uint32_t Scratch = 0xEF20; /// R/W const uint32_t Scratch = 0xEF20; /// R/W
const uint32_t SoftwareReset = 0xEF24; /// W const uint32_t SoftwareReset_W = 0xEF24; /// W
const uint32_t SoftwareClear = 0xEF28; /// W const uint32_t SoftwareClear_W = 0xEF28; /// W
const uint32_t ConfigurationReload = 0xEF34; /// W const uint32_t ConfigurationReload_W = 0xEF34; /// W
const uint32_t ROMChecksum = 0xF000; /// R const uint32_t ROMChecksum_R = 0xF000; /// R
const uint32_t ROMChecksumByte2 = 0xF004; /// R const uint32_t ROMChecksumByte2_R = 0xF004; /// R
const uint32_t ROMChecksumByte1 = 0xF008; /// R const uint32_t ROMChecksumByte1_R = 0xF008; /// R
const uint32_t ROMChecksumByte0 = 0xF00C; /// R const uint32_t ROMChecksumByte0_R = 0xF00C; /// R
const uint32_t ROMConstantByte2 = 0xF010; /// R const uint32_t ROMConstantByte2_R = 0xF010; /// R
const uint32_t ROMConstantByte1 = 0xF014; /// R const uint32_t ROMConstantByte1_R = 0xF014; /// R
const uint32_t ROMConstantByte0 = 0xF018; /// R const uint32_t ROMConstantByte0_R = 0xF018; /// R
const uint32_t ROM_C_Code = 0xF01C; /// R const uint32_t ROM_C_Code_R = 0xF01C; /// R
const uint32_t ROM_R_Code = 0xF020; /// R const uint32_t ROM_R_Code_R = 0xF020; /// R
const uint32_t ROM_IEEE_OUI_Byte2 = 0xF024; /// R const uint32_t ROM_IEEE_OUI_Byte2_R = 0xF024; /// R
const uint32_t ROM_IEEE_OUI_Byte1 = 0xF028; /// R const uint32_t ROM_IEEE_OUI_Byte1_R = 0xF028; /// R
const uint32_t ROM_IEEE_OUI_Byte0 = 0xF02C; /// R const uint32_t ROM_IEEE_OUI_Byte0_R = 0xF02C; /// R
const uint32_t ROM_BoardVersion = 0xF030; /// R const uint32_t ROM_BoardVersion_R = 0xF030; /// R
const uint32_t ROM_BoardFromFactor = 0xF034; /// R const uint32_t ROM_BoardFromFactor_R = 0xF034; /// R
const uint32_t ROM_BoardIDByte1 = 0xF038; /// R const uint32_t ROM_BoardIDByte1_R = 0xF038; /// R
const uint32_t ROM_BoardIDByte0 = 0xF03C; /// R const uint32_t ROM_BoardIDByte0_R = 0xF03C; /// R
const uint32_t ROM_PCB_rev_Byte3 = 0xF040; /// R const uint32_t ROM_PCB_rev_Byte3_R = 0xF040; /// R
const uint32_t ROM_PCB_rev_Byte2 = 0xF044; /// R const uint32_t ROM_PCB_rev_Byte2_R = 0xF044; /// R
const uint32_t ROM_PCB_rev_Byte1 = 0xF048; /// R const uint32_t ROM_PCB_rev_Byte1_R = 0xF048; /// R
const uint32_t ROM_PCB_rev_Byte0 = 0xF04C; /// R const uint32_t ROM_PCB_rev_Byte0_R = 0xF04C; /// R
const uint32_t ROM_FlashType = 0xF050; /// R const uint32_t ROM_FlashType_R = 0xF050; /// R
const uint32_t ROM_BoardSerialNumByte1 = 0xF080; /// R const uint32_t ROM_BoardSerialNumByte1_R = 0xF080; /// R
const uint32_t ROM_BoardSerialNumByte0 = 0xF084; /// R const uint32_t ROM_BoardSerialNumByte0_R = 0xF084; /// R
const uint32_t ROM_VCXO_Type = 0xF088; /// R const uint32_t ROM_VCXO_Type_R = 0xF088; /// R
namespace PHA { namespace PHA {
const uint32_t DataFlush = 0x103C; /// W not sure const uint32_t DataFlush_W = 0x103C; /// W not sure
const uint32_t ChannelStopAcquisition = 0x1040; /// R/W not sure const uint32_t ChannelStopAcquisition = 0x1040; /// R/W not sure
const uint32_t RCCR2SmoothingFactor = 0x1054; /// R/W Trigger Filter smoothing, triggerSmoothingFactor const uint32_t RCCR2SmoothingFactor = 0x1054; /// R/W Trigger Filter smoothing, triggerSmoothingFactor
const uint32_t InputRiseTime = 0x1058; /// R/W OK const uint32_t InputRiseTime = 0x1058; /// R/W OK
@ -169,7 +169,7 @@ namespace Register {
namespace PSD { namespace PSD {
const uint32_t CFDSetting = 0x103C; /// R/W const uint32_t CFDSetting = 0x103C; /// R/W
const uint32_t ForcedDataFlush = 0x1040; /// W const uint32_t ForcedDataFlush_W = 0x1040; /// W
const uint32_t ChargeZeroSuppressionThreshold = 0x1044; /// R/W const uint32_t ChargeZeroSuppressionThreshold = 0x1044; /// R/W
const uint32_t ShortGateWidth = 0x1054; /// R/W const uint32_t ShortGateWidth = 0x1054; /// R/W
const uint32_t LongGateWidth = 0x1058; /// R/W const uint32_t LongGateWidth = 0x1058; /// R/W
@ -185,9 +185,11 @@ namespace Register {
const uint32_t EarlyBaselineFreeze = 0x10D8; /// R/W const uint32_t EarlyBaselineFreeze = 0x10D8; /// R/W
} }
} }
} }
/**
/// This provides an alternative way for control /// This provides an alternative way for control
namespace Setting{ namespace Setting{
@ -346,6 +348,6 @@ namespace Setting{
}; };
} }*/
#endif #endif

View File

@ -692,7 +692,7 @@ BoardSetting::~BoardSetting(){
printf("close BoardSetting window\n"); printf("close BoardSetting window\n");
//for( int i = 0; i < nDigi; i++) digi[i] = 0; for( int i = 0; i < nDigi; i++) digi[i] = 0;
//pha = 0; //pha = 0;
//psd = 0; //psd = 0;
//delete readStatusThread; //delete readStatusThread;
@ -713,7 +713,7 @@ void BoardSetting::ReadStatus(){
/// ACQ Status /// ACQ Status
///digi[boardID]->PrintRegister(Register::DPP::AcquisitionStatus, "ACQ Status"); ///digi[boardID]->PrintRegister(Register::DPP::AcquisitionStatus, "ACQ Status");
uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::AcquisitionStatus); uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::AcquisitionStatus_R);
txtACQStatus ->SetText( ((temp >> 2) & 0x1) == 0 ? "ACQ is stopped" : "ACQ is Running", false); txtACQStatus->SetTextColor( ((temp >> 2) & 0x1) == 0 ? 1 : blue); txtACQStatus ->SetText( ((temp >> 2) & 0x1) == 0 ? "ACQ is stopped" : "ACQ is Running", false); txtACQStatus->SetTextColor( ((temp >> 2) & 0x1) == 0 ? 1 : blue);
txtACQEventReady ->SetText( ((temp >> 3) & 0x1) == 0 ? "no Event" : "Has Events", false); txtACQEventReady->SetTextColor( ((temp >> 3) & 0x1) == 0 ? 1 : blue); txtACQEventReady ->SetText( ((temp >> 3) & 0x1) == 0 ? "no Event" : "Has Events", false); txtACQEventReady->SetTextColor( ((temp >> 3) & 0x1) == 0 ? 1 : blue);
@ -734,7 +734,7 @@ void BoardSetting::ReadStatus(){
/// Redaout Status /// Redaout Status
///digi[boardID]->PrintRegister(Register::DPP::ReadoutStatus, "Readout Status"); ///digi[boardID]->PrintRegister(Register::DPP::ReadoutStatus, "Readout Status");
temp = digi[boardID]->ReadRegister(Register::DPP::ReadoutStatus); temp = digi[boardID]->ReadRegister(Register::DPP::ReadoutStatus_R);
if( (temp & 0x1) == 1 ){ if( (temp & 0x1) == 1 ){
txtEventReady->SetText( "Event Ready" , false); txtEventReady->SetTextColor(blue); txtEventReady->SetText( "Event Ready" , false); txtEventReady->SetTextColor(blue);
}else{ }else{
@ -755,7 +755,7 @@ void BoardSetting::ReadStatus(){
///================ Board Failure Status ///================ Board Failure Status
///digi[boardID]->PrintRegister(Register::DPP::BoardFailureStatus, "Board Fail"); ///digi[boardID]->PrintRegister(Register::DPP::BoardFailureStatus, "Board Fail");
temp = digi[boardID]->ReadRegister(Register::DPP::BoardFailureStatus); temp = digi[boardID]->ReadRegister(Register::DPP::BoardFailureStatus_R);
if( ((temp >> 4) & 0x1) == 0 ) { if( ((temp >> 4) & 0x1) == 0 ) {
enPLLStatus->SetText( "OK" , false); enPLLStatus->SetTextColor(1); enPLLStatus->SetText( "OK" , false); enPLLStatus->SetTextColor(1);
}else{ }else{
@ -1056,7 +1056,7 @@ void BoardSetting::ResetSettingToDefault(){ /// same for PHA and PSD
int boardID = boardIDEntry->GetNumber(); int boardID = boardIDEntry->GetNumber();
digi[boardID]->Reset(); digi[boardID]->Reset();
digi[boardID]->WriteRegister(Register::DPP::SoftwareReset, 1); digi[boardID]->WriteRegister(Register::DPP::SoftwareReset_W, 1);
ChangeBoard(); ChangeBoard();
@ -1067,7 +1067,7 @@ void BoardSetting::ClearBuffer(){ /// same for PHA and PSD
if( digi == NULL ) return; if( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber(); int boardID = boardIDEntry->GetNumber();
digi[boardID]->WriteRegister(Register::DPP::SoftwareClear, 1); digi[boardID]->WriteRegister(Register::DPP::SoftwareClear_W, 1);
ReadStatus(); ReadStatus();
} }
@ -1170,7 +1170,7 @@ void BoardSetting::SendSoftwareTriggerSignal(){ /// same for PHA and PSD
printf("=== %s\n", __func__); printf("=== %s\n", __func__);
if( digi == NULL ) return; if( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber(); int boardID = boardIDEntry->GetNumber();
digi[boardID]->WriteRegister(Register::DPP::SoftwareTrigger, 1 ); digi[boardID]->WriteRegister(Register::DPP::SoftwareTrigger_W, 1 );
ReadStatus(); ReadStatus();
@ -1180,7 +1180,7 @@ void BoardSetting::SendSoftwareClockSyncSignal(){ /// same for PHA and PSD
printf("=== %s\n", __func__); printf("=== %s\n", __func__);
if( digi == NULL ) return; if( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber(); int boardID = boardIDEntry->GetNumber();
digi[boardID]->WriteRegister(Register::DPP::SoftwareClockSync, 1 ); digi[boardID]->WriteRegister(Register::DPP::SoftwareClockSync_W, 1 );
} }
void BoardSetting::SetRunStartStopDelay(){ /// same for PHA and PSD void BoardSetting::SetRunStartStopDelay(){ /// same for PHA and PSD
@ -1320,7 +1320,7 @@ void BoardSetting::ReadData(){
if( digi == NULL ) return; if( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber(); int boardID = boardIDEntry->GetNumber();
uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::ReadoutStatus); uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::ReadoutStatus_R);
if( (temp & 0x1) == 0 ) { if( (temp & 0x1) == 0 ) {
printf("No data. \n"); printf("No data. \n");
return; return;

View File

@ -32,18 +32,18 @@ ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digi
TGHorizontalFrame *hframe0 = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe0, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); TGHorizontalFrame *hframe0 = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe0, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
///==========Board choose ///==========Board choose
//TODO Serial Number
TGLabel * lb0 = new TGLabel(hframe0, "Module ID :"); hframe0->AddFrame(lb0, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); TGLabel * lb0 = new TGLabel(hframe0, "Module ID :"); hframe0->AddFrame(lb0, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
boardIDEntry = new TGNumberEntry(hframe0, boardID, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframe0->AddFrame(boardIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); boardIDEntry = new TGNumberEntry(hframe0, boardID, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframe0->AddFrame(boardIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
boardIDEntry->SetWidth(50); boardIDEntry->SetWidth(50);
boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi); boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi);
boardIDEntry->Connect("Modified()", "ChannelSettingPHA", this, "ChangeBoard()"); boardIDEntry->Connect("Modified()", "ChannelSettingPHA", this, "ChangeBoard()");
if( nDigi <= 1 ) boardIDEntry->SetState(false); if( nDigi <= 1 ) boardIDEntry->SetState(false);
this->presentBoardID = boardID; this->presentBoardID = boardID;
NChannel = 16 ;// digi[0]->GetNChannel(); NChannel = 16;
if( digi != NULL ) NChannel = digi[boardID]->GetNChannel();
TGLabel * lba = new TGLabel(hframe0, Form("Serial : %03d", digi == NULL ? -1 : digi[boardID]->GetSerialNumber())); hframe0->AddFrame(lba, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
TGLabel * lb1 = new TGLabel(hframe0, "Channel :"); hframe0->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); TGLabel * lb1 = new TGLabel(hframe0, "Channel :"); hframe0->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber); hframe0->AddFrame(chIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber); hframe0->AddFrame(chIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
@ -393,6 +393,19 @@ ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digi
bReadTrace->Connect("Clicked()", "ChannelSettingPHA", this, "ReadTrace()"); bReadTrace->Connect("Clicked()", "ChannelSettingPHA", this, "ReadTrace()");
} }
{///=================== Comment
TGHorizontalFrame * hfOther = new TGHorizontalFrame(vframe); vframe->AddFrame(hfOther, new TGLayoutHints(kLHintsNormal, 5, 5, 10, 0));
///const uint32_t ShapedTriggerWidth = 0x1084; /// R/W not sure
///const uint32_t VetoWidth = 0x10D4; /// R/W
///const uint32_t FineGain = 0x10C4; /// R/W OK
TGLabel * lbOther = new TGLabel(hfOther, "Shaped Trigger Width (0x1n84), Veto Width (0x1nD4), and Fine Gain (0x1nC4) are not implemented."); hfOther->AddFrame(lbOther);
}
fMain->MapSubwindows(); fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize()); fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow(); fMain->MapWindow();
@ -486,7 +499,7 @@ void ChannelSettingPHA::ChangeCh(){
uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::ChannelDCOffset, ch); uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::ChannelDCOffset, ch);
numDCOffset->SetNumber( 1.0 - temp * 1.0/0xFFFF , false); numDCOffset->SetNumber( 1.0 - temp * 1.0/0xFFFF , false);
eTemp->SetText(Form("%d C", digi[boardID]->ReadRegister(Register::DPP::ChannelADCTemperature, ch)), false); eTemp->SetText(Form("%d C", digi[boardID]->ReadRegister(Register::DPP::ChannelADCTemperature_R, ch)), false);
numTriggerThreshold->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch), false); numTriggerThreshold->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch), false);
numTriggerHoldOff ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch) * 4 * ch2ns, false); numTriggerHoldOff ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch) * 4 * ch2ns, false);

View File

@ -41,7 +41,10 @@ ChannelSettingPSD::ChannelSettingPSD(const TGWindow *p, UInt_t w, UInt_t h, Digi
this->presentBoardID = boardID; this->presentBoardID = boardID;
NChannel = 16 ;// digi[0]->GetNChannel(); NChannel = 16 ;
if( digi != NULL ) NChannel = digi[boardID]->GetNChannel();
TGLabel * lba = new TGLabel(hframe0, Form("Serial : %03d", digi == NULL ? -1 : digi[boardID]->GetSerialNumber())); hframe0->AddFrame(lba, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
TGLabel * lb1 = new TGLabel(hframe0, "Channel :"); hframe0->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); TGLabel * lb1 = new TGLabel(hframe0, "Channel :"); hframe0->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber); chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber);
@ -547,7 +550,7 @@ void ChannelSettingPSD::ChangeCh(){
uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::ChannelDCOffset, ch); uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::ChannelDCOffset, ch);
numDCOffset->SetNumber( 1.0 - temp * 1.0/0xFFFF , false); numDCOffset->SetNumber( 1.0 - temp * 1.0/0xFFFF , false);
eTemp->SetText(Form("%d C", digi[boardID]->ReadRegister(Register::DPP::ChannelADCTemperature, ch)), false); eTemp->SetText(Form("%d C", digi[boardID]->ReadRegister(Register::DPP::ChannelADCTemperature_R, ch)), false);
numTriggerThreshold->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch), false); numTriggerThreshold->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch), false);
numTriggerHoldOff ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch) * 4 * ch2ns, false); numTriggerHoldOff ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch) * 4 * ch2ns, false);

View File

@ -4,5 +4,6 @@
#define MaxNBoards 22 #define MaxNBoards 22
#define MaxNChannels 16 #define MaxNChannels 16
#define MaxRecordLength 0x3fff * 8 #define MaxRecordLength 0x3fff * 8
#define MaxSaveFileSize 1024 * 1024 * 1024 * 2
#endif #endif

580
registerSetting.cpp Normal file
View File

@ -0,0 +1,580 @@
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TRootEmbeddedCanvas.h>
#include <TGTableContainer.h>
#include <TGFileDialog.h>
#include "registerSetting.h"
RegisterSetting::RegisterSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard, uint32_t address){
this->nDigi = nBoard;
this->digi = digi;
for( int i = 0; i < MaxNChannels; i++) value[i] = 0;
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Register Setting");
fMain->Connect("CloseWindow()", "RegisterSetting", this, "CloseWindow()");
TGLayoutHints * layoutHints = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5,5,3,3); /// left, right, top, bottom
TGLayoutHints * haha = new TGLayoutHints(kLHintsRight, 5,5,3,3); /// left, right, top, bottom
TGLayoutHints * kaka = new TGLayoutHints(kLHintsLeft, 0,0,0,0); /// left, right, top, bottom
TGVerticalFrame * vframe = new TGVerticalFrame(fMain); fMain->AddFrame(vframe, layoutHints);
int boardID;
{///==================== Board ID & Register Name
TGHorizontalFrame *hframe1 = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe1, layoutHints);
TGVerticalFrame * vframeA0 = new TGVerticalFrame(hframe1); hframe1->AddFrame(vframeA0, layoutHints);
TGVerticalFrame * vframeA1 = new TGVerticalFrame(hframe1); hframe1->AddFrame(vframeA1, layoutHints);
TGLabel * lb0 = new TGLabel(vframeA0, "Board ID :"); vframeA0->AddFrame(lb0, haha);
TGHorizontalFrame *hframe11 = new TGHorizontalFrame(vframeA1, w, 50 ); vframeA1->AddFrame(hframe11);
boardIDEntry = new TGNumberEntry(hframe11, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframe11->AddFrame(boardIDEntry, kaka);
boardIDEntry->SetWidth(50);
boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nBoard-1);
boardIDEntry->Connect("Modified()", "RegisterSetting", this, "ChangeBoard()");
if( nBoard <= 1 ) boardIDEntry->SetState(false);
boardID = boardIDEntry->GetNumber();
TGLabel * lb1 = new TGLabel(hframe11, Form("Serial Number : %03d", digi == NULL ? -1 : digi[boardID]->GetSerialNumber())); hframe11->AddFrame(lb1, new TGLayoutHints(kLHintsCenterY, 5,5,3,3));
TGLabel * lbAdd = new TGLabel(vframeA0, "Address :"); vframeA0->AddFrame(lbAdd, haha);
txtAddress = new TGTextEntry(vframeA1, Form("0x%04x", address)); vframeA1->AddFrame(txtAddress, kaka);
txtAddress->Connect("ReturnPressed()", "RegisterSetting", this, "TypeRegisterAddress()");
txtAddress->Resize(250,20);
TGLabel * lbName = new TGLabel(vframeA0, "Name :"); vframeA0->AddFrame(lbName, haha);
cbName = new TGComboBox(vframeA1, ""); vframeA1->AddFrame(cbName, kaka);
cbName->Connect("Changed()", "RegisterSetting", this, "UpdateRegister()");
cbName->Resize(250,20);
cbName->EnableTextInput(false);
}
{///==================== Controls
TGHorizontalFrame *hframeAll = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframeAll, layoutHints);
bSetALLChannel = new TGCheckButton(hframeAll, "Set ALL Channels", 1); hframeAll->AddFrame(bSetALLChannel, haha);
bSetALLChannel->Connect("Clicked()", "RegisterSetting", this, "SetAllChannels()");
TGTextButton * bReadSetting = new TGTextButton(hframeAll, "Read Settings"); hframeAll->AddFrame(bReadSetting, kaka);
bReadSetting->Connect("Clicked()", "RegisterSetting", this, "UpdateRegister()");
}
{///==================== values
TGHorizontalFrame *hframe = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe, layoutHints);
TGVerticalFrame * vframe0 = new TGVerticalFrame(hframe); hframe->AddFrame(vframe0, layoutHints);
TGVerticalFrame * vframe1 = new TGVerticalFrame(hframe); hframe->AddFrame(vframe1, layoutHints);
TGVerticalFrame * vframe2 = new TGVerticalFrame(hframe); hframe->AddFrame(vframe2, layoutHints);
TGVerticalFrame * vframe3 = new TGVerticalFrame(hframe); hframe->AddFrame(vframe3, layoutHints);
TGLabel * lbCh0 = new TGLabel(vframe0, "ch"); vframe0->AddFrame(lbCh0, layoutHints);
TGLabel * lbValueHex = new TGLabel(vframe1, "Bit Value [Hex]"); vframe1->AddFrame(lbValueHex, kaka);
TGLabel * lbValueDec = new TGLabel(vframe2, "Bit Value [Dec]"); vframe2->AddFrame(lbValueDec, kaka);
lbValueUnit = new TGLabel(vframe3, "Value [unit]"); vframe3->AddFrame(lbValueUnit, kaka);
TGLabel * lbCh[MaxNChannels];
for( int i = 0; i < digi[boardID]->GetNChannel(); i++){
lbCh[i] = new TGLabel(vframe0, Form("%02d", i)); vframe0->AddFrame(lbCh[i], new TGLayoutHints(kLHintsRight, 5,5,3,2));
txtValueHex[i] = new TGTextEntry(vframe1, ""); vframe1->AddFrame(txtValueHex[i], kaka);
txtValueHex[i]->Resize(100,20);
txtValueHex[i]->SetAlignment(kTextRight);
txtValueHex[i]->SetName(Form("h%02d", i));
txtValueHex[i]->Connect("ReturnPressed()", "RegisterSetting", this, "ChangeValue()");
txtValueDec[i] = new TGTextEntry(vframe2, ""); vframe2->AddFrame(txtValueDec[i], kaka);
txtValueDec[i]->Resize(80,20);
txtValueDec[i]->SetAlignment(kTextRight);
txtValueDec[i]->SetName(Form("d%02d", i));
txtValueDec[i]->Connect("ReturnPressed()", "RegisterSetting", this, "ChangeValue()");
txtValueUnit[i] = new TGTextEntry(vframe3, ""); vframe3->AddFrame(txtValueUnit[i], kaka);
txtValueUnit[i]->Resize(80,20);
txtValueUnit[i]->SetAlignment(kTextRight);
txtValueUnit[i]->SetName(Form("u%02d", i));
txtValueUnit[i]->Connect("ReturnPressed()", "RegisterSetting", this, "ChangeValue()");
txtValueUnit[i]->SetEnabled(false);
}
}
fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow();
ChangeBoard();
}
RegisterSetting::~RegisterSetting(){
printf("=== %s\n", __func__);
delete boardIDEntry;
delete txtAddress;
delete cbName;
delete lbValueUnit;
for(int i = 0; i < MaxNChannels; i++) {
delete txtValueHex[i];
delete txtValueDec[i];
delete txtValueUnit[i];
}
fMain->Cleanup();
delete fMain;
}
void RegisterSetting::ChangeBoard(){
if( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber();
cbName->RemoveAll();
cbName->AddEntry("Address NOT Exist", 0);
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE){ /// PHA
cbName->AddEntry("DPP::PHA::DataFlush_W" , Register::DPP::PHA::DataFlush_W );
cbName->AddEntry("DPP::PHA::ChannelStopAcquisition" , Register::DPP::PHA::ChannelStopAcquisition );
cbName->AddEntry("DPP::PHA::RCCR2SmoothingFactor" , Register::DPP::PHA::RCCR2SmoothingFactor );
cbName->AddEntry("DPP::PHA::InputRiseTime" , Register::DPP::PHA::InputRiseTime );
cbName->AddEntry("DPP::PHA::TrapezoidRiseTime" , Register::DPP::PHA::TrapezoidRiseTime );
cbName->AddEntry("DPP::PHA::TrapezoidFlatTop" , Register::DPP::PHA::TrapezoidFlatTop );
cbName->AddEntry("DPP::PHA::PeakingTime" , Register::DPP::PHA::PeakingTime );
cbName->AddEntry("DPP::PHA::DecayTime" , Register::DPP::PHA::DecayTime );
cbName->AddEntry("DPP::PHA::TriggerThreshold" , Register::DPP::PHA::TriggerThreshold );
cbName->AddEntry("DPP::PHA::RiseTimeValidationWindow", Register::DPP::PHA::RiseTimeValidationWindow);
cbName->AddEntry("DPP::PHA::TriggerHoldOffWidth" , Register::DPP::PHA::TriggerHoldOffWidth );
cbName->AddEntry("DPP::PHA::PeakHoldOff" , Register::DPP::PHA::PeakHoldOff );
cbName->AddEntry("DPP::PHA::ShapedTriggerWidth" , Register::DPP::PHA::ShapedTriggerWidth );
cbName->AddEntry("DPP::PHA::DPPAlgorithmControl2_G" , Register::DPP::PHA::DPPAlgorithmControl2_G );
cbName->AddEntry("DPP::PHA::FineGain" , Register::DPP::PHA::FineGain );
}
if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE){ /// PSD
cbName->AddEntry("DPP::PSD::CFDSetting" , Register::DPP::PSD::CFDSetting );
cbName->AddEntry("DPP::PSD::ForcedDataFlush_W" , Register::DPP::PSD::ForcedDataFlush_W );
cbName->AddEntry("DPP::PSD::ChargeZeroSuppressionThreshold", Register::DPP::PSD::ChargeZeroSuppressionThreshold );
cbName->AddEntry("DPP::PSD::ShortGateWidth" , Register::DPP::PSD::ShortGateWidth );
cbName->AddEntry("DPP::PSD::LongGateWidth" , Register::DPP::PSD::LongGateWidth );
cbName->AddEntry("DPP::PSD::GateOffset" , Register::DPP::PSD::GateOffset );
cbName->AddEntry("DPP::PSD::TriggerThreshold" , Register::DPP::PSD::TriggerThreshold );
cbName->AddEntry("DPP::PSD::FixedBaseline" , Register::DPP::PSD::FixedBaseline );
cbName->AddEntry("DPP::PSD::TriggerLatency" , Register::DPP::PSD::TriggerLatency );
cbName->AddEntry("DPP::PSD::ShapedTriggerWidth" , Register::DPP::PSD::ShapedTriggerWidth );
cbName->AddEntry("DPP::PSD::TriggerHoldOffWidth" , Register::DPP::PSD::TriggerHoldOffWidth );
cbName->AddEntry("DPP::PSD::ThresholdForPSDCut" , Register::DPP::PSD::ThresholdForPSDCut );
cbName->AddEntry("DPP::PSD::PurGapThreshold" , Register::DPP::PSD::PurGapThreshold );
cbName->AddEntry("DPP::PSD::DPPAlgorithmControl2_G" , Register::DPP::PSD::DPPAlgorithmControl2_G );
cbName->AddEntry("DPP::PSD::EarlyBaselineFreeze" , Register::DPP::PSD::EarlyBaselineFreeze );
}
if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE || digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE){
cbName->AddEntry("DPP::RecordLength_G" , Register::DPP::RecordLength_G );
cbName->AddEntry("DPP::InputDynamicRange" , Register::DPP::InputDynamicRange );
cbName->AddEntry("DPP::NumberEventsPerAggregate_G" , Register::DPP::NumberEventsPerAggregate_G );
cbName->AddEntry("DPP::PreTrigger" , Register::DPP::PreTrigger );
cbName->AddEntry("DPP::TriggerThreshold" , Register::DPP::TriggerThreshold );
cbName->AddEntry("DPP::TriggerHoldOffWidth" , Register::DPP::TriggerHoldOffWidth );
cbName->AddEntry("DPP::DPPAlgorithmControl" , Register::DPP::DPPAlgorithmControl );
cbName->AddEntry("DPP::ChannelStatus_R" , Register::DPP::ChannelStatus_R );
cbName->AddEntry("DPP::AMCFirmwareRevision_R" , Register::DPP::AMCFirmwareRevision_R );
cbName->AddEntry("DPP::ChannelDCOffset" , Register::DPP::ChannelDCOffset );
cbName->AddEntry("DPP::ChannelADCTemperature_R" , Register::DPP::ChannelADCTemperature_R );
cbName->AddEntry("DPP::IndividualSoftwareTrigger_W" , Register::DPP::IndividualSoftwareTrigger_W );
cbName->AddEntry("DPP::VetoWidth" , Register::DPP::VetoWidth );
cbName->AddEntry("DPP::BoardConfiguration" , Register::DPP::BoardConfiguration );
cbName->AddEntry("DPP::AggregateOrganization" , Register::DPP::AggregateOrganization );
cbName->AddEntry("DPP::ADCCalibration_W" , Register::DPP::ADCCalibration_W );
cbName->AddEntry("DPP::ChannelShutdown_W" , Register::DPP::ChannelShutdown_W );
cbName->AddEntry("DPP::AcquisitionControl" , Register::DPP::AcquisitionControl );
cbName->AddEntry("DPP::AcquisitionStatus_R" , Register::DPP::AcquisitionStatus_R );
cbName->AddEntry("DPP::SoftwareTrigger_W" , Register::DPP::SoftwareTrigger_W );
cbName->AddEntry("DPP::GlobalTriggerMask" , Register::DPP::GlobalTriggerMask );
cbName->AddEntry("DPP::FrontPanelTRGOUTEnableMask" , Register::DPP::FrontPanelTRGOUTEnableMask );
cbName->AddEntry("DPP::LVDSIOData" , Register::DPP::LVDSIOData );
cbName->AddEntry("DPP::FrontPanelIOControl" , Register::DPP::FrontPanelIOControl );
cbName->AddEntry("DPP::ChannelEnableMask" , Register::DPP::ChannelEnableMask );
cbName->AddEntry("DPP::ROCFPGAFirmwareRevision_R" , Register::DPP::ROCFPGAFirmwareRevision_R );
cbName->AddEntry("DPP::EventStored_R" , Register::DPP::EventStored_R );
cbName->AddEntry("DPP::VoltageLevelModeConfig" , Register::DPP::VoltageLevelModeConfig );
cbName->AddEntry("DPP::SoftwareClockSync_W" , Register::DPP::SoftwareClockSync_W );
cbName->AddEntry("DPP::BoardInfo_R" , Register::DPP::BoardInfo_R );
cbName->AddEntry("DPP::AnalogMonitorMode" , Register::DPP::AnalogMonitorMode );
cbName->AddEntry("DPP::EventSize_R" , Register::DPP::EventSize_R );
cbName->AddEntry("DPP::TimeBombDowncounter_R" , Register::DPP::TimeBombDowncounter_R );
cbName->AddEntry("DPP::FanSpeedControl" , Register::DPP::FanSpeedControl );
cbName->AddEntry("DPP::RunStartStopDelay" , Register::DPP::RunStartStopDelay );
cbName->AddEntry("DPP::BoardFailureStatus_R" , Register::DPP::BoardFailureStatus_R );
cbName->AddEntry("DPP::DisableExternalTrigger" , Register::DPP::DisableExternalTrigger );
cbName->AddEntry("DPP::TriggerValidationMask_G" , Register::DPP::TriggerValidationMask_G );
cbName->AddEntry("DPP::FrontPanelLVDSIONewFeatures" , Register::DPP::FrontPanelLVDSIONewFeatures );
cbName->AddEntry("DPP::BufferOccupancyGain" , Register::DPP::BufferOccupancyGain );
cbName->AddEntry("DPP::ExtendedVetoDelay" , Register::DPP::ExtendedVetoDelay );
cbName->AddEntry("DPP::ReadoutControl" , Register::DPP::ReadoutControl );
cbName->AddEntry("DPP::ReadoutStatus_R" , Register::DPP::ReadoutStatus_R );
cbName->AddEntry("DPP::BoardID" , Register::DPP::BoardID );
cbName->AddEntry("DPP::MCSTBaseAddressAndControl" , Register::DPP::MCSTBaseAddressAndControl );
cbName->AddEntry("DPP::RelocationAddress" , Register::DPP::RelocationAddress );
cbName->AddEntry("DPP::InterruptStatusID" , Register::DPP::InterruptStatusID );
cbName->AddEntry("DPP::InterruptEventNumber" , Register::DPP::InterruptEventNumber );
cbName->AddEntry("DPP::MaxAggregatePerBlockTransfer", Register::DPP::MaxAggregatePerBlockTransfer );
cbName->AddEntry("DPP::Scratch" , Register::DPP::Scratch );
cbName->AddEntry("DPP::SoftwareReset_W" , Register::DPP::SoftwareReset_W );
cbName->AddEntry("DPP::SoftwareClear_W" , Register::DPP::SoftwareClear_W );
cbName->AddEntry("DPP::ConfigurationReload_W" , Register::DPP::ConfigurationReload_W );
cbName->AddEntry("DPP::ROMChecksum_R" , Register::DPP::ROMChecksum_R );
cbName->AddEntry("DPP::ROMChecksumByte2_R" , Register::DPP::ROMChecksumByte2_R );
cbName->AddEntry("DPP::ROMChecksumByte1_R" , Register::DPP::ROMChecksumByte1_R );
cbName->AddEntry("DPP::ROMChecksumByte0_R" , Register::DPP::ROMChecksumByte0_R );
cbName->AddEntry("DPP::ROMConstantByte2_R" , Register::DPP::ROMConstantByte2_R );
cbName->AddEntry("DPP::ROMConstantByte1_R" , Register::DPP::ROMConstantByte1_R );
cbName->AddEntry("DPP::ROMConstantByte0_R" , Register::DPP::ROMConstantByte0_R );
cbName->AddEntry("DPP::ROM_C_Code_R" , Register::DPP::ROM_C_Code_R );
cbName->AddEntry("DPP::ROM_R_Code_R" , Register::DPP::ROM_R_Code_R );
cbName->AddEntry("DPP::ROM_IEEE_OUI_Byte2_R" , Register::DPP::ROM_IEEE_OUI_Byte2_R );
cbName->AddEntry("DPP::ROM_IEEE_OUI_Byte1_R" , Register::DPP::ROM_IEEE_OUI_Byte1_R );
cbName->AddEntry("DPP::ROM_IEEE_OUI_Byte0_R" , Register::DPP::ROM_IEEE_OUI_Byte0_R );
cbName->AddEntry("DPP::ROM_BoardVersion_R" , Register::DPP::ROM_BoardVersion_R );
cbName->AddEntry("DPP::ROM_BoardFromFactor_R" , Register::DPP::ROM_BoardFromFactor_R );
cbName->AddEntry("DPP::ROM_BoardIDByte1_R" , Register::DPP::ROM_BoardIDByte1_R );
cbName->AddEntry("DPP::ROM_BoardIDByte0_R" , Register::DPP::ROM_BoardIDByte0_R );
cbName->AddEntry("DPP::ROM_PCB_rev_Byte3_R" , Register::DPP::ROM_PCB_rev_Byte3_R );
cbName->AddEntry("DPP::ROM_PCB_rev_Byte2_R" , Register::DPP::ROM_PCB_rev_Byte2_R );
cbName->AddEntry("DPP::ROM_PCB_rev_Byte1_R" , Register::DPP::ROM_PCB_rev_Byte1_R );
cbName->AddEntry("DPP::ROM_PCB_rev_Byte0_R" , Register::DPP::ROM_PCB_rev_Byte0_R );
cbName->AddEntry("DPP::ROM_FlashType_R" , Register::DPP::ROM_FlashType_R );
cbName->AddEntry("DPP::ROM_BoardSerialNumByte1_R" , Register::DPP::ROM_BoardSerialNumByte1_R );
cbName->AddEntry("DPP::ROM_BoardSerialNumByte0_R" , Register::DPP::ROM_BoardSerialNumByte0_R );
cbName->AddEntry("DPP::ROM_VCXO_Type_R" , Register::DPP::ROM_VCXO_Type_R );
}
TypeRegisterAddress();
UpdateRegister();
}
std::string RegisterSetting::GetRegisterName(uint32_t address){
uint32_t oldID = cbName->GetSelected();
cbName->Select(address, false);
if( cbName->GetSelected() == -1 ) {
cbName->Select(0, false);
}
std::string haha = cbName->GetSelectedEntry()->GetTitle();
cbName->Select(oldID, false);
return haha;
}
void RegisterSetting::UpdateRegister(){
if( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber();
uint32_t address = cbName->GetSelected();
txtAddress->SetText(Form("0x%04X", address), false);
///check is the register readable
std::string haha = cbName->GetSelectedEntry()->GetTitle();
int type = haha.back();
if( address >= 0x8000 ) {
bSetALLChannel->SetState(kButtonDown);
bSetALLChannel->SetEnabled(false);
for( int ch = 0; ch < digi[boardID]->GetNChannel(); ch++){
txtValueHex[ch]->SetText("", false);
txtValueDec[ch]->SetText("", false);
txtValueUnit[ch]->SetText("", false);
txtValueHex[ch]->SetEnabled(false);
txtValueDec[ch]->SetEnabled(false);
}
txtValueHex[0]->SetEnabled(true);
txtValueDec[0]->SetEnabled(true);
if( type == 87){ /// 'W'
txtValueHex[0]->SetText("Register", false);
txtValueDec[0]->SetText("WRITE", false);
txtValueUnit[0]->SetText("ONLY", false);
txtValueHex[0]->SetEnabled(true);
txtValueDec[0]->SetEnabled(true);
}else{
value[0] = digi[boardID]->ReadRegister(address);
txtValueHex[0]->SetText(Form("0x%08X", value[0]), false);
txtValueDec[0]->SetText(Form("%u", value[0]), false);
if (type == 82 ){ /// Read only
txtValueHex[0]->SetEnabled(false);
txtValueDec[0]->SetEnabled(false);
}else{
txtValueHex[0]->SetEnabled(true);
txtValueDec[0]->SetEnabled(true);
}
}
}else{
bSetALLChannel->SetEnabled(true); /// this will also set the buttonUP
if( type == 87){ /// 'W'
for( int ch = 0; ch < digi[boardID]->GetNChannel(); ch++){
txtValueHex[ch]->SetText("Register", false);
txtValueDec[ch]->SetText("WRITE", false);
txtValueUnit[ch]->SetText("ONLY", false);
txtValueHex[ch]->SetEnabled(true);
txtValueDec[ch]->SetEnabled(true);
}
}else{
for( int ch = 0; ch < digi[boardID]->GetNChannel(); ch++){
if (type == 82 ){ /// Read only
value[ch] = digi[boardID]->ReadRegister(address, ch);
txtValueHex[ch]->SetText(Form("0x%08X", value[ch]), false);
txtValueDec[ch]->SetText(Form("%u", value[ch]), false);
txtValueHex[ch]->SetEnabled(false);
txtValueDec[ch]->SetEnabled(false);
}else{
value[ch] = digi[boardID]->ReadRegister(address, ch);
txtValueHex[ch]->SetText(Form("0x%08X", value[ch]), false);
txtValueDec[ch]->SetText(Form("%u", value[ch]), false);
if( bSetALLChannel->GetState() == kButtonUp){
txtValueHex[ch]->SetEnabled(true);
txtValueDec[ch]->SetEnabled(true);
}
SetTxtValueUnit(address, ch);
if( type == 71 & ch%2 == 1) { /// Paired
txtValueHex[ch]->SetEnabled(false);
txtValueDec[ch]->SetEnabled(false);
}
}
}
}
}
}
void RegisterSetting::SetTxtValueUnit(uint32_t address, int ch){
if( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber();
std::string unit = "";
float valueUnit = 0;
int ch2ns = (int) digi[boardID]->GetCh2ns();
txtValueUnit[ch]->SetText("");
lbValueUnit->SetText("Value [unit]");
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE){ /// PHA
if (address == Register::DPP::PHA::RCCR2SmoothingFactor){
lbValueUnit->SetText("Samples");
if( value[ch] == 0 ){
txtValueUnit[ch]->SetText("Disabled");
}else if( value[ch] == 0x3F ){
txtValueUnit[ch]->SetText("128");
}else{
txtValueUnit[ch]->SetText(Form("%d", 2* value[ch]));
}
}
if( address == Register::DPP::PHA::InputRiseTime ||
address == Register::DPP::PHA::TrapezoidRiseTime ||
address == Register::DPP::PHA::TrapezoidFlatTop ||
address == Register::DPP::PHA::PeakingTime ||
address == Register::DPP::PHA::DecayTime ||
address == Register::DPP::PHA::TriggerHoldOffWidth ||
address == Register::DPP::PHA::PeakHoldOff ||
address == Register::DPP::PHA::ShapedTriggerWidth
){
txtValueUnit[ch]->SetText(Form("%d", 4 * ch2ns * value[ch]));
lbValueUnit->SetText("Value [ns]");
}
if( address == Register::DPP::PHA::TriggerThreshold){
lbValueUnit->SetText("Value [LSB]");
txtValueUnit[ch]->SetText(Form("%d", value[ch]));
}
if( address == Register::DPP::PHA::RiseTimeValidationWindow){
if( value[ch] == 0 ){
txtValueUnit[ch]->SetText("Disabled");
}else{
txtValueUnit[ch]->SetText(Form("%d", ch2ns * value[ch]));
}
lbValueUnit->SetText("Value [ns]");
}
}
if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE){ /// PSD
if( address == Register::DPP::PSD::CFDSetting ){
}
if( address == Register::DPP::PSD::ChargeZeroSuppressionThreshold ){
}
if( address == Register::DPP::PSD::ShortGateWidth ){
}
if( address == Register::DPP::PSD::LongGateWidth ){}
if( address == Register::DPP::PSD::GateOffset ){}
if( address == Register::DPP::PSD::TriggerThreshold ){}
if( address == Register::DPP::PSD::FixedBaseline ){}
if( address == Register::DPP::PSD::TriggerLatency ){}
if( address == Register::DPP::PSD::ShapedTriggerWidth ){}
if( address == Register::DPP::PSD::TriggerHoldOffWidth ){}
if( address == Register::DPP::PSD::ThresholdForPSDCut ){}
if( address == Register::DPP::PSD::PurGapThreshold ){}
if( address == Register::DPP::PSD::EarlyBaselineFreeze ){}
}
if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE || digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE){
if( address == Register::DPP::RecordLength_G ){
txtValueUnit[ch]->SetText(Form("%d", 8 * ch2ns * value[ch]));
lbValueUnit->SetText("Value [ns]");
}
if( address == Register::DPP::InputDynamicRange ){
if( (value[ch] & 0x1 )== 0 ){
txtValueUnit[ch]->SetText("2.0 Vpp");
}else if((value[ch] & 0x1 ) == 1){
txtValueUnit[ch]->SetText("0.5 Vpp");
}
}
if( address == Register::DPP::PreTrigger ){
txtValueUnit[ch]->SetText(Form("%d", 4 * ch2ns * value[ch]));
lbValueUnit->SetText("Value [ns]");
}
if( address == Register::DPP::TriggerHoldOffWidth ){
txtValueUnit[ch]->SetText(Form("%d", 4 * ch2ns * value[ch]));
lbValueUnit->SetText("Value [ns]");
}
if( address == Register::DPP::ChannelDCOffset ){
txtValueUnit[ch]->SetText(Form("%.2f", 100. - value[ch]* 100./0xFFFF));
lbValueUnit->SetText("Value [%]");
}
}
}
unsigned int RegisterSetting::ConvertHexToDec(const char * text){
/// Convert 0xXXXX to int
unsigned int address = 0;
std::stringstream ss ;
ss << std::hex << text;
ss >> address;
return address;
}
void RegisterSetting::TypeRegisterAddress(){
unsigned int address = ConvertHexToDec(txtAddress->GetText());
txtAddress->SetText(Form("0x%04X", address));
cbName->Select(address, false);
if( cbName->GetSelected() == -1 ) {
cbName->Select(0, false);
}else{
UpdateRegister();
}
}
void RegisterSetting::ChangeValue(){
printf("=============%s\n", __func__);
if( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber();
uint32_t address = cbName->GetSelected();
if( bSetALLChannel->GetState() == kButtonDown){
unsigned int newValue1 = ConvertHexToDec(txtValueHex[0]->GetText());
unsigned int newValue2 = atoi(txtValueDec[0]->GetText());
if( value[0] != newValue1){
digi[boardID]->WriteRegister(address, newValue1, -1);
for( int i = 1; i < MaxNChannels ; i++ ) value[i] = newValue1;
UpdateRegister();
}else if(value[0] != newValue2){
digi[boardID]->WriteRegister(address, newValue2, -1);
for( int i = 1; i < MaxNChannels ; i++ ) value[i] = newValue2;
UpdateRegister();
}
}else{
for( int ch = 0; ch < digi[boardID]->GetNChannel(); ch++){
unsigned int newValue1 = ConvertHexToDec(txtValueHex[ch]->GetText());
unsigned int newValue2 = atoi(txtValueDec[ch]->GetText());
if( value[ch] != newValue1){
digi[boardID]->WriteRegister(address, newValue1, ch);
value[ch] = newValue1;
UpdateRegister();
//SendChangeSignal();
}else if(value[ch] != newValue2){
digi[boardID]->WriteRegister(address, newValue2, ch);
value[ch] = newValue2;
UpdateRegister();
//SendChangeSignal();
}
}
}
}
void RegisterSetting::SetAllChannels(){
if( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber();
if( bSetALLChannel->GetState() == kButtonDown ){
for( int ch = 1; ch < digi[boardID]->GetNChannel(); ch++){
txtValueHex[ch]->SetEnabled(false);
txtValueDec[ch]->SetEnabled(false);
}
}else{
UpdateRegister();
}
}
void RegisterSetting::SendChangeSignal(){
Emit("SendChangeSignal()");
}

68
registerSetting.h Normal file
View File

@ -0,0 +1,68 @@
#ifndef SETTING_SUMMARY_H
#define SETTING_SUMMARY_H
#include <TQObject.h>
#include <RQ_OBJECT.h>
#include <TGNumberEntry.h>
#include <TGButton.h>
#include <TGComboBox.h>
#include <TThread.h>
#include <TGLabel.h>
#include "ClassDigitizer.h"
#include "macro.h"
class TGWindow;
class TGMainFrame;
class RegisterSetting{
RQ_OBJECT("RegisterSetting")
private:
TGMainFrame * fMain;
TGNumberEntry * boardIDEntry;
TGTextEntry * txtAddress;
TGComboBox * cbName;
TGCheckButton * bSetALLChannel;
TGTextEntry * txtValueHex[MaxNChannels];
TGTextEntry * txtValueDec[MaxNChannels];
TGTextEntry * txtValueUnit[MaxNChannels];
TGLabel * lbValueUnit;
unsigned int value[MaxNChannels];
int textID;
int nDigi;
Digitizer ** digi;
std::string GetRegisterName(uint32_t address);
unsigned int ConvertHexToDec(const char * text);
void SetTxtValueUnit(uint32_t address, int ch);
public:
RegisterSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard, uint32_t address);
virtual ~RegisterSetting();
void CloseWindow() { delete this;}
void ChangeBoard();
void UpdateRegister();
void TypeRegisterAddress();
void ChangeValue();
void SetAllChannels();
void SendChangeSignal(); // *SIGNAL*
};
#endif

View File

@ -1,29 +0,0 @@
#ifndef SETTING_SUMMARY_H
#define SETTING_SUMMARY_H
#include <TQObject.h>
#include <RQ_OBJECT.h>
#include <TGNumberEntry.h>
#include <TGButton.h>
#include <TGComboBox.h>
#include <TThread.h>
#include <TGLabel.h>
#include "DigitizerPHA.h"
#include "DigitizerPSD.h"
#include "macro.h"
class TGWindow;
class TGMainFrame;
class SettingSummary{
private:
public:
SettingSummary(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard, uint32_t address);
virtual ~SettingSummary();
}
#endif

View File

@ -139,7 +139,7 @@ int main(int argc, char* argv[]){
dig[0]->ReadData(); dig[0]->ReadData();
if( data->nByte > 0 ){ if( data->nByte > 0 ){
data->SaveBuffer("test.bin"); data->SaveBuffer("test");
data->DecodeBuffer(0); data->DecodeBuffer(0);
unsigned short nData = data->NumEvents[0]; //channel-0 unsigned short nData = data->NumEvents[0]; //channel-0

View File

@ -79,11 +79,11 @@ void PrintChannelSettingFromDigitizer(int handle, int ch, float ch2ns){
printf("==========----- Other \n"); printf("==========----- Other \n");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::FineGain + (ch << 8), value); printf("%24s %d = 0x%x\n", "Energy fine gain", value[0], value[0]); ///Energy fine gain CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::FineGain + (ch << 8), value); printf("%24s %d = 0x%x\n", "Energy fine gain", value[0], value[0]); ///Energy fine gain
CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelADCTemperature + (ch << 8), value); printf("%24s %d C\n", "Temperature", value[0]); ///Temperature CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelADCTemperature_R + (ch << 8), value); printf("%24s %d C\n", "Temperature", value[0]); ///Temperature
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::RiseTimeValidationWindow + (ch << 8), value); printf("%24s %.0f ns \n", "RiseTime Vaild Win.", value[0] * ch2ns); CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::RiseTimeValidationWindow + (ch << 8), value); printf("%24s %.0f ns \n", "RiseTime Vaild Win.", value[0] * ch2ns);
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::ChannelStopAcquisition + (ch << 8), value); printf("%24s %d = %s \n", "Stop Acq bit", value[0] & 1 , (value[0] & 1 ) == 0 ? "Run" : "Stop"); CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::ChannelStopAcquisition + (ch << 8), value); printf("%24s %d = %s \n", "Stop Acq bit", value[0] & 1 , (value[0] & 1 ) == 0 ? "Run" : "Stop");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelStatus + (ch << 8), value); printf("%24s 0x%x \n", "Status bit", (value[0] & 0xff) ); CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelStatus_R + (ch << 8), value); printf("%24s 0x%x \n", "Status bit", (value[0] & 0xff) );
CAEN_DGTZ_ReadRegister(handle, Register::DPP::AMCFirmwareRevision + (ch << 8), value); printf("%24s 0x%x \n", "AMC firmware rev.", value[0] ); CAEN_DGTZ_ReadRegister(handle, Register::DPP::AMCFirmwareRevision_R + (ch << 8), value); printf("%24s 0x%x \n", "AMC firmware rev.", value[0] );
CAEN_DGTZ_ReadRegister(handle, Register::DPP::VetoWidth + (ch << 8), value); printf("%24s 0x%x \n", "VetoWidth bit", value[0] ); CAEN_DGTZ_ReadRegister(handle, Register::DPP::VetoWidth + (ch << 8), value); printf("%24s 0x%x \n", "VetoWidth bit", value[0] );
printf("%24s %d = %s\n", "RollOverFlag, DPP-[26]", rollOver, rollOver ? "enable" : "disable" ); printf("%24s %d = %s\n", "RollOverFlag, DPP-[26]", rollOver, rollOver ? "enable" : "disable" );
printf("%24s %d = %s\n", "Pile-upFlag, DPP-[27]", pileUp, pileUp ? "enable" : "disable" ); printf("%24s %d = %s\n", "Pile-upFlag, DPP-[27]", pileUp, pileUp ? "enable" : "disable" );