FSUDAQ/test.cpp

138 lines
4.6 KiB
C++
Raw Normal View History

#include "DigitizerPHA.h"
//#include "DigitizerPSD.h"
2022-08-03 19:00:41 -04:00
int main(int argc, char* argv[]){
2022-08-09 16:02:45 -04:00
DigitizerPHA * dig = new DigitizerPHA[1];
//DigitizerPSD * psd = new DigitizerPSD();
2022-08-03 19:00:41 -04:00
2022-08-04 18:02:03 -04:00
dig[0].OpenDigitizer(0,0, true);
2022-08-09 16:02:45 -04:00
//dig[0].ReadRegister(Register::DPP::BoardConfiguration, -1, "Board configure");
//dig[0].ReadRegister(Register::DPP::ROM_BoardIDByte0, -1, "Board ID Byte 0");
//dig[0].ReadRegister(Register::DPP::ROM_BoardIDByte1, -1, "Board ID Byte 1");
//dig[0].ReadRegister(Register::DPP::ROM_BoardSerialNumByte0, -1, "Board SN Byte 1");
//dig[0].ReadRegister(Register::DPP::ROM_BoardSerialNumByte1, -1, "Board SN Byte 0");
//dig[0].ReadRegister(Register::DPP::AMCFirmwareRevision, 0, "AMCFirmware");
//dig[0].ReadRegister(Register::DPP::ROCFPGAFirmwareRevision, 0, "ROC FPGA");
//dig[0].ReadRegister(Register::DPP::GlobalTriggerMask, 0, "trigger mask");
//dig[0].ReadRegister(Register::DPP::ChannelEnableMask, 0, "Channel mask");
//
//
//dig[0].ReadRegister(Register::DPP::PHA::TriggerThreshold, 0, "trigger threshold");
2022-08-09 16:02:45 -04:00
//dig[0].CreateAndSaveSettingBinary("test.bin");
dig[0].OpenSettingBinary("test.bin");
//
//printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::BoardConfiguration));
//printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::GlobalTriggerMask));
//printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::PHA::TriggerThreshold, 0));
printf("======================= \n");
dig[0].SetRecordLength(2000);
2022-08-09 16:02:45 -04:00
dig[0].GetChannelSettingFromDigitizer(0);
2022-08-09 16:02:45 -04:00
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 0));
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 4));
2022-08-09 16:02:45 -04:00
dig[0].SetRecordLength(4000);
2022-08-09 16:02:45 -04:00
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 0));
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 3));
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 6));
dig[0].SetRecordLength(3000, 0);
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 0));
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 1));
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 2));
2022-08-09 16:02:45 -04:00
/* dig[1].OpenDigitizer(1,0, true);
/*
dig[2].OpenDigitizer(2,0, true);
dig[3].OpenDigitizer(0,1, true);
dig[4].OpenDigitizer(1,1, true);
dig[5].OpenDigitizer(2,1, true);
dig[6].OpenDigitizer(0,2, true);
dig[7].OpenDigitizer(1,2, true);
dig[8].OpenDigitizer(2,2, true);
//dig[1].OpenDigitizer(1,0, true);
2022-08-03 19:00:41 -04:00
//psd->OpenDigitizer(2,0);
2022-08-03 19:00:41 -04:00
2022-08-09 16:02:45 -04:00
/*
2022-08-03 19:00:41 -04:00
printf("======================= \n");
dig[0].SetRecordLength(3000);
dig[0].SetPreTriggerDuration(600);
dig[0].SetBaselineSampling(1);
dig[0].SetDCOffset(0.2);
dig[0].SetInputDynamicRange(0);
dig[0].SetPulsePolarity(0);
2022-08-03 19:00:41 -04:00
dig[0].SetTriggerThreshold(320);
dig[0].SetTriggerHoldOff(20);
dig[0].SetTriggerSmoothingFactor(4);
dig[0].SetTriggerOutputWidth(50);
dig[0].SetInputRiseTime(16);
2022-08-05 16:32:46 -04:00
dig[0].SetTrapezoidRescaling(31);
dig[0].SetTrapezoidRiseTime(100);
dig[0].SetTrapezoidFlatTop(50);
dig[0].SetDecayTime(5000);
dig[0].SetPeakingTime(20);
dig[0].SetPeakingHoldOff(100);
dig[0].SetPeakSampling(2);
dig[0].SetEnergyFineGain(2);
dig[0].SetRiseTimeValidWindow(10);
dig[0].SetEventAggregation(3);
dig[0].SetRollOverFlag(1);
2022-08-05 16:32:46 -04:00
dig[0].SetPileUpFlag(1);
dig[0].SetExtra2WordOption(2);
2022-08-03 19:00:41 -04:00
dig[0].SetRecordLength(1000, 2);
dig[0].SetPreTriggerDuration(400, 2);
dig[0].SetBaselineSampling(3, 2);
dig[0].SetDCOffset(0.4, 2);
dig[0].SetInputDynamicRange(1, 2);
dig[0].SetPulsePolarity(1, 2);
dig[0].SetTriggerThreshold(220, 2);
dig[0].SetTriggerHoldOff(40, 2);
dig[0].SetTriggerSmoothingFactor(2, 2);
dig[0].SetTriggerOutputWidth(100, 2);
dig[0].SetInputRiseTime(100, 2);
dig[0].SetTrapezoidRescaling(31, 2);
dig[0].SetTrapezoidRiseTime(150, 2);
dig[0].SetTrapezoidFlatTop(100, 2);
dig[0].SetDecayTime(6000, 2);
dig[0].SetPeakingTime(30, 2);
dig[0].SetPeakingHoldOff(150, 2);
dig[0].SetPeakSampling(3, 2);
dig[0].SetEnergyFineGain(5, 2);
dig[0].SetRiseTimeValidWindow(40, 2);
dig[0].SetEventAggregation(5, 2);
dig[0].SetRollOverFlag(0, 2);
dig[0].SetPileUpFlag(0, 2);
dig[0].SetExtra2WordOption(0, 2);
2022-08-03 19:00:41 -04:00
dig[0].PrintBoardConfiguration();
dig[0].GetChannelSettingFromDigitizer(0);
dig[0].GetChannelSettingFromDigitizer(2);
2022-08-03 19:00:41 -04:00
dig[0].SetAcqMode("mixed");
2022-08-09 16:02:45 -04:00
*/
2022-08-03 19:00:41 -04:00
delete [] dig;
//delete psd;
2022-08-03 19:00:41 -04:00
return 0;
}