bugs fix for EventBuilder. use 600 data size due to max event /agg is 511

This commit is contained in:
splitPoleDAQ 2024-01-20 13:35:19 -05:00
parent 39cda3bc3c
commit 80eb7cb56b
4 changed files with 47 additions and 9 deletions

View File

@ -63,11 +63,14 @@ int main(int argc, char **argv) {
printf("\n"); printf("\n");
printf("=========================== Working flow\n"); printf("=========================== Working flow\n");
printf(" 1) Break down the fsu files into dual channel, save in tempFolder as *.fsu.X\n"); printf(" 1) Break down the fsu files into dual channel, save in tempFolder as *.fsu.X\n");
printf(" 1a) if the *.fsu file has trace, *.fsu.ts will also has trace.\n");
printf(" 2) Load the *.fsu.X files and do the event building\n"); printf(" 2) Load the *.fsu.X files and do the event building\n");
printf("\n\n"); printf("\n\n");
return 1; return 1;
} }
uInt runStartTime = get_time_us();
/// File format must be YYY...Y_runXXX_AAA_BBB_TT_CCC.fsu /// File format must be YYY...Y_runXXX_AAA_BBB_TT_CCC.fsu
/// YYY...Y = prefix /// YYY...Y = prefix
/// XXX = runID, 3 digits /// XXX = runID, 3 digits
@ -126,8 +129,16 @@ int main(int argc, char **argv) {
// file name format is expName_runID_SN_DPP_tick2ns_order.fsu // file name format is expName_runID_SN_DPP_tick2ns_order.fsu
for( int i = 0; i < nFile; i++){ for( int i = 0; i < nFile; i++){
printf("Processing %s (%d/%d) ..... \n", inFileName[i].Data(), i+1, nFile); printf("Processing %s (%d/%d) ..... \n", inFileName[i].Data(), i+1, nFile);
reader[i] = new FSUReader(inFileName[i].Data(), 1, false); reader[i] = new FSUReader(inFileName[i].Data(), 600, false);
if( !reader[i]->isOpen() ) continue;
if( !reader[i]->isOpen() ){
printf("------- cannot open file.\n");
continue;
}
if( reader[i]->GetFileByteSize() == 0 ){
printf("------- file size is ZERO.\n");
continue;
}
reader[i]->ScanNumBlock(false, 2); reader[i]->ScanNumBlock(false, 2);
@ -183,6 +194,8 @@ int main(int argc, char **argv) {
} }
nFile = (int) fileInfo.size();
std::sort(fileInfo.begin(), fileInfo.end(), [](const FileInfo& a, const FileInfo& b) { std::sort(fileInfo.begin(), fileInfo.end(), [](const FileInfo& a, const FileInfo& b) {
return a.ID < b.ID; return a.ID < b.ID;
}); });
@ -281,6 +294,9 @@ int main(int argc, char **argv) {
ullong t0 = -1; ullong t0 = -1;
uShort gp0 = -1; uShort gp0 = -1;
ullong tStart = 0;
ullong tEnd = 0;
bool hasEvent = false; bool hasEvent = false;
for( int i = 0; i < nGroup; i++){ for( int i = 0; i < nGroup; i++){
@ -317,6 +333,9 @@ int main(int argc, char **argv) {
if( tsReader[gpID]->GetHit()->timestamp - t0 <= timeWindow ) { if( tsReader[gpID]->GetHit()->timestamp - t0 <= timeWindow ) {
if( evID == 0) tStart = tsReader[gpID]->GetHit()->timestamp;
if( hitProcessed >= totHitCount ) tEnd = tsReader[gpID]->GetHit()->timestamp;
sn[multi] = tsReader[gpID]->GetHit()->sn; sn[multi] = tsReader[gpID]->GetHit()->sn;
ch[multi] = tsReader[gpID]->GetHit()->ch; ch[multi] = tsReader[gpID]->GetHit()->ch;
e[multi] = tsReader[gpID]->GetHit()->energy; e[multi] = tsReader[gpID]->GetHit()->energy;
@ -367,7 +386,6 @@ int main(int argc, char **argv) {
printf("hit Porcessed %u/%u....%.2f%%\n\033[A\r", hitProcessed, totHitCount, hitProcessed*100./totHitCount); printf("hit Porcessed %u/%u....%.2f%%\n\033[A\r", hitProcessed, totHitCount, hitProcessed*100./totHitCount);
///===================== find the next first timestamp ///===================== find the next first timestamp
t0 = -1; t0 = -1;
gp0 = -1; gp0 = -1;
@ -420,8 +438,16 @@ int main(int argc, char **argv) {
tree->Write(); tree->Write();
uInt runEndTime = get_time_us();
double runTime = (runEndTime - runStartTime) * 1e-6;
printf("========================= finished.\n"); printf("========================= finished.\n");
printf("total events built = %llu(%llu)\n", evID, tree->GetEntriesFast()); printf(" event building time = %.2f sec = %.2f min\n", runTime, runTime/60.);
printf(" total events built = %llu by event builder (%llu in tree)\n", evID, tree->GetEntriesFast());
double tDuration_sec = (tEnd - tStart) * 1e-9;
printf(" first timestamp = %20llu ns\n", tStart);
printf(" last timestamp = %20llu ns\n", tEnd);
printf(" total data duration = %.2f sec = %.2f min\n", tDuration_sec, tDuration_sec/60.);
printf("=======> saved to %s \n", outFileName.Data()); printf("=======> saved to %s \n", outFileName.Data());
outRootFile->Close(); outRootFile->Close();

View File

@ -54,7 +54,12 @@ int main(int argc, char **argv) {
printf("%s [timeWindow] [verbose] [inFile1] [inFile2] .... \n", argv[0]); printf("%s [timeWindow] [verbose] [inFile1] [inFile2] .... \n", argv[0]);
printf(" timeWindow : in ns \n"); printf(" timeWindow : in ns \n");
printf(" verbose : > 0 for debug \n"); printf(" verbose : > 0 for debug \n");
printf(" Output file name is contructed from inFile1 \n"); printf(" Output file name is contructed from inFile1 \n");
printf("\n");
printf("=========================== Working flow\n");
printf(" 1) Load all data into memories as vector and sort\n");
printf(" 2) Build event.\n");
printf("\n\n");
return 1; return 1;
} }
@ -104,9 +109,10 @@ int main(int argc, char **argv) {
printf("Processing %s (%d/%d) ..... \n\033[A\r", inFileName[i].Data(), i+1, nFile); printf("Processing %s (%d/%d) ..... \n\033[A\r", inFileName[i].Data(), i+1, nFile);
reader[i] = new FSUReader(inFileName[i].Data(), 50, 0); // the 1000 is expecting each agg, there are maximum 1000 hit/ch. reader[i] = new FSUReader(inFileName[i].Data(), 600, 0); // the 600 is expecting each agg, there are maximum 1000 hit/ch.
reader[i]->ScanNumBlock(1, 1); reader[i]->ScanNumBlock(1, 1);
// reader[i]->FillHitList();
reader[i]->GetData()->ClearDataPointer();
FileInfo tempInfo; FileInfo tempInfo;
tempInfo.fileName = inFileName[i]; tempInfo.fileName = inFileName[i];
@ -293,7 +299,7 @@ int main(int argc, char **argv) {
if( evID == 0) tStart = event.front().timestamp; if( evID == 0) tStart = event.front().timestamp;
if( multi > 0 ) { if( multi > 0 ) {
tEnd = event.back().timestamp; if( hitProcessed >= totHitCount ) tEnd = event.back().timestamp;
for( size_t j = 0; j < multi ; j++){ for( size_t j = 0; j < multi ; j++){
sn[j] = event[j].sn; sn[j] = event[j].sn;

View File

@ -206,6 +206,8 @@ inline void Data::AllocateDataSize(uShort dataSize){
inline void Data::ClearDataPointer(){ inline void Data::ClearDataPointer(){
if( dataSize == 0) return;
for(int ch = 0; ch < numInputCh; ch++){ for(int ch = 0; ch < numInputCh; ch++){
delete [] Timestamp[ch] ; delete [] Timestamp[ch] ;
delete [] fineTime[ch]; delete [] fineTime[ch];

View File

@ -210,7 +210,11 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
bhAutoSetEventPulling = new QPushButton("Autoset Reading Conf.", this); bhAutoSetEventPulling = new QPushButton("Autoset Reading Conf.", this);
buttonLayout->addWidget(bhAutoSetEventPulling, rowID, 1); buttonLayout->addWidget(bhAutoSetEventPulling, rowID, 1);
connect(bhAutoSetEventPulling, &QPushButton::clicked, this, [=](){ digi[ID]->AutoSetDPPEventAggregation(); UpdateBoardAndChannelsStatus();}); connect(bhAutoSetEventPulling, &QPushButton::clicked, this, [=](){
SendLogMsg("Digi-" +QString::number(digi[ID]->GetSerialNumber()) + " : AutoSetDPPEventAggregation()");
digi[ID]->AutoSetDPPEventAggregation();
UpdateBoardAndChannelsStatus();
});
// bnSendSoftwareClockSyncSignal = new QPushButton("Send SW Clock-Sync Signal", this); // bnSendSoftwareClockSyncSignal = new QPushButton("Send SW Clock-Sync Signal", this);
// buttonLayout->addWidget(bnSendSoftwareClockSyncSignal, rowID, 1); // buttonLayout->addWidget(bnSendSoftwareClockSyncSignal, rowID, 1);