various changes on data rate. Scope will set the Agg/Read = 1, and restore when scope stop
This commit is contained in:
parent
93f89d9264
commit
08b7a60ec2
40
ClassData.h
40
ClassData.h
|
@ -64,13 +64,13 @@ class Data{
|
||||||
std::vector<bool> ** DigiWaveform4;
|
std::vector<bool> ** DigiWaveform4;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Data(unsigned short numCh, uShort dataSize = DefaultDataSize);
|
Data(unsigned short numCh, uInt dataSize = DefaultDataSize);
|
||||||
~Data();
|
~Data();
|
||||||
|
|
||||||
void Allocate80MBMemory();
|
void Allocate80MBMemory();
|
||||||
void AllocateMemory(uint32_t size);
|
void AllocateMemory(uint32_t size);
|
||||||
|
|
||||||
void AllocateDataSize(uShort dataSize);
|
void AllocateDataSize(int dataSize);
|
||||||
void ClearDataPointer();
|
void ClearDataPointer();
|
||||||
void ClearData();
|
void ClearData();
|
||||||
void ClearTriggerRate();
|
void ClearTriggerRate();
|
||||||
|
@ -107,7 +107,7 @@ class Data{
|
||||||
const unsigned short numInputCh;
|
const unsigned short numInputCh;
|
||||||
unsigned int nw;
|
unsigned int nw;
|
||||||
|
|
||||||
uShort dataSize;
|
int dataSize;
|
||||||
|
|
||||||
int LoopIndex[MaxNChannels]; /// number of loop in the circular memory
|
int LoopIndex[MaxNChannels]; /// number of loop in the circular memory
|
||||||
int DataIndex[MaxNChannels];
|
int DataIndex[MaxNChannels];
|
||||||
|
@ -146,7 +146,7 @@ class Data{
|
||||||
|
|
||||||
//==========================================
|
//==========================================
|
||||||
|
|
||||||
inline Data::Data(unsigned short numCh, uShort dataSize): numInputCh(numCh){
|
inline Data::Data(unsigned short numCh, uInt dataSize): numInputCh(numCh){
|
||||||
tick2ns = 2.0;
|
tick2ns = 2.0;
|
||||||
boardSN = 0;
|
boardSN = 0;
|
||||||
DPPType = DPPType::DPP_PHA_CODE;
|
DPPType = DPPType::DPP_PHA_CODE;
|
||||||
|
@ -179,7 +179,7 @@ inline Data::~Data(){
|
||||||
ClearDataPointer();
|
ClearDataPointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Data::AllocateDataSize(uShort dataSize){
|
inline void Data::AllocateDataSize(int dataSize){
|
||||||
|
|
||||||
if( dataSize < 1) {
|
if( dataSize < 1) {
|
||||||
printf("dataSize cannot < 1, set dataSize = 1.\n");
|
printf("dataSize cannot < 1, set dataSize = 1.\n");
|
||||||
|
@ -337,6 +337,9 @@ inline void Data::ClearReferenceTime(){
|
||||||
|
|
||||||
inline void Data::CalTriggerRate(){
|
inline void Data::CalTriggerRate(){
|
||||||
|
|
||||||
|
unsigned long long dTime = 0;
|
||||||
|
double sec = -999;
|
||||||
|
|
||||||
for( int ch = 0; ch < numInputCh; ch ++ ){
|
for( int ch = 0; ch < numInputCh; ch ++ ){
|
||||||
if( t0[ch] == 0 ) {
|
if( t0[ch] == 0 ) {
|
||||||
TriggerRate[ch] = 0;
|
TriggerRate[ch] = 0;
|
||||||
|
@ -346,27 +349,30 @@ inline void Data::CalTriggerRate(){
|
||||||
|
|
||||||
if( NumEventsDecoded[ch] < dataSize ){
|
if( NumEventsDecoded[ch] < dataSize ){
|
||||||
|
|
||||||
unsigned long long dTime = Timestamp[ch][DataIndex[ch]] - t0[ch];
|
dTime = Timestamp[ch][DataIndex[ch]] - t0[ch];
|
||||||
double sec = dTime / 1e9;
|
double sec = dTime / 1e9;
|
||||||
|
|
||||||
TriggerRate[ch] = (NumEventsDecoded[ch]-1)/sec;
|
TriggerRate[ch] = (NumEventsDecoded[ch])/sec;
|
||||||
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch]-1)/sec;
|
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch])/sec;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
uShort nEvent = 100;
|
uShort nEvent = 100;
|
||||||
unsigned long long dTime = Timestamp[ch][DataIndex[ch]] - Timestamp[ch][DataIndex[ch] - 100];
|
dTime = Timestamp[ch][DataIndex[ch]] - Timestamp[ch][DataIndex[ch] - 100];
|
||||||
double sec = dTime / 1e9;
|
sec = dTime / 1e9;
|
||||||
|
|
||||||
TriggerRate[ch] = (nEvent-1)/sec;
|
TriggerRate[ch] = (nEvent)/sec;
|
||||||
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch])/sec * (nEvent-1)/(NumEventsDecoded[ch]);
|
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch])/sec * (nEvent)/(NumEventsDecoded[ch]);
|
||||||
|
|
||||||
}
|
}
|
||||||
// printf("%2d | %d(%d)| %llu %llu | %d %d | %llu, %.3e | %.2f, %.2f\n", ch, DataIndex[ch], LoopIndex[ch],
|
|
||||||
// t0[ch], Timestamp[ch][DataIndex[ch]],
|
if( std::isinf(TriggerRate[ch]) ) {
|
||||||
// NumEventsDecoded[ch], NumNonPileUpDecoded[ch],
|
printf("%2d | %d(%d)| %llu %llu | %d %d | %llu, %.3e | %.2f, %.2f\n", ch, DataIndex[ch], LoopIndex[ch],
|
||||||
// dTime, sec ,
|
t0[ch], Timestamp[ch][DataIndex[ch]],
|
||||||
// TriggerRate[ch], NonPileUpRate[ch]);
|
NumEventsDecoded[ch], NumNonPileUpDecoded[ch],
|
||||||
|
dTime, sec ,
|
||||||
|
TriggerRate[ch], NonPileUpRate[ch]);
|
||||||
|
}
|
||||||
|
|
||||||
t0[ch] = Timestamp[ch][DataIndex[ch]];
|
t0[ch] = Timestamp[ch][DataIndex[ch]];
|
||||||
NumEventsDecoded[ch] = 0;
|
NumEventsDecoded[ch] = 0;
|
||||||
|
|
|
@ -98,7 +98,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
|
||||||
}else{
|
}else{
|
||||||
LinkType = CAEN_DGTZ_USB_A4818 ; // portID = A4818 PID
|
LinkType = CAEN_DGTZ_USB_A4818 ; // portID = A4818 PID
|
||||||
ret = (int) CAEN_DGTZ_OpenDigitizer(LinkType, portID, boardID, VMEBaseAddress, &handle);
|
ret = (int) CAEN_DGTZ_OpenDigitizer(LinkType, portID, boardID, VMEBaseAddress, &handle);
|
||||||
ErrorMsg("=== Open Digitizer port " +std::to_string(portID) + " board " + std::to_string(boardID) + " using A4818.");
|
ErrorMsg("=== Open Digitizer using A4818 (PID:" +std::to_string(portID) + ") board " + std::to_string(boardID) + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ret == 0 ){
|
if( ret == 0 ){
|
||||||
|
|
18
README.md
18
README.md
|
@ -43,10 +43,10 @@ Missing the raw data path will disable save data run, but still can start the AC
|
||||||
|
|
||||||
Ubuntu 22.04
|
Ubuntu 22.04
|
||||||
|
|
||||||
- CAENVMELib v3.3
|
- CAENVMELib v3.3 +
|
||||||
- CAENCOmm v1.5.3
|
- CAENCOmm v1.5.3 +
|
||||||
- CAENDigitizer v2.17.1
|
- CAENDigitizer v2.17.1 +
|
||||||
- CAEN A3818 Driver v1.6.8
|
- CAEN A3818 Driver v1.6.8 +
|
||||||
|
|
||||||
- qt6-base-dev
|
- qt6-base-dev
|
||||||
- libqt6charts6-dec
|
- libqt6charts6-dec
|
||||||
|
@ -63,6 +63,16 @@ The libcurl4 is need for pushing data to InfluxDB v1.8
|
||||||
|
|
||||||
The QCustomPlot (https://www.qcustomplot.com/index.php/introduction) source files are already included in the repository.
|
The QCustomPlot (https://www.qcustomplot.com/index.php/introduction) source files are already included in the repository.
|
||||||
|
|
||||||
|
## For A4818 optical-USB
|
||||||
|
|
||||||
|
need to install the A4818 driver.
|
||||||
|
|
||||||
|
Make sure connect the optical fiber before switch on the digitizer(s). If unplug the optical fiber and reconnect, need to restart the digitizer(s).
|
||||||
|
|
||||||
|
## For A5818 PCI gen 3
|
||||||
|
|
||||||
|
need to install CAENVMELib v4.0 +
|
||||||
|
|
||||||
## For Raspberry Pi installation
|
## For Raspberry Pi installation
|
||||||
|
|
||||||
All required CAEN Libraries support ARM archetect, so installation of those would not be a problem.
|
All required CAEN Libraries support ARM archetect, so installation of those would not be a problem.
|
||||||
|
|
|
@ -371,8 +371,9 @@ void Scope::StartScope(){
|
||||||
digi[iDigi]->WriteRegister(DPP::SoftwareClear_W, 1);
|
digi[iDigi]->WriteRegister(DPP::SoftwareClear_W, 1);
|
||||||
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
|
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
|
||||||
|
|
||||||
// SendLogMsg("Set Events/Agg to 1 for scope");
|
AggPerRead[iDigi] = digi[iDigi]->GetSettingFromMemory(DPP::MaxAggregatePerBlockTransfer);
|
||||||
// digi[iDigi]->WriteRegister(DPP::NumberEventsPerAggregate_G, 1, -1);
|
SendLogMsg("Set Events/Agg to 1 for scope, it was " + QString::number(AggPerRead[iDigi]) + ".");
|
||||||
|
digi[iDigi]->WriteRegister(DPP::MaxAggregatePerBlockTransfer, 1);
|
||||||
|
|
||||||
readDataThread[iDigi]->SetScopeMode(true);
|
readDataThread[iDigi]->SetScopeMode(true);
|
||||||
readDataThread[iDigi]->SetSaveData(false);
|
readDataThread[iDigi]->SetSaveData(false);
|
||||||
|
@ -430,6 +431,8 @@ void Scope::StopScope(){
|
||||||
digiMTX[iDigi].unlock();
|
digiMTX[iDigi].unlock();
|
||||||
|
|
||||||
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[iDigi], -1);
|
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[iDigi], -1);
|
||||||
|
digi[iDigi]->WriteRegister(DPP::MaxAggregatePerBlockTransfer, AggPerRead[iDigi]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit UpdateOtherPanels();
|
emit UpdateOtherPanels();
|
||||||
|
|
1
Scope.h
1
Scope.h
|
@ -81,6 +81,7 @@ private:
|
||||||
int tick2ns;
|
int tick2ns;
|
||||||
int factor; // whether dual trace or not
|
int factor; // whether dual trace or not
|
||||||
bool traceOn[MaxNDigitizer];
|
bool traceOn[MaxNDigitizer];
|
||||||
|
int AggPerRead[MaxNDigitizer];
|
||||||
|
|
||||||
ReadDataThread ** readDataThread;
|
ReadDataThread ** readDataThread;
|
||||||
TimingThread * updateTraceThread;
|
TimingThread * updateTraceThread;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user