the price for adjust setting directly to register is need to manually allocate memory.
This commit is contained in:
parent
1f943d8ded
commit
972c249076
23
ClassData.h
23
ClassData.h
|
@ -46,8 +46,29 @@ class Data{
|
|||
}
|
||||
}
|
||||
|
||||
void AllocateMemory(int handle){
|
||||
int ret = CAEN_DGTZ_MallocReadoutBuffer(handle, &buffer, &AllocatedSize); /// output: buffer and allocatedSize
|
||||
ret |= CAEN_DGTZ_MallocDPPEvents(handle, reinterpret_cast<void**>(&Events), &AllocatedSize) ;
|
||||
for( int i = 0 ; i < MaxNChannels; i++){
|
||||
ret |= CAEN_DGTZ_MallocDPPWaveforms(handle, reinterpret_cast<void**>(&Waveform[i]), &AllocatedSize);
|
||||
}
|
||||
if (ret != 0) {
|
||||
printf("Can't allocate memory buffers\n");
|
||||
CAEN_DGTZ_SWStopAcquisition(handle);
|
||||
CAEN_DGTZ_CloseDigitizer(handle);
|
||||
CAEN_DGTZ_FreeReadoutBuffer(&buffer);
|
||||
CAEN_DGTZ_FreeDPPEvents(handle, reinterpret_cast<void**>(&Events));
|
||||
}else{
|
||||
printf("====== Allocated %d byte memory for data buffer.\n", AllocatedSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FreeMemory(int handle){
|
||||
printf("======= Free memory \n");
|
||||
CAEN_DGTZ_FreeReadoutBuffer(&buffer);
|
||||
CAEN_DGTZ_FreeDPPEvents(handle, reinterpret_cast<void**>(&Events));
|
||||
CAEN_DGTZ_FreeDPPWaveforms(handle, Waveform);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ Digitizer::Digitizer(){
|
|||
|
||||
ret = -1;
|
||||
isConnected = false;
|
||||
AcqRun = false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -96,33 +97,34 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool verbose){
|
|||
}
|
||||
int DPPType;
|
||||
sscanf(BoardInfo.AMC_FirmwareRel, "%d", &DPPType);
|
||||
if (DPPType != V1730_DPP_PHA_CODE) {
|
||||
if (DPPType < 128) {
|
||||
if( verbose) printf("This digitizer does not have DPP-PHA firmware\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check firmware revision (DPP firmwares cannot be used with this demo */
|
||||
///====================== Check DPP firmware revision
|
||||
sscanf(BoardInfo.AMC_FirmwareRel, "%d", &DPPType);
|
||||
if (DPPType >= 128 && verbose) {
|
||||
if (DPPType >= 0x80 && verbose) {
|
||||
printf("\t==== This digitizer has a DPP firmware!\n");
|
||||
printf("\e[32m");
|
||||
switch (DPPType){
|
||||
case 0x80: printf("\tDPP-PHA for x724 boards \n"); break;
|
||||
case 0x82: printf("\tDPP-CI for x720 boards \n"); break;
|
||||
case 0x83: printf("\tDPP-PSD for x720 boards \n"); break;
|
||||
case 0x84: printf("\tDPP-PSD for x751 boards \n"); break;
|
||||
case 0x85: printf("\tDPP-ZLE for x751 boards \n"); break;
|
||||
case 0x86: printf("\tDPP-PSD for x743 boards \n"); break;
|
||||
case 0x87: printf("\tDPP-QDC for x740 boards \n"); break;
|
||||
case 0x88: printf("\tDPP-PSD for x730 boards \n"); break;
|
||||
case 0x8B: printf("\tDPP-PHA for x730 boards \n"); break;
|
||||
case 0x8C: printf("\tDPP-ZLE for x730 boards \n"); break;
|
||||
case 0x8D: printf("\tDPP-DAW for x730 boards \n"); break;
|
||||
case V1724_DPP_PHA_CODE: printf("\tDPP-PHA for x724 boards \n"); break;
|
||||
case V1720_DPP_CI_CODE : printf("\tDPP-CI for x720 boards \n"); break;
|
||||
case V1720_DPP_PSD_CODE: printf("\tDPP-PSD for x720 boards \n"); break;
|
||||
case V1751_DPP_PSD_CODE: printf("\tDPP-PSD for x751 boards \n"); break;
|
||||
case V1751_DPP_ZLE_CODE: printf("\tDPP-ZLE for x751 boards \n"); break;
|
||||
case V1743_DPP_CI_CODE: printf("\tDPP-PSD for x743 boards \n"); break;
|
||||
case V1740_DPP_QDC_CODE: printf("\tDPP-QDC for x740 boards \n"); break;
|
||||
case V1730_DPP_PSD_CODE: printf("\tDPP-PSD for x730 boards \n"); break;
|
||||
case V1730_DPP_PHA_CODE: printf("\tDPP-PHA for x730 boards \n"); break;
|
||||
case V1730_DPP_ZLE_CODE: printf("\tDPP-ZLE for x730 boards \n"); break;
|
||||
case V1730_DPP_DAW_CODE: printf("\tDPP-DAW for x730 boards \n"); break;
|
||||
}
|
||||
printf("\e[0m");
|
||||
}
|
||||
|
||||
///======================= Check virtual probe
|
||||
int probes[MAX_SUPPORTED_PROBES];
|
||||
int numProbes;
|
||||
ret = CAEN_DGTZ_GetDPP_SupportedVirtualProbes(handle, 1, probes, &numProbes);
|
||||
|
@ -184,6 +186,8 @@ int Digitizer::CloseDigitizer(){
|
|||
ret = CAEN_DGTZ_SWStopAcquisition(handle);
|
||||
ret |= CAEN_DGTZ_CloseDigitizer(handle);
|
||||
|
||||
data->FreeMemory(handle);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -279,6 +283,64 @@ int Digitizer::ProgramBoard(){
|
|||
|
||||
}
|
||||
|
||||
//========================================================= ACQ control
|
||||
void Digitizer::StartACQ(){
|
||||
if ( AcqRun ) return;
|
||||
ret = CAEN_DGTZ_SWStartAcquisition(handle);
|
||||
if( ret != 0 ) {
|
||||
ErrorMsg("Start ACQ");
|
||||
return;
|
||||
}
|
||||
printf("Acquisition Started for Board %d\n", boardID);
|
||||
AcqRun = true;
|
||||
}
|
||||
|
||||
void Digitizer::StopACQ(){
|
||||
if( !AcqRun ) return;
|
||||
int ret = CAEN_DGTZ_SWStopAcquisition(handle);
|
||||
ret |= CAEN_DGTZ_ClearData(handle);
|
||||
if( ret != 0 ) ErrorMsg("something wrong when try to stop ACQ and clear buffer");
|
||||
printf("\n\e[1m\e[33m====== Acquisition STOPPED for Board %d\e[0m\n", boardID);
|
||||
AcqRun = false;
|
||||
}
|
||||
|
||||
void Digitizer::ReadData(){
|
||||
|
||||
uint32_t BufferSize = 10000000;
|
||||
|
||||
//char buffer[10000];
|
||||
char *buffer;
|
||||
|
||||
buffer = (char *) malloc( BufferSize);
|
||||
//ret = CAEN_DGTZ_MallocReadoutBuffer(handle, &buffer, &BufferSize);
|
||||
printf("Allocated %d byte for buffer \n", BufferSize);
|
||||
//ErrorMsg("CAEN_DGTZ_MallocReadoutBuffer");
|
||||
|
||||
CAEN_DGTZ_DPP_PHA_Event_t * Events[MaxNChannels]; /// events buffer
|
||||
for( int i = 0 ; i < MaxNChannels ; i++ ) Events[i] = (CAEN_DGTZ_DPP_PHA_Event_t *) malloc( BufferSize);
|
||||
//ret = CAEN_DGTZ_MallocDPPEvents(handle, reinterpret_cast<void**>(&Events), &BufferSize) ;
|
||||
printf("Allocated %d byte for Events \n", BufferSize);
|
||||
//ErrorMsg("CAEN_DGTZ_MallocReadoutBuffer");
|
||||
|
||||
ret = CAEN_DGTZ_ReadData(handle, CAEN_DGTZ_SLAVE_TERMINATED_READOUT_MBLT, buffer, &BufferSize);
|
||||
printf("Read Buffer size %d byte \n", BufferSize);
|
||||
if (ret) {
|
||||
ErrorMsg("ReadData");
|
||||
return;
|
||||
}
|
||||
data->nByte = BufferSize;
|
||||
if (data->nByte == 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t NumEvents[MaxNChannels];
|
||||
ret = (CAEN_DGTZ_ErrorCode) CAEN_DGTZ_GetDPPEvents(handle, buffer, BufferSize, reinterpret_cast<void**>(&Events), NumEvents);
|
||||
for( int i = 0 ; i < MaxNChannels; i++){
|
||||
printf(" extracted %d events in ch-%02d\n", NumEvents[i], i);
|
||||
}
|
||||
ErrorMsg("GetDPPEvents");
|
||||
}
|
||||
|
||||
//===========================================================
|
||||
void Digitizer::WriteRegister(uint32_t address, uint32_t value, int ch ){
|
||||
/// only for channel setting.
|
||||
|
@ -311,6 +373,7 @@ uint32_t Digitizer::ReadRegister(uint32_t address, int ch, string str ){
|
|||
void Digitizer::SetChannelMask(uint32_t mask){
|
||||
channelMask = mask;
|
||||
ret |= CAEN_DGTZ_SetChannelEnableMask(handle, channelMask);
|
||||
EditByteByRegister(Register::DPP::ChannelEnableMask);
|
||||
ErrorMsg("SetChannelMask");
|
||||
}
|
||||
|
||||
|
@ -318,7 +381,6 @@ void Digitizer::SetRecordLength(unsigned int ns, int ch){
|
|||
int ch_coupled = ch + int(pow(-1, ch));
|
||||
WriteRegister( Register::DPP::RecordLength_G, ns / ch2ns / 8 , ch);
|
||||
WriteRegister( Register::DPP::RecordLength_G, ns / ch2ns / 8 , ch_coupled);
|
||||
|
||||
ErrorMsg("SetRecordLength");
|
||||
}
|
||||
|
||||
|
@ -401,6 +463,8 @@ void Digitizer::SetBits(uint32_t address, unsigned int bitValue, unsigned int bi
|
|||
if( ret != 0 ) ErrorMsg("SetBits");
|
||||
}
|
||||
|
||||
void Digitizer::SetExtra2WordOutput(bool OnOff) { SetBits(Register::BoardConfiguration, OnOff, 1, 17); ErrorMsg("PHA-SetExtra2WordOutput");}
|
||||
|
||||
int Digitizer::SetAcqMode(string list_mixed){
|
||||
|
||||
if( list_mixed == "list"){
|
||||
|
@ -430,6 +494,8 @@ int Digitizer::SetAcqMode(string list_mixed){
|
|||
ret = CAEN_DGTZ_SetDPPAcquisitionMode(handle, AcqMode, CAEN_DGTZ_DPP_SAVE_PARAM_EnergyAndTime);
|
||||
}
|
||||
|
||||
SetExtra2WordOutput(true);
|
||||
|
||||
if( ret == 0 ) {
|
||||
printf("Setting digitizer to \e[33m%s\e[0m mode.\n", list_mixed.c_str());
|
||||
}else{
|
||||
|
@ -457,6 +523,10 @@ void Digitizer::PrintACQStatue(){
|
|||
|
||||
unsigned int status = ReadRegister(Register::DPP::AcquisitionStatus);
|
||||
|
||||
printf("=================== Print ACQ status \n");
|
||||
printf(" 32 28 24 20 16 12 8 4 0\n");
|
||||
printf(" | | | | | | | | |\n");
|
||||
cout <<" 0b" << bitset<32>(status) << endl;
|
||||
printf(" Acq state (0x%1x): %s \n", (status >> 2) & 0x1, ((status >> 2) & 0x1) == 0? "stopped" : "running");
|
||||
printf(" Event Ready (0x%1x): %s \n", (status >> 3) & 0x1, ((status >> 3) & 0x1) == 0? "no event in buffer" : "event in buffer");
|
||||
printf(" Event Full (0x%1x): %s \n", (status >> 4) & 0x1, ((status >> 4) & 0x1) == 0? "not full" : "full");
|
||||
|
@ -476,6 +546,7 @@ void Digitizer::OpenSettingBinary(string fileName){
|
|||
settingFile = fopen(fileName.c_str(), "r+");
|
||||
if( settingFile == NULL ){
|
||||
printf("cannot open file %s. \n", fileName.c_str());
|
||||
CreateAndSaveSettingBinary(fileName);
|
||||
}else{
|
||||
settingFileExist = true;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
using namespace std;
|
||||
|
||||
//################################################################
|
||||
|
||||
class Digitizer{
|
||||
|
||||
public:
|
||||
|
@ -27,6 +26,8 @@ class Digitizer{
|
|||
Digitizer(int boardID, int portID = 0);
|
||||
~Digitizer();
|
||||
|
||||
Data * data;
|
||||
|
||||
void Reset();
|
||||
int OpenDigitizer(int boardID, int portID = 0, bool verbose = false);/// portID is for optical link for using PCIe card, from 0, 1, 2, 3
|
||||
int CloseDigitizer();
|
||||
|
@ -49,6 +50,7 @@ class Digitizer{
|
|||
void SetBits(uint32_t address, unsigned int bitValue, unsigned int bitLength, unsigned int bitSmallestPos, int ch = -1);
|
||||
void SetDPPAlgorithmControl(uint32_t bit, int ch = -1);
|
||||
|
||||
void SetExtra2WordOutput(bool OnOff);
|
||||
int SetAcqMode(string list_mixed);
|
||||
|
||||
///================ Get Settings
|
||||
|
@ -56,6 +58,7 @@ class Digitizer{
|
|||
int GetChannelMask() {return channelMask;}
|
||||
float GetCh2ns() {return ch2ns;}
|
||||
int GetNChannel() {return NChannel;}
|
||||
int GetHandle() {return handle;}
|
||||
|
||||
int GetChTemperature(int ch) ;
|
||||
|
||||
|
@ -68,9 +71,11 @@ class Digitizer{
|
|||
///================ ACQ control
|
||||
void StopACQ();
|
||||
void StartACQ();
|
||||
void ReadData();
|
||||
|
||||
///================ Setting
|
||||
void OpenSettingBinary(string fileName);
|
||||
//TODO void LoadSettingBinary(string fileName);
|
||||
void CreateAndSaveSettingBinary(string fileName);
|
||||
void EditByte(unsigned int value, uint32_t filePos);
|
||||
void EditByteByRegister(uint32_t registerAddress, int ch = -1);
|
||||
|
@ -96,12 +101,10 @@ class Digitizer{
|
|||
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)
|
||||
CAEN_DGTZ_DPP_AcqMode_t AcqMode;
|
||||
|
||||
Data * data;
|
||||
|
||||
|
||||
///------- other parameters
|
||||
int ret; /// return value, refer to CAEN_DGTZ_ErrorCode
|
||||
bool isConnected;
|
||||
bool AcqRun;
|
||||
|
||||
/// ------- setting
|
||||
string settingFileName;
|
||||
|
|
|
@ -13,6 +13,7 @@ DigitizerPHA::~DigitizerPHA(){
|
|||
}
|
||||
|
||||
int DigitizerPHA::ProgramBoard(){
|
||||
printf("program board and channels\n");
|
||||
Digitizer::ProgramBoard();
|
||||
/// Set trigger propagation
|
||||
/// Set analog probe 1 to input
|
||||
|
@ -23,18 +24,50 @@ int DigitizerPHA::ProgramBoard(){
|
|||
/// record energy
|
||||
/// digitial virtual probe 1 = Peaking
|
||||
/// digitial virtual probe 2 = trigger
|
||||
ret |= CAEN_DGTZ_WriteRegister(handle, Register::BoardConfiguration , 0x000E8114); /// Channel Control Reg (indiv trg, seq readout) ??
|
||||
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardConfiguration , 0x000F8114);
|
||||
|
||||
ErrorMsg("PHA-ProgramBoard");
|
||||
|
||||
SetRecordLength(2000);
|
||||
SetPreTriggerDuration(500);
|
||||
SetBaselineSampling(0x11);
|
||||
SetDCOffset(0.2);
|
||||
SetInputDynamicRange(1);
|
||||
SetPulsePolarity(0);
|
||||
|
||||
SetTriggerThreshold(200);
|
||||
SetTriggerHoldOff(480);
|
||||
SetTriggerSmoothingFactor(2);
|
||||
SetTriggerOutputWidth(50);
|
||||
SetInputRiseTime(96);
|
||||
|
||||
SetTrapezoidRescaling(31);
|
||||
SetTrapezoidRiseTime(200);
|
||||
SetTrapezoidFlatTop(50);
|
||||
SetDecayTime(10000);
|
||||
SetPeakingTime(50);
|
||||
SetPeakingHoldOff(1000);
|
||||
SetPeakSampling(2);
|
||||
|
||||
SetEnergyFineGain(1);
|
||||
SetRiseTimeValidWindow(10);
|
||||
SetEventAggregation(0);
|
||||
SetRollOverFlag(1);
|
||||
SetPileUpFlag(1);
|
||||
SetExtra2WordOption(2);
|
||||
|
||||
ErrorMsg("PHA-ProgramBoard");
|
||||
printf("End of program board and channels\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DigitizerPHA::SetAnalogProbe1(unsigned int bit) { SetBits(Register::BoardConfiguration, bit, 2, 12); ErrorMsg("PHA-SetAnalogProbe1"); }
|
||||
void DigitizerPHA::SetAnalogProbe2(unsigned int bit) { SetBits(Register::BoardConfiguration, bit, 2, 14); ErrorMsg("PHA-SetAnalogProbe1"); }
|
||||
void DigitizerPHA::SetWaveFormRecording(bool OnOff) { SetBits(Register::BoardConfiguration, OnOff, 1, 16); ErrorMsg("PHA-SetWaveFormRecording"); }
|
||||
void DigitizerPHA::SetExtra2WordOutput(bool OnOff) { SetBits(Register::BoardConfiguration, OnOff, 1, 17); ErrorMsg("PHA-SetExtra2WordOutput");}
|
||||
void DigitizerPHA::SetTimeStampRecording(bool OnOff) { SetBits(Register::BoardConfiguration, OnOff, 1, 18); ErrorMsg("PHA-SetTimeStampRecording"); }
|
||||
void DigitizerPHA::SetEnergyRecording(bool OnOff) { SetBits(Register::BoardConfiguration, OnOff, 1, 19); ErrorMsg("PHA-SetEnergyRecording");}
|
||||
void DigitizerPHA::SetVirtualProbe1(unsigned int bit){ SetBits(Register::BoardConfiguration, bit, 4, 20); ErrorMsg("PHA-SetVirtualProbe1"); }
|
||||
void DigitizerPHA::SetAnalogProbe1(unsigned int bit) { SetBits(Register::DPP::BoardConfiguration, bit, 2, 12); ErrorMsg("PHA-SetAnalogProbe1"); }
|
||||
void DigitizerPHA::SetAnalogProbe2(unsigned int bit) { SetBits(Register::DPP::BoardConfiguration, bit, 2, 14); ErrorMsg("PHA-SetAnalogProbe1"); }
|
||||
void DigitizerPHA::SetWaveFormRecording(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 16); ErrorMsg("PHA-SetWaveFormRecording"); }
|
||||
void DigitizerPHA::SetTimeStampRecording(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 18); ErrorMsg("PHA-SetTimeStampRecording"); }
|
||||
void DigitizerPHA::SetEnergyRecording(bool OnOff) { SetBits(Register::DPP::BoardConfiguration, OnOff, 1, 19); ErrorMsg("PHA-SetEnergyRecording");}
|
||||
void DigitizerPHA::SetVirtualProbe1(unsigned int bit){ SetBits(Register::DPP::BoardConfiguration, bit, 4, 20); ErrorMsg("PHA-SetVirtualProbe1"); }
|
||||
|
||||
void DigitizerPHA::SetTrapezoidRescaling(unsigned int rightShiftBits, int ch ){ SetBits(Register::DPP::DPPAlgorithmControl, rightShiftBits, 5, 0, ch); ErrorMsg("SetTrapezoidRescaling"); }
|
||||
void DigitizerPHA::SetPeakSampling(unsigned int bit, int ch) { SetBits(Register::DPP::DPPAlgorithmControl, bit, 2, 12, ch); ErrorMsg("SetPeakSampling");}
|
||||
|
@ -61,6 +94,9 @@ void DigitizerPHA::SetRiseTimeValidWindow(unsigned int nSample, int ch ){ WriteR
|
|||
|
||||
void DigitizerPHA::PrintBoardConfiguration(){
|
||||
if( !isConnected ) return;
|
||||
printf("\e[33m================================================\n");
|
||||
printf("================ Setting for Board \n");
|
||||
printf("================================================\e[0m\n");
|
||||
uint32_t * value = new uint32_t[1];
|
||||
CAEN_DGTZ_ReadRegister(handle, (uint32_t) Register::BoardConfiguration, value);
|
||||
printf(" 32 28 24 20 16 12 8 4 0\n");
|
||||
|
@ -97,13 +133,13 @@ void DigitizerPHA::PrintBoardConfiguration(){
|
|||
printf("====================================== \n");
|
||||
}
|
||||
|
||||
void DigitizerPHA::GetChannelSettingFromDigitizer(int ch){
|
||||
void DigitizerPHA::PrintChannelSettingFromDigitizer(int ch){
|
||||
if( !isConnected ) return;
|
||||
uint32_t * value = new uint32_t[NChannel];
|
||||
printf("\e[33m================================================\n");
|
||||
printf("================ Setting for channel %d \n", ch);
|
||||
printf("================================================\e[0m\n");
|
||||
///DPP algorithm Control
|
||||
uint32_t * value = new uint32_t[NChannel];
|
||||
CAEN_DGTZ_ReadRegister(handle, Register::DPP::DPPAlgorithmControl + (ch << 8), value);
|
||||
printf(" 32 28 24 20 16 12 8 4 0\n");
|
||||
printf(" | | | | | | | | |\n");
|
||||
|
|
|
@ -15,7 +15,6 @@ class DigitizerPHA : public Digitizer {
|
|||
void SetAnalogProbe1(unsigned int bit);
|
||||
void SetAnalogProbe2(unsigned int bit);
|
||||
void SetWaveFormRecording(bool OnOff);
|
||||
void SetExtra2WordOutput(bool OnOff);
|
||||
void SetTimeStampRecording(bool OnOff);
|
||||
void SetEnergyRecording(bool OnOff);
|
||||
void SetVirtualProbe1(unsigned int bit);
|
||||
|
@ -44,7 +43,7 @@ class DigitizerPHA : public Digitizer {
|
|||
void SetRiseTimeValidWindow(unsigned int nSample, int ch = -1 );
|
||||
|
||||
void PrintBoardConfiguration();
|
||||
void GetChannelSettingFromDigitizer(int ch);
|
||||
void PrintChannelSettingFromDigitizer(int ch);
|
||||
|
||||
};
|
||||
|
||||
|
|
138
test.cpp
138
test.cpp
|
@ -3,136 +3,38 @@
|
|||
|
||||
int main(int argc, char* argv[]){
|
||||
|
||||
DigitizerPHA * dig = new DigitizerPHA[1];
|
||||
const int nBoard = 1;
|
||||
DigitizerPHA *dig = new DigitizerPHA[nBoard];
|
||||
//DigitizerPSD * psd = new DigitizerPSD();
|
||||
|
||||
dig[0].OpenDigitizer(0,0, true);
|
||||
for( int i = 0 ; i < nBoard; i++){
|
||||
int board = i % 3;
|
||||
int port = i/3;
|
||||
dig[i].OpenDigitizer(board, port, true);
|
||||
dig[i].OpenSettingBinary("setting_" + to_string(dig[i].GetSerialNumber()) + ".bin");
|
||||
dig[i].SetAcqMode("list");
|
||||
//dig[i].PrintACQStatue();
|
||||
}
|
||||
|
||||
//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].PrintBoardConfiguration();
|
||||
//dig[0].PrintChannelSettingFromDigitizer(15);
|
||||
|
||||
//Data * data = dig[0].data;
|
||||
|
||||
|
||||
//dig[0].CreateAndSaveSettingBinary("setting_" + to_string(dig[0].GetSerialNumber()) + ".bin");
|
||||
dig[0].OpenSettingBinary("setting_" + to_string(dig[0].GetSerialNumber()) + ".bin");
|
||||
//data->AllocateMemory(dig[0].GetHandle());
|
||||
dig[0].StartACQ();
|
||||
|
||||
dig[0].SetAcqMode("mixed");
|
||||
dig[0].PrintACQStatue();
|
||||
sleep(2);
|
||||
|
||||
//
|
||||
//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));
|
||||
dig[0].ReadData();
|
||||
|
||||
//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));
|
||||
//printf("|%s|\n", data->buffer);
|
||||
|
||||
/* 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].StopACQ();
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user