#include "DigitizerPHA.h" #include "DigitizerPSD.h" #include "ClassData.h" int main(int argc, char* argv[]){ /************** const int nBoard = 1; DigitizerPHA *dig = new DigitizerPHA[nBoard]; //DigitizerPSD * psd = new DigitizerPSD(); for( int i = 0 ; i < nBoard; i++){ int board = i % 3; int port = i/3; dig[i].OpenDigitizer(board, port, true); dig[i].CreateAndSaveSettingBinary("setting_" + to_string(dig[i].GetSerialNumber()) + ".bin"); //dig[i].OpenSettingBinary("setting_" + to_string(dig[i].GetSerialNumber()) + ".bin"); } dig[0].PrintBoardConfiguration(); dig[0].PrintChannelSettingFromDigitizer(4); Data * data = dig[0].data; data->AllocateMemory(); dig[0].StartACQ(); for( int p = 0; p < 11; p++){ sleep(1); dig[0].ReadData(); data->DecodeBuffer(1); } dig[0].StopACQ(); delete [] dig; //delete psd; *********************/ ///********************* method for using Data Class for decoding bin file FILE * haha = fopen("output.bin", "r"); fseek(haha, 0L, SEEK_END); size_t inFileSize = ftell(haha); printf("file size : %d Byte\n", (int) inFileSize); fclose(haha); haha = fopen("output.bin", "r"); char * buffer = new char[(int)inFileSize]; size_t dump = fread(buffer, inFileSize, 1, haha); fclose(haha); Data * data = new Data(); data->DPPType = V1730_DPP_PHA_CODE; data->buffer = buffer; data->DecodeBuffer(14); /*********************/ ///****************************** casting digitizer type ///Digitizer ** dig = new Digitizer *[2] ; /////dig[0] = new Digitizer(); ///dig[0] = new DigitizerPHA(); ///dig[1] = new DigitizerPSD(); /// ///printf("%d \n", dig[0]->GetDPPType()); ///printf("%d \n", dig[1]->GetDPPType()); /// ///((DigitizerPHA *)dig[0])->PrintBoardConfiguration(); /// ///((DigitizerPHA *)dig[0])->SetDPPAlgorithmControl2(0x10000); return 0; }