various changes on data rate. Scope will set the Agg/Read = 1, and restore when scope stop

This commit is contained in:
Ryan Tang 2024-02-26 15:37:06 -05:00
parent 93f89d9264
commit 08b7a60ec2
5 changed files with 44 additions and 24 deletions

View File

@ -64,13 +64,13 @@ class Data{
std::vector<bool> ** DigiWaveform4;
public:
Data(unsigned short numCh, uShort dataSize = DefaultDataSize);
Data(unsigned short numCh, uInt dataSize = DefaultDataSize);
~Data();
void Allocate80MBMemory();
void AllocateMemory(uint32_t size);
void AllocateDataSize(uShort dataSize);
void AllocateDataSize(int dataSize);
void ClearDataPointer();
void ClearData();
void ClearTriggerRate();
@ -107,7 +107,7 @@ class Data{
const unsigned short numInputCh;
unsigned int nw;
uShort dataSize;
int dataSize;
int LoopIndex[MaxNChannels]; /// number of loop in the circular memory
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;
boardSN = 0;
DPPType = DPPType::DPP_PHA_CODE;
@ -179,7 +179,7 @@ inline Data::~Data(){
ClearDataPointer();
}
inline void Data::AllocateDataSize(uShort dataSize){
inline void Data::AllocateDataSize(int dataSize){
if( dataSize < 1) {
printf("dataSize cannot < 1, set dataSize = 1.\n");
@ -337,6 +337,9 @@ inline void Data::ClearReferenceTime(){
inline void Data::CalTriggerRate(){
unsigned long long dTime = 0;
double sec = -999;
for( int ch = 0; ch < numInputCh; ch ++ ){
if( t0[ch] == 0 ) {
TriggerRate[ch] = 0;
@ -346,27 +349,30 @@ inline void Data::CalTriggerRate(){
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;
TriggerRate[ch] = (NumEventsDecoded[ch]-1)/sec;
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch]-1)/sec;
TriggerRate[ch] = (NumEventsDecoded[ch])/sec;
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch])/sec;
}else{
uShort nEvent = 100;
unsigned long long dTime = Timestamp[ch][DataIndex[ch]] - Timestamp[ch][DataIndex[ch] - 100];
double sec = dTime / 1e9;
dTime = Timestamp[ch][DataIndex[ch]] - Timestamp[ch][DataIndex[ch] - 100];
sec = dTime / 1e9;
TriggerRate[ch] = (nEvent-1)/sec;
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch])/sec * (nEvent-1)/(NumEventsDecoded[ch]);
TriggerRate[ch] = (nEvent)/sec;
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]],
// NumEventsDecoded[ch], NumNonPileUpDecoded[ch],
// dTime, sec ,
// TriggerRate[ch], NonPileUpRate[ch]);
if( std::isinf(TriggerRate[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]],
NumEventsDecoded[ch], NumNonPileUpDecoded[ch],
dTime, sec ,
TriggerRate[ch], NonPileUpRate[ch]);
}
t0[ch] = Timestamp[ch][DataIndex[ch]];
NumEventsDecoded[ch] = 0;

View File

@ -98,7 +98,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
}else{
LinkType = CAEN_DGTZ_USB_A4818 ; // portID = A4818 PID
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 ){

View File

@ -43,10 +43,10 @@ Missing the raw data path will disable save data run, but still can start the AC
Ubuntu 22.04
- CAENVMELib v3.3
- CAENCOmm v1.5.3
- CAENDigitizer v2.17.1
- CAEN A3818 Driver v1.6.8
- CAENVMELib v3.3 +
- CAENCOmm v1.5.3 +
- CAENDigitizer v2.17.1 +
- CAEN A3818 Driver v1.6.8 +
- qt6-base-dev
- 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.
## 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
All required CAEN Libraries support ARM archetect, so installation of those would not be a problem.

View File

@ -371,8 +371,9 @@ void Scope::StartScope(){
digi[iDigi]->WriteRegister(DPP::SoftwareClear_W, 1);
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
// SendLogMsg("Set Events/Agg to 1 for scope");
// digi[iDigi]->WriteRegister(DPP::NumberEventsPerAggregate_G, 1, -1);
AggPerRead[iDigi] = digi[iDigi]->GetSettingFromMemory(DPP::MaxAggregatePerBlockTransfer);
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]->SetSaveData(false);
@ -430,6 +431,8 @@ void Scope::StopScope(){
digiMTX[iDigi].unlock();
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[iDigi], -1);
digi[iDigi]->WriteRegister(DPP::MaxAggregatePerBlockTransfer, AggPerRead[iDigi]);
}
emit UpdateOtherPanels();

View File

@ -81,6 +81,7 @@ private:
int tick2ns;
int factor; // whether dual trace or not
bool traceOn[MaxNDigitizer];
int AggPerRead[MaxNDigitizer];
ReadDataThread ** readDataThread;
TimingThread * updateTraceThread;