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 "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_TRACE_LEN 2500
|
||||
#define MAX_TRACE_LEN 1250 /// = 10 us
|
||||
|
||||
#define tick2ns 8 // 1 tick = 8 ns
|
||||
|
||||
|
@ -109,9 +120,7 @@ int main(int argc, char ** argv){
|
|||
return -1;
|
||||
}
|
||||
|
||||
// for( int i = 0; i < argc; i++){
|
||||
// printf("%d | %s\n", i, argv[i]);
|
||||
// }
|
||||
unsigned int runStartTime = getTime_us();
|
||||
|
||||
TString outFileName = argv[1];
|
||||
int timeWindow = abs(atoi(argv[2]));
|
||||
|
@ -232,8 +241,9 @@ int main(int argc, char ** argv){
|
|||
tree->Branch("highFlag", highFlag, "highFlag[multi]/s");
|
||||
|
||||
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->GetBranch("trace")->SetCompressionSettings(205);
|
||||
}
|
||||
|
||||
//*=========================================== build event
|
||||
|
@ -331,7 +341,10 @@ int main(int argc, char ** argv){
|
|||
numBlock += reader[i]->GetBlockID() + 1;
|
||||
}
|
||||
|
||||
unsigned int runEndTime = getTime_us();
|
||||
double runTime = (runEndTime - runStartTime) * 1e-6;
|
||||
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 Event Built : %lld\n", evID);
|
||||
printf(" Output Root File Size : %.2f MB\n", outRootFile->GetSize()/1024./1024.);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CC=g++
|
||||
# CFLAG= -g
|
||||
CFLAG= -O2
|
||||
#CFLAG= -g -O0
|
||||
ROOTFLAG=`root-config --cflags --glibs`
|
||||
all: EventBuilder
|
||||
|
||||
|
@ -11,4 +11,4 @@ test: test.cpp ../ClassDigitizer2Gen.o
|
|||
$(CC) $(CFLAG) test.cpp ../ClassDigitizer2Gen.o -o test -lcurl -lCAEN_FELib -lX11
|
||||
|
||||
clean:
|
||||
-rm EventBuilder
|
||||
-rm EventBuilder
|
||||
|
|
108
Aux/SolReader.h
108
Aux/SolReader.h
|
@ -25,6 +25,8 @@ class SolReader {
|
|||
|
||||
std::vector<unsigned int> blockPos;
|
||||
|
||||
size_t dummy;
|
||||
|
||||
public:
|
||||
SolReader();
|
||||
SolReader(std::string fileName, unsigned short dataType);
|
||||
|
@ -73,7 +75,7 @@ SolReader::SolReader(std::string fileName, unsigned short dataType = 0){
|
|||
}
|
||||
|
||||
SolReader::~SolReader(){
|
||||
if( !inFile ) fclose(inFile);
|
||||
if( inFile ) fclose(inFile);
|
||||
delete hit;
|
||||
}
|
||||
|
||||
|
@ -109,7 +111,7 @@ inline int SolReader::ReadNextBlock(bool fastRead, bool debug){
|
|||
if( feof(inFile) ) return -1;
|
||||
if( filePos >= inFileSize) return -1;
|
||||
|
||||
fread(&blockStartIdentifier, 2, 1, inFile);
|
||||
dummy = fread(&blockStartIdentifier, 2, 1, inFile);
|
||||
|
||||
if( (blockStartIdentifier & 0xAA00) != 0xAA00 ) {
|
||||
printf("header fail.\n");
|
||||
|
@ -129,94 +131,94 @@ inline int SolReader::ReadNextBlock(bool fastRead, bool debug){
|
|||
|
||||
if( hit->dataType == DataFormat::ALL){
|
||||
if( !fastRead ){
|
||||
fread(&hit->channel, 1, 1, inFile);
|
||||
fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
||||
fread(&hit->timestamp, 6, 1, inFile);
|
||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
fread(&hit->downSampling, 1, 1, inFile);
|
||||
fread(&hit->board_fail, 1, 1, inFile);
|
||||
fread(&hit->flush, 1, 1, inFile);
|
||||
fread(&hit->trigger_threashold, 2, 1, inFile);
|
||||
fread(&hit->event_size, 8, 1, inFile);
|
||||
fread(&hit->aggCounter, 4, 1, inFile);
|
||||
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
dummy = fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
dummy = fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
dummy = fread(&hit->downSampling, 1, 1, inFile);
|
||||
dummy = fread(&hit->board_fail, 1, 1, inFile);
|
||||
dummy = fread(&hit->flush, 1, 1, inFile);
|
||||
dummy = fread(&hit->trigger_threashold, 2, 1, inFile);
|
||||
dummy = fread(&hit->event_size, 8, 1, inFile);
|
||||
dummy = fread(&hit->aggCounter, 4, 1, inFile);
|
||||
}else{
|
||||
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 ){
|
||||
fread(hit->analog_probes_type, 2, 1, inFile);
|
||||
fread(hit->digital_probes_type, 4, 1, inFile);
|
||||
fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
||||
fread(hit->analog_probes[1], hit->traceLenght*4, 1, inFile);
|
||||
fread(hit->digital_probes[0], hit->traceLenght, 1, inFile);
|
||||
fread(hit->digital_probes[1], hit->traceLenght, 1, inFile);
|
||||
fread(hit->digital_probes[2], hit->traceLenght, 1, inFile);
|
||||
fread(hit->digital_probes[3], hit->traceLenght, 1, inFile);
|
||||
dummy = fread(hit->analog_probes_type, 2, 1, inFile);
|
||||
dummy = fread(hit->digital_probes_type, 4, 1, inFile);
|
||||
dummy = fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
||||
dummy = fread(hit->analog_probes[1], hit->traceLenght*4, 1, inFile);
|
||||
dummy = fread(hit->digital_probes[0], hit->traceLenght, 1, inFile);
|
||||
dummy = fread(hit->digital_probes[1], hit->traceLenght, 1, inFile);
|
||||
dummy = fread(hit->digital_probes[2], hit->traceLenght, 1, inFile);
|
||||
dummy = fread(hit->digital_probes[3], hit->traceLenght, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 6 + hit->traceLenght*(12), SEEK_CUR);
|
||||
dummy = fseek(inFile, 6 + hit->traceLenght*(12), SEEK_CUR);
|
||||
}
|
||||
|
||||
}else if( hit->dataType == DataFormat::OneTrace){
|
||||
if( !fastRead ){
|
||||
fread(&hit->channel, 1, 1, inFile);
|
||||
fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
||||
fread(&hit->timestamp, 6, 1, inFile);
|
||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
dummy = fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
dummy = fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
}else{
|
||||
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 ){
|
||||
fread(&hit->analog_probes_type[0], 1, 1, inFile);
|
||||
fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
||||
dummy = fread(&hit->analog_probes_type[0], 1, 1, inFile);
|
||||
dummy = fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 1 + hit->traceLenght*4, SEEK_CUR);
|
||||
}
|
||||
|
||||
}else if( hit->dataType == DataFormat::NoTrace){
|
||||
if( !fastRead ){
|
||||
fread(&hit->channel, 1, 1, inFile);
|
||||
fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
||||
fread(&hit->timestamp, 6, 1, inFile);
|
||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
dummy = fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
dummy = fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
||||
}
|
||||
|
||||
}else if( hit->dataType == DataFormat::MiniWithFineTime){
|
||||
if( !fastRead ){
|
||||
fread(&hit->channel, 1, 1, inFile);
|
||||
fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
||||
fread(&hit->timestamp, 6, 1, inFile);
|
||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 11 : 13, SEEK_CUR);
|
||||
}
|
||||
|
||||
}else if( hit->dataType == DataFormat::Minimum){
|
||||
if( !fastRead ){
|
||||
fread(&hit->channel, 1, 1, inFile);
|
||||
fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
||||
fread(&hit->timestamp, 6, 1, inFile);
|
||||
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 9 : 11, SEEK_CUR);
|
||||
}
|
||||
|
||||
}else if( hit->dataType == DataFormat::Raw){
|
||||
fread(&hit->dataSize, 8, 1, inFile);
|
||||
dummy = fread(&hit->dataSize, 8, 1, inFile);
|
||||
if( !fastRead ){
|
||||
fread(hit->data, hit->dataSize, 1, inFile);
|
||||
dummy = fread(hit->data, hit->dataSize, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->dataSize, SEEK_CUR);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ QStringList chToolTip = { "Channel signal delay initialization status (1 = initi
|
|||
|
||||
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");
|
||||
setGeometry(0, 0, 1850, 1050);
|
||||
|
@ -72,7 +72,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
this->nDigi = MaxNumberOfDigitizer;
|
||||
qDebug() << "Please increase the MaxNumberOfChannel";
|
||||
}
|
||||
this->digiSettingPath = analysisPath + "/working/Settings/";
|
||||
this->digiSettingPath = settingPath;
|
||||
|
||||
ID = 0;
|
||||
enableSignalSlot = false;
|
||||
|
|
|
@ -708,7 +708,7 @@ void MainWindow::OpenDigitizers(){
|
|||
nDigiConnected = 0;
|
||||
|
||||
//Check path exist
|
||||
QDir dir(analysisPath + "/working/Settings/");
|
||||
QDir dir(expDataPath + "/Settings/");
|
||||
if( !dir.exists() ) dir.mkpath(".");
|
||||
|
||||
for( int i = 0; i < nDigi; i++){
|
||||
|
@ -726,7 +726,7 @@ void MainWindow::OpenDigitizers(){
|
|||
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
||||
|
||||
//*------ 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() ) ){
|
||||
LogMsg("Found setting file <b>" + settingFile + "</b> and loading. please wait.");
|
||||
digi[i]->SetSettingFileName(settingFile.toStdString());
|
||||
|
@ -967,7 +967,7 @@ void MainWindow::OpenDigitizersSettings(){
|
|||
LogMsg("Open digitizers Settings Panel");
|
||||
|
||||
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::UpdateOtherPanels, this, [=](){ UpdateAllPanel(1);});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user