add ClassDigitizer::CalByteForBufferCAEN()
This commit is contained in:
parent
8cb3908043
commit
98cddbd5b3
97
Aux/test.cpp
97
Aux/test.cpp
|
@ -26,7 +26,7 @@ static void raw(void);
|
||||||
int keyboardhit();
|
int keyboardhit();
|
||||||
int getch(void);
|
int getch(void);
|
||||||
|
|
||||||
// #include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
size_t WriteCallBack(char *contents, size_t size, size_t nmemb, void *userp){
|
size_t WriteCallBack(char *contents, size_t size, size_t nmemb, void *userp){
|
||||||
// printf(" InfluxDB::%s \n", __func__);
|
// printf(" InfluxDB::%s \n", __func__);
|
||||||
|
@ -34,9 +34,7 @@ size_t WriteCallBack(char *contents, size_t size, size_t nmemb, void *userp){
|
||||||
return size * nmemb;
|
return size * nmemb;
|
||||||
}
|
}
|
||||||
|
|
||||||
//^======================================
|
void testInflux(){
|
||||||
int main(int argc, char* argv[]){
|
|
||||||
|
|
||||||
InfluxDB * influx = new InfluxDB();
|
InfluxDB * influx = new InfluxDB();
|
||||||
|
|
||||||
influx->SetURL("https://fsunuc.physics.fsu.edu/influx/");
|
influx->SetURL("https://fsunuc.physics.fsu.edu/influx/");
|
||||||
|
@ -56,11 +54,8 @@ int main(int argc, char* argv[]){
|
||||||
|
|
||||||
// printf("%s \n", influx->Query("testing", "SELECT * from haha ORDER by time DESC LIMIT 5").c_str());
|
// printf("%s \n", influx->Query("testing", "SELECT * from haha ORDER by time DESC LIMIT 5").c_str());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
delete influx;
|
delete influx;
|
||||||
|
|
||||||
|
|
||||||
// CURL *curl = curl_easy_init();
|
// CURL *curl = curl_easy_init();
|
||||||
// CURLcode res;
|
// CURLcode res;
|
||||||
|
|
||||||
|
@ -156,14 +151,92 @@ int main(int argc, char* argv[]){
|
||||||
|
|
||||||
//============================================= end of influxDB example
|
//============================================= end of influxDB example
|
||||||
|
|
||||||
// Digitizer * digi = new Digitizer(0, 26006, false, true);
|
}
|
||||||
// digi->Reset();
|
|
||||||
|
|
||||||
//digi->ProgramBoard_PHA();
|
|
||||||
|
|
||||||
//digi->WriteRegister(DPP::SoftwareClear_W, 1);
|
void CheckBufferSize(int MaxAggPreRead, int EvtPreAgg){
|
||||||
|
|
||||||
|
|
||||||
|
//Buffer depends on
|
||||||
|
|
||||||
|
Digitizer * digi = new Digitizer(0, 26006, false, true);
|
||||||
|
digi->Reset();
|
||||||
|
digi->ProgramBoard();
|
||||||
|
|
||||||
|
digi->WriteRegister(DPP::SoftwareClear_W, 1);
|
||||||
|
|
||||||
|
digi->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 0, -1);
|
||||||
|
digi->WriteRegister(DPP::RecordLength_G, 10, -1);
|
||||||
|
|
||||||
|
digi->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableExtra2, 1, -1);
|
||||||
|
|
||||||
|
digi->WriteRegister(DPP::MaxAggregatePerBlockTransfer, MaxAggPreRead);
|
||||||
|
digi->WriteRegister(DPP::NumberEventsPerAggregate_G, EvtPreAgg);
|
||||||
|
|
||||||
|
unsigned int bufferSize = digi->CalByteForBuffer(true);
|
||||||
|
unsigned int bufferSizeCAEN = digi->CalByteForBufferCAEN();
|
||||||
|
|
||||||
|
printf("Manual Buffer Size : %u Byte = %u words\n", bufferSize, bufferSize/4);
|
||||||
|
printf(" CAEN Buffer Size : %u Byte = %u words\n", bufferSizeCAEN, bufferSizeCAEN/4);
|
||||||
|
|
||||||
|
unsigned int haha = bufferSize*2 + 16 *( 1- MaxAggPreRead );
|
||||||
|
printf("---- %u %u \n", haha, haha/4);
|
||||||
|
|
||||||
|
|
||||||
|
delete digi;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetOneAgg(){
|
||||||
|
|
||||||
|
Digitizer * digi = new Digitizer(0, 26006, false, true);
|
||||||
|
|
||||||
|
if( digi->IsConnected() ){
|
||||||
|
digi->Reset();
|
||||||
|
digi->ProgramBoard();
|
||||||
|
|
||||||
|
digi->WriteRegister(DPP::SoftwareClear_W, 1);
|
||||||
|
|
||||||
|
digi->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 0, -1);
|
||||||
|
digi->WriteRegister(DPP::RecordLength_G, 10, -1);
|
||||||
|
|
||||||
|
digi->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableExtra2, 1, -1);
|
||||||
|
|
||||||
|
digi->WriteRegister(DPP::MaxAggregatePerBlockTransfer, 1);
|
||||||
|
digi->WriteRegister(DPP::NumberEventsPerAggregate_G, 2);
|
||||||
|
|
||||||
|
unsigned int bufferSize = digi->CalByteForBuffer(true);
|
||||||
|
unsigned int bufferSizeCAEN = digi->CalByteForBufferCAEN();
|
||||||
|
|
||||||
|
printf("Manual Buffer Size : %u Byte = %u words\n", bufferSize, bufferSize/4);
|
||||||
|
printf(" CAEN Buffer Size : %u Byte = %u words\n", bufferSizeCAEN, bufferSizeCAEN/4);
|
||||||
|
|
||||||
|
|
||||||
|
digi->StartACQ();
|
||||||
|
|
||||||
|
usleep(5000*1000); // wait 1sec
|
||||||
|
|
||||||
|
|
||||||
|
digi->ReadData();
|
||||||
|
digi->GetData()->DecodeBuffer(false, 4);
|
||||||
|
|
||||||
|
digi->StopACQ();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete digi;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//^======================================
|
||||||
|
int main(int argc, char* argv[]){
|
||||||
|
|
||||||
|
|
||||||
|
// CheckBufferSize(5, 4);
|
||||||
|
|
||||||
|
GetOneAgg();
|
||||||
|
|
||||||
|
|
||||||
// digi->WriteRegister(DPP::QDC::RecordLength, 31, -1); // T = N * 8 * 16
|
|
||||||
// digi->WriteRegister(DPP::QDC::PreTrigger, 60, -1);
|
// digi->WriteRegister(DPP::QDC::PreTrigger, 60, -1);
|
||||||
|
|
||||||
// digi->WriteRegister(DPP::QDC::TriggerThreshold_sub2, 17, -1);
|
// digi->WriteRegister(DPP::QDC::TriggerThreshold_sub2, 17, -1);
|
||||||
|
|
|
@ -501,9 +501,9 @@ void Digitizer::StartACQ(){
|
||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
}else if( DPPType == V1730_DPP_PSD_CODE) {
|
}else if( DPPType == V1730_DPP_PSD_CODE) {
|
||||||
bufferSize = 200 * 1024 * 1024; //TODO allocate 200 MB for PSD
|
bufferSize = CalByteForBufferCAEN();
|
||||||
}else if( DPPType == V1740_DPP_QDC_CODE) {
|
}else if( DPPType == V1740_DPP_QDC_CODE) {
|
||||||
bufferSize = 200 * 1024 * 1024; //TODO allocate 200 MB for QDC
|
bufferSize = CalByteForBufferCAEN();
|
||||||
}else{
|
}else{
|
||||||
printf("DPP type not supported. ACQ not start.\n");
|
printf("DPP type not supported. ACQ not start.\n");
|
||||||
return;
|
return;
|
||||||
|
@ -576,7 +576,7 @@ void Digitizer::StopACQ(){
|
||||||
data->ZeroTotalFileSize();
|
data->ZeroTotalFileSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Digitizer::CalByteForBuffer(){
|
unsigned int Digitizer::CalByteForBuffer(bool verbose){
|
||||||
unsigned int numAggBLT;
|
unsigned int numAggBLT;
|
||||||
unsigned int chMask ;
|
unsigned int chMask ;
|
||||||
unsigned int boardCfg ;
|
unsigned int boardCfg ;
|
||||||
|
@ -605,14 +605,18 @@ unsigned int Digitizer::CalByteForBuffer(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///printf(" agg. orgainzation (bit) : 0x%X \n", aggOrgan);
|
if( verbose ){
|
||||||
///printf(" Channel Mask : %04X \n", chMask);
|
printf("=================================== Setting related to Buffer\n");
|
||||||
///printf("Max number of Agg per Readout : %u \n", numAggBLT);
|
printf(" agg. orgainzation (bit) : 0x%X \n", aggOrgan);
|
||||||
///printf(" is Extra2 enabed : %u \n", ((boardCfg >> 17) & 0x1) );
|
printf(" Channel Mask : %04X \n", chMask);
|
||||||
///printf(" is Record wave : %u \n", ((boardCfg >> 16) & 0x1) );
|
printf("Max number of Agg per Readout : %u \n", numAggBLT);
|
||||||
///for( int pCh = 0; pCh < NumInputCh/2; pCh++){
|
printf(" is Extra2 enabed : %u \n", ((boardCfg >> 17) & 0x1) );
|
||||||
/// printf("Paired Ch : %d, RecordLength (bit value): %u, Event per Agg. : %u \n", pCh, recordLength[pCh], eventAgg[pCh]);
|
printf(" is Record wave : %u \n", ((boardCfg >> 16) & 0x1) );
|
||||||
///}
|
for( int pCh = 0; pCh < NumInputCh/2; pCh++){
|
||||||
|
printf("Paired Ch : %d, RecordLength (bit value): %u, Event per Agg. : %u \n", pCh, recordLength[pCh], eventAgg[pCh]);
|
||||||
|
}
|
||||||
|
printf("==============================================================\n");
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int bufferSize = aggOrgan; // just for get rip of the warning in complier
|
unsigned int bufferSize = aggOrgan; // just for get rip of the warning in complier
|
||||||
bufferSize = 0;
|
bufferSize = 0;
|
||||||
|
@ -627,6 +631,15 @@ unsigned int Digitizer::CalByteForBuffer(){
|
||||||
return bufferSize ;
|
return bufferSize ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int Digitizer::CalByteForBufferCAEN(){
|
||||||
|
|
||||||
|
char * BufferCAEN;
|
||||||
|
uint32_t AllocatedSize, BufferSize;
|
||||||
|
ret = CAEN_DGTZ_MallocReadoutBuffer(handle, &BufferCAEN, &AllocatedSize);
|
||||||
|
return AllocatedSize;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int Digitizer::ReadData(){
|
int Digitizer::ReadData(){
|
||||||
if( softwareDisable ) return CAEN_DGTZ_DigitizerNotReady;
|
if( softwareDisable ) return CAEN_DGTZ_DigitizerNotReady;
|
||||||
if( !isConnected ) return CAEN_DGTZ_DigitizerNotFound;
|
if( !isConnected ) return CAEN_DGTZ_DigitizerNotFound;
|
||||||
|
|
|
@ -108,7 +108,8 @@ class Digitizer{
|
||||||
void ReadAndPrintACQStatue();
|
void ReadAndPrintACQStatue();
|
||||||
void ReadACQStatus() { acqStatus = ReadRegister(DPP::AcquisitionStatus_R); }
|
void ReadACQStatus() { acqStatus = ReadRegister(DPP::AcquisitionStatus_R); }
|
||||||
|
|
||||||
unsigned int CalByteForBuffer();
|
unsigned int CalByteForBuffer(bool verbose = false);
|
||||||
|
unsigned int CalByteForBufferCAEN();
|
||||||
|
|
||||||
//^================= Settings
|
//^================= Settings
|
||||||
/// write value to digitizer, memory, and settingFile (if exist)
|
/// write value to digitizer, memory, and settingFile (if exist)
|
||||||
|
|
|
@ -1807,7 +1807,12 @@ void MainWindow::UpdateAllPanels(int panelID){
|
||||||
//***************************************************************
|
//***************************************************************
|
||||||
void MainWindow::SetUpInflux(){
|
void MainWindow::SetUpInflux(){
|
||||||
|
|
||||||
if( influxIP == "" ) return;
|
if( influxIP == "" ) {
|
||||||
|
LogMsg("<font style=\"color : red;\">Influx missing inputs. skip.</font>");
|
||||||
|
leInfluxIP->setEnabled(false);
|
||||||
|
leDatabaseName->setEnabled(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( influx ) {
|
if( influx ) {
|
||||||
delete influx;
|
delete influx;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user