Add Run Time for EventBuilder
This commit is contained in:
parent
8474bc9fbb
commit
4a5fd7a769
|
@ -10,8 +10,19 @@
|
||||||
//#include "TClonesArray.h" // plan to save trace as TVector with TClonesArray
|
//#include "TClonesArray.h" // plan to save trace as TVector with TClonesArray
|
||||||
//#include "TVector.h"
|
//#include "TVector.h"
|
||||||
|
|
||||||
|
#include <sys/time.h> /** struct timeval, select() */
|
||||||
|
|
||||||
|
inline unsigned int getTime_us(){
|
||||||
|
unsigned int time_us;
|
||||||
|
struct timeval t1;
|
||||||
|
struct timezone tz;
|
||||||
|
gettimeofday(&t1, &tz);
|
||||||
|
time_us = (t1.tv_sec) * 1000 * 1000 + t1.tv_usec;
|
||||||
|
return time_us;
|
||||||
|
}
|
||||||
|
|
||||||
#define MAX_MULTI 64
|
#define MAX_MULTI 64
|
||||||
#define MAX_TRACE_LEN 2500
|
#define MAX_TRACE_LEN 1250 /// = 10 us
|
||||||
|
|
||||||
#define tick2ns 8 // 1 tick = 8 ns
|
#define tick2ns 8 // 1 tick = 8 ns
|
||||||
|
|
||||||
|
@ -109,9 +120,7 @@ int main(int argc, char ** argv){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for( int i = 0; i < argc; i++){
|
unsigned int runStartTime = getTime_us();
|
||||||
// printf("%d | %s\n", i, argv[i]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
TString outFileName = argv[1];
|
TString outFileName = argv[1];
|
||||||
int timeWindow = abs(atoi(argv[2]));
|
int timeWindow = abs(atoi(argv[2]));
|
||||||
|
@ -232,8 +241,9 @@ int main(int argc, char ** argv){
|
||||||
tree->Branch("highFlag", highFlag, "highFlag[multi]/s");
|
tree->Branch("highFlag", highFlag, "highFlag[multi]/s");
|
||||||
|
|
||||||
if( saveTrace){
|
if( saveTrace){
|
||||||
tree->Branch("tl", traceLen, "traceLen[multi]/I");
|
tree->Branch("traceLen", traceLen, "traceLen[multi]/I");
|
||||||
tree->Branch("trace", trace, Form("trace[multi][%d]/I", MAX_TRACE_LEN));
|
tree->Branch("trace", trace, Form("trace[multi][%d]/I", MAX_TRACE_LEN));
|
||||||
|
tree->GetBranch("trace")->SetCompressionSettings(205);
|
||||||
}
|
}
|
||||||
|
|
||||||
//*=========================================== build event
|
//*=========================================== build event
|
||||||
|
@ -331,7 +341,10 @@ int main(int argc, char ** argv){
|
||||||
numBlock += reader[i]->GetBlockID() + 1;
|
numBlock += reader[i]->GetBlockID() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int runEndTime = getTime_us();
|
||||||
|
double runTime = (runEndTime - runStartTime) * 1e-6;
|
||||||
printf("===================================== done. \n");
|
printf("===================================== done. \n");
|
||||||
|
printf(" event building time : %.2f sec = %.2f min\n", runTime, runTime/60.);
|
||||||
printf("Number of Block Scanned : %u\n", numBlock);
|
printf("Number of Block Scanned : %u\n", numBlock);
|
||||||
printf(" Number of Event Built : %lld\n", evID);
|
printf(" Number of Event Built : %lld\n", evID);
|
||||||
printf(" Output Root File Size : %.2f MB\n", outRootFile->GetSize()/1024./1024.);
|
printf(" Output Root File Size : %.2f MB\n", outRootFile->GetSize()/1024./1024.);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
CC=g++
|
CC=g++
|
||||||
# CFLAG= -g
|
|
||||||
CFLAG= -O2
|
CFLAG= -O2
|
||||||
|
#CFLAG= -g -O0
|
||||||
ROOTFLAG=`root-config --cflags --glibs`
|
ROOTFLAG=`root-config --cflags --glibs`
|
||||||
all: EventBuilder
|
all: EventBuilder
|
||||||
|
|
||||||
|
@ -11,4 +11,4 @@ test: test.cpp ../ClassDigitizer2Gen.o
|
||||||
$(CC) $(CFLAG) test.cpp ../ClassDigitizer2Gen.o -o test -lcurl -lCAEN_FELib -lX11
|
$(CC) $(CFLAG) test.cpp ../ClassDigitizer2Gen.o -o test -lcurl -lCAEN_FELib -lX11
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm EventBuilder
|
-rm EventBuilder
|
||||||
|
|
108
Aux/SolReader.h
108
Aux/SolReader.h
|
@ -25,6 +25,8 @@ class SolReader {
|
||||||
|
|
||||||
std::vector<unsigned int> blockPos;
|
std::vector<unsigned int> blockPos;
|
||||||
|
|
||||||
|
size_t dummy;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SolReader();
|
SolReader();
|
||||||
SolReader(std::string fileName, unsigned short dataType);
|
SolReader(std::string fileName, unsigned short dataType);
|
||||||
|
@ -73,7 +75,7 @@ SolReader::SolReader(std::string fileName, unsigned short dataType = 0){
|
||||||
}
|
}
|
||||||
|
|
||||||
SolReader::~SolReader(){
|
SolReader::~SolReader(){
|
||||||
if( !inFile ) fclose(inFile);
|
if( inFile ) fclose(inFile);
|
||||||
delete hit;
|
delete hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +111,7 @@ inline int SolReader::ReadNextBlock(bool fastRead, bool debug){
|
||||||
if( feof(inFile) ) return -1;
|
if( feof(inFile) ) return -1;
|
||||||
if( filePos >= inFileSize) return -1;
|
if( filePos >= inFileSize) return -1;
|
||||||
|
|
||||||
fread(&blockStartIdentifier, 2, 1, inFile);
|
dummy = fread(&blockStartIdentifier, 2, 1, inFile);
|
||||||
|
|
||||||
if( (blockStartIdentifier & 0xAA00) != 0xAA00 ) {
|
if( (blockStartIdentifier & 0xAA00) != 0xAA00 ) {
|
||||||
printf("header fail.\n");
|
printf("header fail.\n");
|
||||||
|
@ -129,94 +131,94 @@ inline int SolReader::ReadNextBlock(bool fastRead, bool debug){
|
||||||
|
|
||||||
if( hit->dataType == DataFormat::ALL){
|
if( hit->dataType == DataFormat::ALL){
|
||||||
if( !fastRead ){
|
if( !fastRead ){
|
||||||
fread(&hit->channel, 1, 1, inFile);
|
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||||
fread(&hit->energy, 2, 1, inFile);
|
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||||
fread(&hit->timestamp, 6, 1, inFile);
|
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||||
fread(&hit->flags_high_priority, 1, 1, inFile);
|
dummy = fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||||
fread(&hit->flags_low_priority, 2, 1, inFile);
|
dummy = fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||||
fread(&hit->downSampling, 1, 1, inFile);
|
dummy = fread(&hit->downSampling, 1, 1, inFile);
|
||||||
fread(&hit->board_fail, 1, 1, inFile);
|
dummy = fread(&hit->board_fail, 1, 1, inFile);
|
||||||
fread(&hit->flush, 1, 1, inFile);
|
dummy = fread(&hit->flush, 1, 1, inFile);
|
||||||
fread(&hit->trigger_threashold, 2, 1, inFile);
|
dummy = fread(&hit->trigger_threashold, 2, 1, inFile);
|
||||||
fread(&hit->event_size, 8, 1, inFile);
|
dummy = fread(&hit->event_size, 8, 1, inFile);
|
||||||
fread(&hit->aggCounter, 4, 1, inFile);
|
dummy = fread(&hit->aggCounter, 4, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 31 : 33, SEEK_CUR);
|
fseek(inFile, hit->DPPType == DPPType::PHA ? 31 : 33, SEEK_CUR);
|
||||||
}
|
}
|
||||||
fread(&hit->traceLenght, 8, 1, inFile);
|
dummy = fread(&hit->traceLenght, 8, 1, inFile);
|
||||||
if( !fastRead ){
|
if( !fastRead ){
|
||||||
fread(hit->analog_probes_type, 2, 1, inFile);
|
dummy = fread(hit->analog_probes_type, 2, 1, inFile);
|
||||||
fread(hit->digital_probes_type, 4, 1, inFile);
|
dummy = fread(hit->digital_probes_type, 4, 1, inFile);
|
||||||
fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
dummy = fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
||||||
fread(hit->analog_probes[1], hit->traceLenght*4, 1, inFile);
|
dummy = fread(hit->analog_probes[1], hit->traceLenght*4, 1, inFile);
|
||||||
fread(hit->digital_probes[0], hit->traceLenght, 1, inFile);
|
dummy = fread(hit->digital_probes[0], hit->traceLenght, 1, inFile);
|
||||||
fread(hit->digital_probes[1], hit->traceLenght, 1, inFile);
|
dummy = fread(hit->digital_probes[1], hit->traceLenght, 1, inFile);
|
||||||
fread(hit->digital_probes[2], hit->traceLenght, 1, inFile);
|
dummy = fread(hit->digital_probes[2], hit->traceLenght, 1, inFile);
|
||||||
fread(hit->digital_probes[3], hit->traceLenght, 1, inFile);
|
dummy = fread(hit->digital_probes[3], hit->traceLenght, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, 6 + hit->traceLenght*(12), SEEK_CUR);
|
dummy = fseek(inFile, 6 + hit->traceLenght*(12), SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if( hit->dataType == DataFormat::OneTrace){
|
}else if( hit->dataType == DataFormat::OneTrace){
|
||||||
if( !fastRead ){
|
if( !fastRead ){
|
||||||
fread(&hit->channel, 1, 1, inFile);
|
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||||
fread(&hit->energy, 2, 1, inFile);
|
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||||
fread(&hit->timestamp, 6, 1, inFile);
|
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||||
fread(&hit->flags_high_priority, 1, 1, inFile);
|
dummy = fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||||
fread(&hit->flags_low_priority, 2, 1, inFile);
|
dummy = fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
||||||
}
|
}
|
||||||
fread(&hit->traceLenght, 8, 1, inFile);
|
dummy = fread(&hit->traceLenght, 8, 1, inFile);
|
||||||
if( !fastRead ){
|
if( !fastRead ){
|
||||||
fread(&hit->analog_probes_type[0], 1, 1, inFile);
|
dummy = fread(&hit->analog_probes_type[0], 1, 1, inFile);
|
||||||
fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
dummy = fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, 1 + hit->traceLenght*4, SEEK_CUR);
|
fseek(inFile, 1 + hit->traceLenght*4, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if( hit->dataType == DataFormat::NoTrace){
|
}else if( hit->dataType == DataFormat::NoTrace){
|
||||||
if( !fastRead ){
|
if( !fastRead ){
|
||||||
fread(&hit->channel, 1, 1, inFile);
|
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||||
fread(&hit->energy, 2, 1, inFile);
|
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||||
fread(&hit->timestamp, 6, 1, inFile);
|
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||||
fread(&hit->flags_high_priority, 1, 1, inFile);
|
dummy = fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||||
fread(&hit->flags_low_priority, 2, 1, inFile);
|
dummy = fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if( hit->dataType == DataFormat::MiniWithFineTime){
|
}else if( hit->dataType == DataFormat::MiniWithFineTime){
|
||||||
if( !fastRead ){
|
if( !fastRead ){
|
||||||
fread(&hit->channel, 1, 1, inFile);
|
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||||
fread(&hit->energy, 2, 1, inFile);
|
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||||
fread(&hit->timestamp, 6, 1, inFile);
|
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 11 : 13, SEEK_CUR);
|
fseek(inFile, hit->DPPType == DPPType::PHA ? 11 : 13, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if( hit->dataType == DataFormat::Minimum){
|
}else if( hit->dataType == DataFormat::Minimum){
|
||||||
if( !fastRead ){
|
if( !fastRead ){
|
||||||
fread(&hit->channel, 1, 1, inFile);
|
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||||
fread(&hit->energy, 2, 1, inFile);
|
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||||
fread(&hit->timestamp, 6, 1, inFile);
|
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 9 : 11, SEEK_CUR);
|
fseek(inFile, hit->DPPType == DPPType::PHA ? 9 : 11, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if( hit->dataType == DataFormat::Raw){
|
}else if( hit->dataType == DataFormat::Raw){
|
||||||
fread(&hit->dataSize, 8, 1, inFile);
|
dummy = fread(&hit->dataSize, 8, 1, inFile);
|
||||||
if( !fastRead ){
|
if( !fastRead ){
|
||||||
fread(hit->data, hit->dataSize, 1, inFile);
|
dummy = fread(hit->data, hit->dataSize, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, hit->dataSize, SEEK_CUR);
|
fseek(inFile, hit->dataSize, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ QStringList chToolTip = { "Channel signal delay initialization status (1 = initi
|
||||||
|
|
||||||
QColor orangeColor(255, 165, 0);
|
QColor orangeColor(255, 165, 0);
|
||||||
|
|
||||||
DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QString analysisPath, QWidget * parent) : QWidget(parent){
|
DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QString settingPath, QWidget * parent) : QWidget(parent){
|
||||||
|
|
||||||
setWindowTitle("Digitizers Settings");
|
setWindowTitle("Digitizers Settings");
|
||||||
setGeometry(0, 0, 1850, 1050);
|
setGeometry(0, 0, 1850, 1050);
|
||||||
|
@ -72,7 +72,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
||||||
this->nDigi = MaxNumberOfDigitizer;
|
this->nDigi = MaxNumberOfDigitizer;
|
||||||
qDebug() << "Please increase the MaxNumberOfChannel";
|
qDebug() << "Please increase the MaxNumberOfChannel";
|
||||||
}
|
}
|
||||||
this->digiSettingPath = analysisPath + "/working/Settings/";
|
this->digiSettingPath = settingPath;
|
||||||
|
|
||||||
ID = 0;
|
ID = 0;
|
||||||
enableSignalSlot = false;
|
enableSignalSlot = false;
|
||||||
|
|
|
@ -708,7 +708,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
nDigiConnected = 0;
|
nDigiConnected = 0;
|
||||||
|
|
||||||
//Check path exist
|
//Check path exist
|
||||||
QDir dir(analysisPath + "/working/Settings/");
|
QDir dir(expDataPath + "/Settings/");
|
||||||
if( !dir.exists() ) dir.mkpath(".");
|
if( !dir.exists() ) dir.mkpath(".");
|
||||||
|
|
||||||
for( int i = 0; i < nDigi; i++){
|
for( int i = 0; i < nDigi; i++){
|
||||||
|
@ -726,7 +726,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
||||||
|
|
||||||
//*------ search for settings_XXX_YYY.dat, YYY is DPP-type, XXX is serial number
|
//*------ search for settings_XXX_YYY.dat, YYY is DPP-type, XXX is serial number
|
||||||
QString settingFile = analysisPath + "/working/Settings/setting_" + QString::number(digi[i]->GetSerialNumber()) + "_" + QString::fromStdString(digi[i]->GetFPGAType().substr(4)) + ".dat";
|
QString settingFile = expDataPath + "/Settings/setting_" + QString::number(digi[i]->GetSerialNumber()) + "_" + QString::fromStdString(digi[i]->GetFPGAType().substr(4)) + ".dat";
|
||||||
if( digi[i]->LoadSettingsFromFile( settingFile.toStdString().c_str() ) ){
|
if( digi[i]->LoadSettingsFromFile( settingFile.toStdString().c_str() ) ){
|
||||||
LogMsg("Found setting file <b>" + settingFile + "</b> and loading. please wait.");
|
LogMsg("Found setting file <b>" + settingFile + "</b> and loading. please wait.");
|
||||||
digi[i]->SetSettingFileName(settingFile.toStdString());
|
digi[i]->SetSettingFileName(settingFile.toStdString());
|
||||||
|
@ -967,7 +967,7 @@ void MainWindow::OpenDigitizersSettings(){
|
||||||
LogMsg("Open digitizers Settings Panel");
|
LogMsg("Open digitizers Settings Panel");
|
||||||
|
|
||||||
if( digiSetting == NULL){
|
if( digiSetting == NULL){
|
||||||
digiSetting = new DigiSettingsPanel(digi, nDigi, analysisPath);
|
digiSetting = new DigiSettingsPanel(digi, nDigi, expDataPath + "/Settings/");
|
||||||
connect(digiSetting, &DigiSettingsPanel::SendLogMsg, this, &MainWindow::LogMsg);
|
connect(digiSetting, &DigiSettingsPanel::SendLogMsg, this, &MainWindow::LogMsg);
|
||||||
connect(digiSetting, &DigiSettingsPanel::UpdateOtherPanels, this, [=](){ UpdateAllPanel(1);});
|
connect(digiSetting, &DigiSettingsPanel::UpdateOtherPanels, this, [=](){ UpdateAllPanel(1);});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user