add more on the main window
This commit is contained in:
parent
01641e38f4
commit
d36e8ef2ec
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
|
@ -4,7 +4,8 @@
|
|||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"/usr/include/x86_64-linux-gnu/qt6/**"
|
||||
"/usr/include/x86_64-linux-gnu/qt6/**",
|
||||
"/opt/root/include/*"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
|
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"script.C": "cpp",
|
||||
"SOLARIS_Qt6_DAQ.pro" : "makefile"
|
||||
}
|
||||
}
|
234
SolReader.h
Normal file
234
SolReader.h
Normal file
|
@ -0,0 +1,234 @@
|
|||
#ifndef SOLREADER_H
|
||||
#define SOLREADER_H
|
||||
|
||||
#include <stdio.h> /// for FILE
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unistd.h>
|
||||
#include <time.h> // time in nano-sec
|
||||
|
||||
#include "Event.h"
|
||||
|
||||
class SolReader {
|
||||
private:
|
||||
FILE * inFile;
|
||||
unsigned int inFileSize;
|
||||
unsigned int filePos;
|
||||
unsigned int totNumBlock;
|
||||
|
||||
unsigned short blockStartIdentifier;
|
||||
unsigned int numBlock;
|
||||
bool isScanned;
|
||||
|
||||
void init();
|
||||
|
||||
std::vector<unsigned int> blockPos;
|
||||
|
||||
public:
|
||||
SolReader();
|
||||
SolReader(std::string fileName, unsigned short dataType);
|
||||
~SolReader();
|
||||
|
||||
void OpenFile(std::string fileName);
|
||||
int ReadNextBlock(int opt = 0); // opt = 0, noraml, 1, fast
|
||||
int ReadBlock(unsigned int index);
|
||||
|
||||
void ScanNumBlock();
|
||||
|
||||
unsigned int GetNumBlock() {return numBlock;}
|
||||
unsigned int GetTotalNumBlock() {return totNumBlock;}
|
||||
unsigned int GetFilePos() {return filePos;}
|
||||
unsigned int GetFileSize() {return inFileSize;}
|
||||
|
||||
void RewindFile();
|
||||
|
||||
Event * evt;
|
||||
|
||||
};
|
||||
|
||||
void SolReader::init(){
|
||||
inFileSize = 0;
|
||||
numBlock = 0;
|
||||
filePos = 0;
|
||||
totNumBlock = 0;
|
||||
evt = new Event();
|
||||
|
||||
isScanned = false;
|
||||
|
||||
blockPos.clear();
|
||||
|
||||
}
|
||||
|
||||
SolReader::SolReader(){
|
||||
init();
|
||||
}
|
||||
|
||||
SolReader::SolReader(std::string fileName, unsigned short dataType = 0){
|
||||
init();
|
||||
OpenFile(fileName);
|
||||
evt->SetDataType(dataType);
|
||||
}
|
||||
|
||||
SolReader::~SolReader(){
|
||||
if( !inFile ) fclose(inFile);
|
||||
delete evt;
|
||||
}
|
||||
|
||||
inline void SolReader::OpenFile(std::string fileName){
|
||||
inFile = fopen(fileName.c_str(), "r");
|
||||
if( inFile == NULL ){
|
||||
printf("Cannot open file : %s \n", fileName.c_str());
|
||||
}else{
|
||||
fseek(inFile, 0L, SEEK_END);
|
||||
inFileSize = ftell(inFile);
|
||||
rewind(inFile);
|
||||
}
|
||||
}
|
||||
|
||||
inline int SolReader::ReadBlock(unsigned int index){
|
||||
if( isScanned == false) return -1;
|
||||
if( index >= totNumBlock )return -1;
|
||||
fseek(inFile, 0L, SEEK_SET);
|
||||
|
||||
printf("-----------%u, %u\n", index, blockPos[index]);
|
||||
|
||||
fseek(inFile, blockPos[index], SEEK_CUR);
|
||||
|
||||
numBlock = index;
|
||||
|
||||
return ReadNextBlock();
|
||||
}
|
||||
|
||||
inline int SolReader::ReadNextBlock(int opt){
|
||||
if( inFile == NULL ) return -1;
|
||||
if( feof(inFile) ) return -1;
|
||||
if( filePos >= inFileSize) return -1;
|
||||
|
||||
fread(&blockStartIdentifier, 2, 1, inFile);
|
||||
|
||||
if( (blockStartIdentifier & 0xAAA0) != 0xAAA0 ) {
|
||||
printf("header fail.\n");
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
if( ( blockStartIdentifier & 0xF ) == 15 ){
|
||||
evt->SetDataType(15);
|
||||
}
|
||||
evt->dataType = blockStartIdentifier & 0xF;
|
||||
|
||||
if( evt->dataType == 0){
|
||||
if( opt == 0 ){
|
||||
fread(&evt->channel, 1, 1, inFile);
|
||||
fread(&evt->energy, 2, 1, inFile);
|
||||
fread(&evt->timestamp, 6, 1, inFile);
|
||||
fread(&evt->fine_timestamp, 2, 1, inFile);
|
||||
fread(&evt->flags_high_priority, 1, 1, inFile);
|
||||
fread(&evt->flags_low_priority, 2, 1, inFile);
|
||||
fread(&evt->downSampling, 1, 1, inFile);
|
||||
fread(&evt->board_fail, 1, 1, inFile);
|
||||
fread(&evt->flush, 1, 1, inFile);
|
||||
fread(&evt->trigger_threashold, 2, 1, inFile);
|
||||
fread(&evt->event_size, 8, 1, inFile);
|
||||
fread(&evt->aggCounter, 4, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 31, SEEK_CUR);
|
||||
}
|
||||
fread(&evt->traceLenght, 8, 1, inFile);
|
||||
if( opt == 0){
|
||||
fread(evt->analog_probes_type, 2, 1, inFile);
|
||||
fread(evt->digital_probes_type, 4, 1, inFile);
|
||||
fread(evt->analog_probes[0], evt->traceLenght*4, 1, inFile);
|
||||
fread(evt->analog_probes[1], evt->traceLenght*4, 1, inFile);
|
||||
fread(evt->digital_probes[0], evt->traceLenght, 1, inFile);
|
||||
fread(evt->digital_probes[1], evt->traceLenght, 1, inFile);
|
||||
fread(evt->digital_probes[2], evt->traceLenght, 1, inFile);
|
||||
fread(evt->digital_probes[3], evt->traceLenght, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 6 + evt->traceLenght*(12), SEEK_CUR);
|
||||
}
|
||||
}else if( evt->dataType == 1){
|
||||
if( opt == 0 ){
|
||||
fread(&evt->channel, 1, 1, inFile);
|
||||
fread(&evt->energy, 2, 1, inFile);
|
||||
fread(&evt->timestamp, 6, 1, inFile);
|
||||
fread(&evt->fine_timestamp, 2, 1, inFile);
|
||||
fread(&evt->flags_high_priority, 1, 1, inFile);
|
||||
fread(&evt->flags_low_priority, 2, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 14, SEEK_CUR);
|
||||
}
|
||||
fread(&evt->traceLenght, 8, 1, inFile);
|
||||
if( opt == 0){
|
||||
fread(&evt->analog_probes_type[0], 1, 1, inFile);
|
||||
fread(evt->analog_probes[0], evt->traceLenght*4, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 1 + evt->traceLenght*4, SEEK_CUR);
|
||||
}
|
||||
}else if( evt->dataType == 2){
|
||||
if( opt == 0 ){
|
||||
fread(&evt->channel, 1, 1, inFile);
|
||||
fread(&evt->energy, 2, 1, inFile);
|
||||
fread(&evt->timestamp, 6, 1, inFile);
|
||||
fread(&evt->fine_timestamp, 2, 1, inFile);
|
||||
fread(&evt->flags_high_priority, 1, 1, inFile);
|
||||
fread(&evt->flags_low_priority, 2, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 14, SEEK_CUR);
|
||||
}
|
||||
}else if( evt->dataType == 3){
|
||||
if( opt == 0 ){
|
||||
fread(&evt->channel, 1, 1, inFile);
|
||||
fread(&evt->energy, 2, 1, inFile);
|
||||
fread(&evt->timestamp, 6, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 9, SEEK_CUR);
|
||||
}
|
||||
}else if( evt->dataType == 15){
|
||||
fread(&evt->dataSize, 8, 1, inFile);
|
||||
if( opt == 0){
|
||||
fread(evt->data, evt->dataSize, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, evt->dataSize, SEEK_CUR);
|
||||
}
|
||||
}
|
||||
|
||||
numBlock ++;
|
||||
filePos = ftell(inFile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SolReader::RewindFile(){
|
||||
rewind(inFile);
|
||||
filePos = 0;
|
||||
numBlock = 0;
|
||||
}
|
||||
|
||||
void SolReader::ScanNumBlock(){
|
||||
if( inFile == NULL ) return;
|
||||
if( feof(inFile) ) return;
|
||||
|
||||
numBlock = 0;
|
||||
blockPos.clear();
|
||||
|
||||
blockPos.push_back(0);
|
||||
|
||||
while( ReadNextBlock(1) == 0){
|
||||
blockPos.push_back(filePos);
|
||||
printf("%u, %.2f%% %u/%u\n\033[A\r", numBlock, filePos*100./inFileSize, filePos, inFileSize);
|
||||
}
|
||||
|
||||
totNumBlock = numBlock;
|
||||
numBlock = 0;
|
||||
isScanned = true;
|
||||
printf("\nScan complete: number of data Block : %u\n", totNumBlock);
|
||||
rewind(inFile);
|
||||
filePos = 0;
|
||||
|
||||
//for( int i = 0; i < totNumBlock; i++){
|
||||
// printf("%7d | %u \n", i, blockPos[i]);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -337,8 +337,6 @@ DigiSettings::DigiSettings(Digitizer2Gen * digi, unsigned short nDigi, QWidget *
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
for( unsigned short rowID = 0; rowID < digi->GetNChannels() + 2; rowID++){
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@ private:
|
|||
bool bnClickStatus[MaxNumberOfChannel][MaxNumberOfChannel];
|
||||
|
||||
QCheckBox * cbCh[MaxNumberOfDigitizer][MaxNumberOfChannel + 1]; // index = 64 is for all channels
|
||||
//QCheckBox * cbCh[MaxNumberOfChannel + 1]; // index = 64 is for all channels
|
||||
|
||||
QSpinBox * sbRecordLength[MaxNumberOfChannel + 1];
|
||||
QSpinBox * sbPreTrigger[MaxNumberOfChannel + 1];
|
||||
|
|
138
mainwindow.cpp
138
mainwindow.cpp
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <QLabel>
|
||||
#include <QGridLayout>
|
||||
#include <QDialog>
|
||||
#include <QStorageInfo>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -18,6 +20,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
nDigi = 0;
|
||||
digiSerialNum.clear();
|
||||
digiSetting = NULL;
|
||||
readDataThread = NULL;
|
||||
|
||||
QWidget * mainLayoutWidget = new QWidget(this);
|
||||
setCentralWidget(mainLayoutWidget);
|
||||
|
@ -32,7 +35,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
QGridLayout * layout1 = new QGridLayout(box1);
|
||||
|
||||
bnProgramSettings = new QPushButton("Program Settings", this);
|
||||
bnProgramSettings->setEnabled(false);
|
||||
connect(bnProgramSettings, &QPushButton::clicked, this, &MainWindow::ProgramSettings);
|
||||
|
||||
bnOpenDigitizers = new QPushButton("Open Digitizers", this);
|
||||
connect(bnOpenDigitizers, SIGNAL(clicked()), this, SLOT(bnOpenDigitizers_clicked()));
|
||||
|
@ -45,11 +48,29 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
bnDigiSettings->setEnabled(false);
|
||||
connect(bnDigiSettings, SIGNAL(clicked()), this, SLOT(OpenDigitizersSettings()));
|
||||
|
||||
QPushButton * bnSOLSettings = new QPushButton("SOLARIS Settings", this);
|
||||
bnSOLSettings->setEnabled(false);
|
||||
|
||||
QPushButton * bnOpenScope = new QPushButton("Open scope", this);
|
||||
bnOpenScope->setEnabled(false);
|
||||
|
||||
bnNewExp = new QPushButton("New/Change Exp", this);
|
||||
connect(bnNewExp, &QPushButton::clicked, this, &MainWindow::SetupNewExp);
|
||||
|
||||
QLineEdit * lExpName = new QLineEdit("<Exp Name>", this);
|
||||
lExpName->setReadOnly(true);
|
||||
|
||||
layout1->addWidget(bnProgramSettings, 0, 0);
|
||||
layout1->addWidget(bnOpenDigitizers, 0, 1);
|
||||
layout1->addWidget(bnCloseDigitizers, 0, 2);
|
||||
layout1->addWidget(bnDigiSettings, 1, 1);
|
||||
layout1->addWidget(bnSOLSettings, 1, 2);
|
||||
|
||||
layout1->addWidget(bnNewExp, 2, 0);
|
||||
layout1->addWidget(lExpName, 2, 1);
|
||||
layout1->addWidget(bnOpenScope, 2, 2);
|
||||
|
||||
for( int i = 0; i < layout1->columnCount(); i++) layout1->setColumnStretch(i, 1);
|
||||
|
||||
}
|
||||
|
||||
|
@ -68,8 +89,25 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
bnStopACQ->setEnabled(false);
|
||||
connect(bnStopACQ, &QPushButton::clicked, this, &MainWindow::StopACQ);
|
||||
|
||||
layout2->addWidget(bnStartACQ, 0, 0);
|
||||
layout2->addWidget(bnStopACQ, 0, 1);
|
||||
QLabel * lbRunID = new QLabel("Run ID : ", this);
|
||||
lbRunID->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
QLineEdit * runID = new QLineEdit(this);
|
||||
runID->setReadOnly(true);
|
||||
|
||||
QLabel * lbRunComment = new QLabel("Run Comment : ", this);
|
||||
lbRunComment->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
QLineEdit * runComment = new QLineEdit(this);
|
||||
runComment->setReadOnly(true);
|
||||
|
||||
layout2->addWidget(lbRunID, 0, 0);
|
||||
layout2->addWidget(runID, 0, 1);
|
||||
layout2->addWidget(bnStartACQ, 0, 2);
|
||||
layout2->addWidget(bnStopACQ, 0, 3);
|
||||
layout2->addWidget(lbRunComment, 1, 0);
|
||||
layout2->addWidget(runComment, 1, 1, 1, 3);
|
||||
|
||||
layout2->setColumnStretch(0, 0.3);
|
||||
for( int i = 0; i < layout2->columnCount(); i++) layout2->setColumnStretch(i, 1);
|
||||
|
||||
}
|
||||
|
||||
|
@ -99,23 +137,28 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
|
||||
MainWindow::~MainWindow(){
|
||||
|
||||
delete digiSetting;
|
||||
//---- may be no need to delete as thay are child of this
|
||||
//delete bnProgramSettings;
|
||||
//delete bnOpenDigitizers;
|
||||
//delete bnCloseDigitizers;
|
||||
//delete bnDigiSettings;
|
||||
//delete bnNewExp;
|
||||
//delete logInfo;
|
||||
|
||||
delete bnProgramSettings;
|
||||
delete bnOpenDigitizers;
|
||||
delete bnCloseDigitizers;
|
||||
delete bnDigiSettings;
|
||||
delete logInfo;
|
||||
//---- need manually delete
|
||||
if( digiSetting != NULL ) delete digiSetting;
|
||||
|
||||
if( digi != NULL ){
|
||||
digi->CloseDigitizer();
|
||||
delete digi;
|
||||
}
|
||||
|
||||
if( readDataThread != NULL){
|
||||
readDataThread->Stop();
|
||||
readDataThread->quit();
|
||||
readDataThread->wait();
|
||||
delete readDataThread;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -183,16 +226,18 @@ void MainWindow::bnOpenDigitizers_clicked(){
|
|||
}else{
|
||||
LogMsg("Cannot open digitizer");
|
||||
|
||||
LogMsg("use a dummy.");
|
||||
//LogMsg("use a dummy.");
|
||||
//digi->SetDummy();
|
||||
//digiSerialNum.push_back(0000);
|
||||
//nDigi ++;
|
||||
|
||||
digi->SetDummy();
|
||||
digiSerialNum.push_back(0000);
|
||||
nDigi ++;
|
||||
delete digi;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
void MainWindow::bnCloseDigitizers_clicked(){
|
||||
if( digi != NULL ){
|
||||
digi->CloseDigitizer();
|
||||
|
@ -225,6 +270,73 @@ void MainWindow::OpenDigitizersSettings(){
|
|||
digiSetting->show();
|
||||
}
|
||||
}
|
||||
//######################################################################
|
||||
|
||||
void MainWindow::SetupNewExp(){
|
||||
|
||||
QDialog dialog(this);
|
||||
dialog.setWindowTitle("Setup / change Experiment");
|
||||
dialog.setGeometry(0, 0, 500, 500);
|
||||
|
||||
QVBoxLayout * layout = new QVBoxLayout(&dialog);
|
||||
|
||||
//------- instruction
|
||||
QLabel *label = new QLabel("Here list the pass experiments. ", &dialog);
|
||||
layout->addWidget(label);
|
||||
|
||||
//------- get and list the git repository
|
||||
QPlainTextEdit * gitList = new QPlainTextEdit(&dialog);
|
||||
layout->addWidget(gitList);
|
||||
gitList->setReadOnly(true);
|
||||
|
||||
//------- get harddisk space;
|
||||
//QStorageInfo storage("/path/to/drive");
|
||||
QStorageInfo storage = QStorageInfo::root();
|
||||
qint64 availableSpace = storage.bytesAvailable();
|
||||
|
||||
QLabel * lbDiskSpace = new QLabel("Disk space avalible " + QString::number(availableSpace/1024./1024./1024.) + " [GB]", &dialog);
|
||||
layout->addWidget(lbDiskSpace);
|
||||
|
||||
//------- type existing or new experiment
|
||||
QLineEdit * input = new QLineEdit(&dialog);
|
||||
layout->addWidget(input);
|
||||
|
||||
|
||||
QPushButton *button1 = new QPushButton("OK", &dialog);
|
||||
layout->addWidget(button1);
|
||||
QObject::connect(button1, &QPushButton::clicked, &dialog, &QDialog::accept);
|
||||
|
||||
dialog.exec();
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::ProgramSettings(){
|
||||
|
||||
QDialog dialog(this);
|
||||
dialog.setWindowTitle("Program Settings");
|
||||
dialog.setGeometry(0, 0, 500, 500);
|
||||
|
||||
QGridLayout * layout = new QGridLayout(&dialog);
|
||||
|
||||
//-------- data Path
|
||||
QLabel *lbDataPath = new QLabel("Data Path", &dialog); layout->addWidget(lbDataPath, 0, 0);
|
||||
QLineEdit * lDataPath = new QLineEdit("/path/to/data", &dialog); layout->addWidget(lDataPath, 0, 1, 1, 2);
|
||||
//-------- analysis Path
|
||||
|
||||
//-------- IP search range
|
||||
|
||||
//-------- DataBase IP
|
||||
|
||||
//-------- DataBase name
|
||||
|
||||
//-------- Elog IP
|
||||
|
||||
QPushButton *button1 = new QPushButton("OK", &dialog);
|
||||
layout->addWidget(button1, 2, 1);
|
||||
QObject::connect(button1, &QPushButton::clicked, &dialog, &QDialog::accept);
|
||||
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void MainWindow::LogMsg(QString msg){
|
||||
|
||||
|
|
14
mainwindow.h
14
mainwindow.h
|
@ -57,9 +57,10 @@ public:
|
|||
digi->ErrorMsg("ReadDataLoop()");
|
||||
}
|
||||
|
||||
if( readCount % 1000 == 0 ) {
|
||||
emit sendMsg("FileSize : " + QString::number(digi->GetFileSize()) + " Bytes");
|
||||
clock_gettime(CLOCK_REALTIME, &tb);
|
||||
//if( readCount % 1000 == 0 ) {
|
||||
if( tb.tv_sec - ta.tv_sec > 2 ) {
|
||||
emit sendMsg("FileSize : " + QString::number(digi->GetFileSize()/1024./1024.) + " MB");
|
||||
//double duration = tb.tv_nsec-ta.tv_nsec + tb.tv_sec*1e+9 - ta.tv_sec*1e+9;
|
||||
//printf("%4d, duration : %10.0f, %6.1f\n", readCount, duration, 1e9/duration);
|
||||
ta = tb;
|
||||
|
@ -98,6 +99,9 @@ private slots:
|
|||
|
||||
void OpenDigitizersSettings();
|
||||
|
||||
void SetupNewExp();
|
||||
void ProgramSettings();
|
||||
|
||||
signals :
|
||||
|
||||
|
||||
|
@ -111,6 +115,8 @@ private:
|
|||
QPushButton * bnStartACQ;
|
||||
QPushButton * bnStopACQ;
|
||||
|
||||
QPushButton * bnNewExp;
|
||||
|
||||
DigiSettings * digiSetting;
|
||||
|
||||
QPlainTextEdit * logInfo;
|
||||
|
@ -126,6 +132,10 @@ private:
|
|||
|
||||
void LogMsg(QString msg);
|
||||
|
||||
QString expName;
|
||||
QString dataPath;
|
||||
QString analysisPath;
|
||||
int runID;
|
||||
|
||||
};
|
||||
|
||||
|
|
85
script.C
Normal file
85
script.C
Normal file
|
@ -0,0 +1,85 @@
|
|||
#include "SolReader.h"
|
||||
#include "TH1.h"
|
||||
#include "TMath.h"
|
||||
#include "TH2.h"
|
||||
#include "TStyle.h"
|
||||
#include "TCanvas.h"
|
||||
|
||||
|
||||
void script(){
|
||||
|
||||
SolReader * reader = new SolReader("haha_000.sol");
|
||||
Event * evt = reader->evt;
|
||||
|
||||
printf("----------file size: %u Byte\n", reader->GetFileSize());
|
||||
|
||||
reader->ScanNumBlock();
|
||||
|
||||
if( reader->GetTotalNumBlock() == 0 ) return;
|
||||
|
||||
unsigned long startTime, endTime;
|
||||
reader->ReadBlock(0);
|
||||
startTime = evt->timestamp;
|
||||
reader->ReadBlock(reader->GetTotalNumBlock() - 1);
|
||||
endTime = evt->timestamp;
|
||||
|
||||
double duration = double(endTime - startTime)*8./1e9;
|
||||
printf("============== %lu ns = %.4f sec.\n", (endTime - startTime)*8, duration);
|
||||
printf(" avarge rate (16ch): %f Hz\n", reader->GetTotalNumBlock()/duration/16);
|
||||
reader->RewindFile();
|
||||
|
||||
|
||||
TH1F * hid = new TH1F("hid", "hid", 64, 0, 64);
|
||||
TH1F * h1 = new TH1F("h1", "h1", duration, startTime, endTime);
|
||||
TH2F * h2 = new TH2F("h2", "h2", 1000, startTime, endTime, 1000, 0, reader->GetTotalNumBlock());
|
||||
TH1F * hTdiff = new TH1F("hTdiff", "hTdiff", 400, 0, 200000);
|
||||
|
||||
uint64_t tOld = startTime;
|
||||
|
||||
for( int i = 0; i < reader->GetTotalNumBlock() ; i++){
|
||||
//for( int i = 0; i < 8 ; i++){
|
||||
|
||||
reader->ReadNextBlock();
|
||||
|
||||
if( i < 8 ){
|
||||
printf("########################## nBlock : %u, %u/%u\n", reader->GetNumBlock(),
|
||||
reader->GetFilePos(),
|
||||
reader->GetFileSize());
|
||||
evt->PrintAll();
|
||||
//evt->PrintAllTrace();
|
||||
}
|
||||
|
||||
hid->Fill(evt->channel);
|
||||
if( evt->channel == 0 ) h1->Fill(evt->timestamp);
|
||||
h2->Fill(evt->timestamp, i);
|
||||
|
||||
if( i > 0 ){
|
||||
hTdiff->Fill(evt->timestamp - tOld);
|
||||
if( evt->timestamp < tOld) printf("-------- time not sorted.");
|
||||
tOld = evt->timestamp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gStyle->SetOptStat("neiou");
|
||||
|
||||
TCanvas * canvas = new TCanvas("c1", "c1", 1800, 600);
|
||||
canvas->Divide(3,1);
|
||||
canvas->cd(1); hid->Draw();
|
||||
canvas->cd(2); h1->SetMinimum(0); h1->Draw();
|
||||
canvas->cd(3); hTdiff->Draw();
|
||||
|
||||
//printf("reader traceLength : %lu \n", evt->traceLenght);
|
||||
|
||||
/*
|
||||
for( int i = 0; i < evt->traceLenght; i++){
|
||||
|
||||
printf("%4d| %d\n", i, evt->analog_probes[0][i]);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
evt = NULL;
|
||||
delete reader;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user