FSUDAQ/test.cpp
2022-08-09 17:31:36 -04:00

141 lines
4.8 KiB
C++

#include "DigitizerPHA.h"
//#include "DigitizerPSD.h"
int main(int argc, char* argv[]){
DigitizerPHA * dig = new DigitizerPHA[1];
//DigitizerPSD * psd = new DigitizerPSD();
dig[0].OpenDigitizer(0,0, true);
//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");
//dig[0].CreateAndSaveSettingBinary("setting_" + to_string(dig[0].GetSerialNumber()) + ".bin");
dig[0].OpenSettingBinary("setting_" + to_string(dig[0].GetSerialNumber()) + ".bin");
dig[0].SetAcqMode("mixed");
dig[0].PrintACQStatue();
//
//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);
//
//dig[0].GetChannelSettingFromDigitizer(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, 4));
//
//dig[0].SetRecordLength(4000);
//
//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));
/* 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);
//psd->OpenDigitizer(2,0);
/*
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);
dig[0].SetTriggerThreshold(320);
dig[0].SetTriggerHoldOff(20);
dig[0].SetTriggerSmoothingFactor(4);
dig[0].SetTriggerOutputWidth(50);
dig[0].SetInputRiseTime(16);
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);
dig[0].SetPileUpFlag(1);
dig[0].SetExtra2WordOption(2);
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);
dig[0].PrintBoardConfiguration();
dig[0].GetChannelSettingFromDigitizer(0);
dig[0].GetChannelSettingFromDigitizer(2);
dig[0].SetAcqMode("mixed");
*/
delete [] dig;
//delete psd;
return 0;
}