fix EventBuilder, use earlist time among the last data to be the left-over reference
This commit is contained in:
parent
5e82065fc1
commit
72f5cd98e5
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -7,6 +7,7 @@ test_indep
|
||||||
programSettings.txt
|
programSettings.txt
|
||||||
EventKenshikushi
|
EventKenshikushi
|
||||||
EventBuilder
|
EventBuilder
|
||||||
|
EventBuilder_sortTime
|
||||||
DataGenerator
|
DataGenerator
|
||||||
DataReaderScript
|
DataReaderScript
|
||||||
DataReader
|
DataReader
|
||||||
|
@ -14,6 +15,7 @@ pid.dat
|
||||||
DAQLock.dat
|
DAQLock.dat
|
||||||
DumpFSU2ROOT
|
DumpFSU2ROOT
|
||||||
SettingsExplorer
|
SettingsExplorer
|
||||||
|
AggSeparator
|
||||||
|
|
||||||
data
|
data
|
||||||
|
|
||||||
|
|
98
Aux/AggSeparator.cpp
Normal file
98
Aux/AggSeparator.cpp
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
#ifndef AGGSEPARATOR_H
|
||||||
|
#define AGGSEPARATOR_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring> ///memset
|
||||||
|
#include <iostream> ///cout
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip> // for setw
|
||||||
|
#include <algorithm>
|
||||||
|
#include <bitset>
|
||||||
|
#include <vector>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
std::string inFileName = argv[1];
|
||||||
|
|
||||||
|
FILE * file = fopen(inFileName.c_str(), "r");
|
||||||
|
|
||||||
|
if( file == NULL ) {
|
||||||
|
printf("file : %s cannot be open. exit program.\n", inFileName.c_str());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char * buffer = nullptr;
|
||||||
|
unsigned int word; // 4 bytes = 32 bits
|
||||||
|
|
||||||
|
bool newFileFlag[8] = {true};
|
||||||
|
|
||||||
|
while( !feof(file)){
|
||||||
|
|
||||||
|
size_t dummy = fread(&word, 4, 1, file);
|
||||||
|
if( dummy != 1 ){
|
||||||
|
printf("read file error. abort.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
short header = ((word >> 28 ) & 0xF);
|
||||||
|
if( header != 0xA ) {
|
||||||
|
printf("header error. abort.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
unsigned int aggSize = (word & 0x0FFFFFFF) * 4; ///byte
|
||||||
|
|
||||||
|
dummy = fread(&word, 4, 1, file);
|
||||||
|
unsigned int BoardID = ((word >> 27) & 0x1F);
|
||||||
|
unsigned short pattern = ((word >> 8 ) & 0x7FFF );
|
||||||
|
bool BoardFailFlag = ((word >> 26) & 0x1 );
|
||||||
|
unsigned int ChannelMask = ( word & 0xFF ) ;
|
||||||
|
|
||||||
|
dummy = fread(&word, 4, 1, file);
|
||||||
|
unsigned int bdAggCounter = word;
|
||||||
|
|
||||||
|
printf("Agg counter : %u\n", bdAggCounter);
|
||||||
|
|
||||||
|
dummy = fread(&word, 4, 1, file);
|
||||||
|
unsigned int aggTimeTag = word;
|
||||||
|
|
||||||
|
for( int chMask = 0; chMask < 8 ; chMask ++ ){ // the max numnber of Coupled/RegChannel is 8 for PHA, PSD, QDC
|
||||||
|
if( ((ChannelMask >> chMask) & 0x1 ) == 0 ) continue;
|
||||||
|
printf("==================== Dual/Group Channel Block, ch Mask : 0x%X\n", chMask *2);
|
||||||
|
|
||||||
|
dummy = fread(&word, 4, 1, file);
|
||||||
|
unsigned int dualChannelBlockSize = ( word & 0x7FFFFFFF ) * 4 ;
|
||||||
|
|
||||||
|
printf("dual channel size : %d words\n", dualChannelBlockSize / 4);
|
||||||
|
|
||||||
|
buffer = new char[dualChannelBlockSize];
|
||||||
|
fseek(file, -4, SEEK_CUR);
|
||||||
|
dummy = fread(buffer, dualChannelBlockSize, 1, file);
|
||||||
|
|
||||||
|
FILE * haha = nullptr;
|
||||||
|
|
||||||
|
if( newFileFlag[chMask] ) {
|
||||||
|
haha = fopen( (inFileName + "." + std::to_string(chMask)).c_str(), "wb");
|
||||||
|
newFileFlag[chMask] = false;
|
||||||
|
}else{
|
||||||
|
haha = fopen( (inFileName + "." + std::to_string(chMask)).c_str(), "a+");
|
||||||
|
}
|
||||||
|
|
||||||
|
fwrite(buffer, dualChannelBlockSize, 1, haha);
|
||||||
|
|
||||||
|
fclose(haha);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
|
printf("======================= Duel channel seperated \n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -9,7 +9,7 @@
|
||||||
#include "TTree.h"
|
#include "TTree.h"
|
||||||
|
|
||||||
#define MAX_MULTI 100
|
#define MAX_MULTI 100
|
||||||
#define BUFFERFILL 0.5 // only 0.5 * MAXNData will be filled in memeory each time
|
#define BUFFERFILL 0.1 // only 0.5 * MAXNData will be filled in memeory each time
|
||||||
|
|
||||||
template<typename T> void swap(T * a, T *b );
|
template<typename T> void swap(T * a, T *b );
|
||||||
int partition(int arr[], int kaka[], TString file[], int start, int end);
|
int partition(int arr[], int kaka[], TString file[], int start, int end);
|
||||||
|
@ -279,12 +279,16 @@ int main(int argc, char **argv) {
|
||||||
fillFlag = false;
|
fillFlag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//unsigned long long t1 = data[i]->Timestamp[ch][iData];
|
if( debug ){
|
||||||
//printf("digi:%d | ch: %2d DataIndex: %5d (%d) [%5d(%d)] | %llu\n", data[i]->boardSN, ch, iData, iLoop, lastDataIndex[i][ch], lastLoopIndex[i][ch], t1);
|
unsigned long long t1 = data[i]->Timestamp[ch][iData];
|
||||||
|
printf("digi:%d | ch: %2d DataIndex: %5d (%d) [%5d(%d)] | %llu\n", data[i]->boardSN, ch, iData, iLoop, lastDataIndex[i][ch], lastLoopIndex[i][ch], t1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//printf("%3d | agg : %d | %u | %s\n", snList[i], aggCount[i], data[i]->aggTime, fillFlag ? "cont. fill" : "break." );
|
if( debug ){
|
||||||
//data[i]->PrintStat();
|
printf("%3d | agg : %d | %u | %s\n", snList[i], aggCount[i], data[i]->aggTime, fillFlag ? "cont. fill" : "break." );
|
||||||
|
//data[i]->PrintStat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}while(fillFlag);
|
}while(fillFlag);
|
||||||
|
@ -297,7 +301,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
mb->BuildEvents(0, 0, debug);
|
mb->BuildEvents(0, 0, debug);
|
||||||
//mb->PrintStat();
|
if( debug ) mb->PrintStat();
|
||||||
|
|
||||||
///----------- save to tree;
|
///----------- save to tree;
|
||||||
long startIndex = mb->eventIndex - mb->eventBuilt + 1;
|
long startIndex = mb->eventIndex - mb->eventBuilt + 1;
|
||||||
|
@ -350,7 +354,7 @@ int main(int argc, char **argv) {
|
||||||
long startIndex = mb->eventIndex - mb->eventBuilt + 1;
|
long startIndex = mb->eventIndex - mb->eventBuilt + 1;
|
||||||
//printf("startIndex : %ld -> %ld, %ld, %ld, %ld\n", startIndex, startIndex < 0 ? startIndex + MaxNEvent : startIndex, mb->eventIndex, mb->eventBuilt, mb->totalEventBuilt);
|
//printf("startIndex : %ld -> %ld, %ld, %ld, %ld\n", startIndex, startIndex < 0 ? startIndex + MaxNEvent : startIndex, mb->eventIndex, mb->eventBuilt, mb->totalEventBuilt);
|
||||||
if( startIndex < 0 ) startIndex += MaxNEvent;
|
if( startIndex < 0 ) startIndex += MaxNEvent;
|
||||||
for( long p = startIndex; p <= startIndex + mb->eventBuilt; p++){
|
for( long p = startIndex; p < startIndex + mb->eventBuilt; p++){
|
||||||
int k = p % MaxNEvent;
|
int k = p % MaxNEvent;
|
||||||
multi = mb->events[k].size();
|
multi = mb->events[k].size();
|
||||||
if( multi > MAX_MULTI) {
|
if( multi > MAX_MULTI) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ ROOTLIBS = `root-config --cflags --glibs`
|
||||||
|
|
||||||
OBJS = ClassDigitizer.o MultiBuilder.o
|
OBJS = ClassDigitizer.o MultiBuilder.o
|
||||||
|
|
||||||
ALL = test test_indep DataGenerator EventBuilder DataReader DumpFSU2ROOT SettingsExplorer
|
ALL = test test_indep DataGenerator EventBuilder DataReader DumpFSU2ROOT SettingsExplorer
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,10 @@ class FSUReader{
|
||||||
unsigned long totNumBlock;
|
unsigned long totNumBlock;
|
||||||
unsigned int blockID;
|
unsigned int blockID;
|
||||||
|
|
||||||
|
// for dual block
|
||||||
|
int DPPType;
|
||||||
|
int chMask;
|
||||||
|
|
||||||
std::vector<unsigned int> blockPos;
|
std::vector<unsigned int> blockPos;
|
||||||
|
|
||||||
unsigned int word[1]; /// 4 byte
|
unsigned int word[1]; /// 4 byte
|
||||||
|
@ -53,6 +57,23 @@ inline FSUReader::FSUReader(std::string fileName, unsigned short numCh){
|
||||||
blockID = 0;
|
blockID = 0;
|
||||||
blockPos.clear();
|
blockPos.clear();
|
||||||
|
|
||||||
|
//Get DPPType from file name;
|
||||||
|
DPPType = -1;
|
||||||
|
if( fileName.find("PHA") != std::string::npos ) DPPType = DPPType::DPP_PHA_CODE;
|
||||||
|
if( fileName.find("PSD") != std::string::npos ) DPPType = DPPType::DPP_PSD_CODE;
|
||||||
|
if( fileName.find("QDC") != std::string::npos ) DPPType = DPPType::DPP_QDC_CODE;
|
||||||
|
|
||||||
|
//check is the file is *.fsu or *.fsu.X
|
||||||
|
size_t found = fileName.find_last_of('.');
|
||||||
|
std::string ext = fileName.substr(found + 1);
|
||||||
|
|
||||||
|
if( ext.find("fsu") != std::string::npos ) {
|
||||||
|
printf("It is an raw data *.fsu format\n");
|
||||||
|
}else{
|
||||||
|
chMask = atoi(ext.c_str());
|
||||||
|
printf("It is a splitted dual block data *.fsu.X format, dual channel mask : %d \n", chMask);
|
||||||
|
}
|
||||||
|
|
||||||
//ScanNumBlock();
|
//ScanNumBlock();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -68,30 +89,45 @@ inline int FSUReader::ReadNextBlock(bool fast, int verbose){
|
||||||
if( filePos >= inFileSize) return -1;
|
if( filePos >= inFileSize) return -1;
|
||||||
|
|
||||||
dummy = fread(word, 4, 1, inFile);
|
dummy = fread(word, 4, 1, inFile);
|
||||||
|
fseek(inFile, -4, SEEK_CUR);
|
||||||
|
|
||||||
if( dummy != 1) {
|
if( dummy != 1) {
|
||||||
printf("fread error, should read 4 bytes, but read %ld x 4 byte, file pos: %ld byte\n", dummy, ftell(inFile));
|
printf("fread error, should read 4 bytes, but read %ld x 4 byte, file pos: %ld byte\n", dummy, ftell(inFile));
|
||||||
return -10;
|
return -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
fseek(inFile, -4, SEEK_CUR);
|
|
||||||
short header = ((word[0] >> 28 ) & 0xF);
|
short header = ((word[0] >> 28 ) & 0xF);
|
||||||
if( header != 0xA ) {
|
|
||||||
|
if( header == 0xA ) { ///normal header
|
||||||
|
|
||||||
|
unsigned int aggSize = (word[0] & 0x0FFFFFFF) * 4; ///byte
|
||||||
|
buffer = new char[aggSize];
|
||||||
|
dummy = fread(buffer, aggSize, 1, inFile);
|
||||||
|
filePos = ftell(inFile);
|
||||||
|
if( dummy != 1) {
|
||||||
|
printf("fread error, should read %d bytes, but read %ld x %d byte, file pos: %ld byte \n", aggSize, dummy, aggSize, ftell(inFile));
|
||||||
|
return -30;
|
||||||
|
}
|
||||||
|
|
||||||
|
data->DecodeBuffer(buffer, aggSize, fast, verbose); // data will own the buffer
|
||||||
|
data->ClearBuffer(); // this will clear the buffer.
|
||||||
|
|
||||||
|
}else if( (header & 0xF ) == 0x8 ) { /// dual channel header
|
||||||
|
|
||||||
|
unsigned int dualSize = (word[0] & 0x7FFFFFFF) * 4; ///byte
|
||||||
|
buffer = new char[dualSize];
|
||||||
|
dummy = fread(buffer, dualSize, 1, inFile);
|
||||||
|
filePos = ftell(inFile);
|
||||||
|
|
||||||
|
data->buffer = buffer;
|
||||||
|
data->DecodeDualBlock(buffer, dualSize, DPPType, chMask, false, verbose);
|
||||||
|
data->ClearBuffer();
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
printf("incorrect header.\n trminate.");
|
printf("incorrect header.\n trminate.");
|
||||||
return -20;
|
return -20;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int aggSize = (word[0] & 0x0FFFFFFF) * 4; ///byte
|
|
||||||
buffer = new char[aggSize];
|
|
||||||
dummy = fread(buffer, aggSize, 1, inFile);
|
|
||||||
filePos = ftell(inFile);
|
|
||||||
if( dummy != 1) {
|
|
||||||
printf("fread error, should read %d bytes, but read %ld x %d byte, file pos: %ld byte \n", aggSize, dummy, aggSize, ftell(inFile));
|
|
||||||
return -30;
|
|
||||||
}
|
|
||||||
|
|
||||||
data->DecodeBuffer(buffer, aggSize, fast, verbose); // data will own the buffer
|
|
||||||
data->ClearBuffer(); // this will clear the buffer.
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -109,7 +145,7 @@ inline int FSUReader::ReadBlock(unsigned int ID, int verbose){
|
||||||
fseek(inFile, blockPos[ID], SEEK_CUR);
|
fseek(inFile, blockPos[ID], SEEK_CUR);
|
||||||
filePos = blockPos[ID];
|
filePos = blockPos[ID];
|
||||||
blockID = ID;
|
blockID = ID;
|
||||||
return ReadNextBlock(verbose);
|
return ReadNextBlock(false, verbose);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
32
ClassData.h
32
ClassData.h
|
@ -82,8 +82,9 @@ class Data{
|
||||||
void DecodeBuffer(bool fastDecode, int verbose = 0); /// fastDecode will not save waveform
|
void DecodeBuffer(bool fastDecode, int verbose = 0); /// fastDecode will not save waveform
|
||||||
void DecodeBuffer(char * &buffer, unsigned int size, bool fastDecode, int verbose = 0); // for outside data
|
void DecodeBuffer(char * &buffer, unsigned int size, bool fastDecode, int verbose = 0); // for outside data
|
||||||
|
|
||||||
void PrintStat(bool skipEmpty = true) const;
|
void DecodeDualBlock(char * &buffer, unsigned int size, int DPPType, int chMask, bool fastDecode, int verbose = 0); // for outside data
|
||||||
|
|
||||||
|
void PrintStat(bool skipEmpty = true) const;
|
||||||
void PrintAllData(bool tableMode = true, unsigned int maxRowDisplay = 0) const;
|
void PrintAllData(bool tableMode = true, unsigned int maxRowDisplay = 0) const;
|
||||||
|
|
||||||
//^================= Saving data
|
//^================= Saving data
|
||||||
|
@ -94,7 +95,7 @@ class Data{
|
||||||
unsigned int GetFileSize() const {return outFileSize;}
|
unsigned int GetFileSize() const {return outFileSize;}
|
||||||
uint64_t GetTotalFileSize() const {return FinishedOutFilesSize + outFileSize;}
|
uint64_t GetTotalFileSize() const {return FinishedOutFilesSize + outFileSize;}
|
||||||
void ZeroTotalFileSize() { FinishedOutFilesSize = 0; }
|
void ZeroTotalFileSize() { FinishedOutFilesSize = 0; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
const unsigned short numInputCh;
|
const unsigned short numInputCh;
|
||||||
|
@ -122,7 +123,6 @@ class Data{
|
||||||
int DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
|
int DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
|
||||||
int DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
|
int DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
|
||||||
int DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
|
int DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//==========================================
|
//==========================================
|
||||||
|
@ -424,6 +424,8 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
|
||||||
if( ((ChannelMask >> chMask) & 0x1 ) == 0 ) continue;
|
if( ((ChannelMask >> chMask) & 0x1 ) == 0 ) continue;
|
||||||
if( verbose >= 2 ) printf("==================== Dual/Group Channel Block, ch Mask : 0x%X, nw : %d\n", chMask *2, nw);
|
if( verbose >= 2 ) printf("==================== Dual/Group Channel Block, ch Mask : 0x%X, nw : %d\n", chMask *2, nw);
|
||||||
|
|
||||||
|
nw = nw + 1;
|
||||||
|
|
||||||
if( DPPType == DPPType::DPP_PHA_CODE ) {
|
if( DPPType == DPPType::DPP_PHA_CODE ) {
|
||||||
if ( DecodePHADualChannelBlock(chMask, fastDecode, verbose) < 0 ) break;
|
if ( DecodePHADualChannelBlock(chMask, fastDecode, verbose) < 0 ) break;
|
||||||
}
|
}
|
||||||
|
@ -531,11 +533,29 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
|
||||||
}
|
}
|
||||||
|
|
||||||
//*=================================================
|
//*=================================================
|
||||||
|
inline void Data::DecodeDualBlock(char * &buffer, unsigned int size, int DPPType, int chMask, bool fastDecode, int verbose){
|
||||||
|
this->buffer = buffer;
|
||||||
|
this->nByte = size;
|
||||||
|
|
||||||
|
nw = 0;
|
||||||
|
|
||||||
|
if( DPPType == DPPType::DPP_PHA_CODE ) {
|
||||||
|
DecodePHADualChannelBlock(chMask, fastDecode, verbose) ;
|
||||||
|
}
|
||||||
|
if( DPPType == DPPType::DPP_PSD_CODE ) {
|
||||||
|
DecodePSDDualChannelBlock(chMask, fastDecode, verbose) ;
|
||||||
|
}
|
||||||
|
if( DPPType == DPPType::DPP_QDC_CODE ) {
|
||||||
|
DecodeQDCGroupedChannelBlock(chMask, fastDecode, verbose) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose){
|
inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose){
|
||||||
|
|
||||||
//printf("======= %s\n", __func__);
|
//printf("======= %s\n", __func__);
|
||||||
|
|
||||||
nw = nw + 1;
|
//nw = nw + 1;
|
||||||
unsigned int word = ReadBuffer(nw, verbose);
|
unsigned int word = ReadBuffer(nw, verbose);
|
||||||
|
|
||||||
bool hasFormatInfo = ((word >> 31) & 0x1);
|
bool hasFormatInfo = ((word >> 31) & 0x1);
|
||||||
|
@ -777,7 +797,7 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
|
||||||
|
|
||||||
//printf("======= %s\n", __func__);
|
//printf("======= %s\n", __func__);
|
||||||
|
|
||||||
nw = nw + 1;
|
//nw = nw + 1;
|
||||||
unsigned int word = ReadBuffer(nw, verbose);
|
unsigned int word = ReadBuffer(nw, verbose);
|
||||||
|
|
||||||
if( (word >> 31) != 1 ) return 0;
|
if( (word >> 31) != 1 ) return 0;
|
||||||
|
@ -986,7 +1006,7 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
|
||||||
//*=================================================
|
//*=================================================
|
||||||
inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose){
|
inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose){
|
||||||
|
|
||||||
nw = nw + 1;
|
//nw = nw + 1;
|
||||||
unsigned int word = ReadBuffer(nw, verbose);
|
unsigned int word = ReadBuffer(nw, verbose);
|
||||||
|
|
||||||
if( (word >> 31) != 1 ) return 0;
|
if( (word >> 31) != 1 ) return 0;
|
||||||
|
|
|
@ -156,6 +156,24 @@ void MultiBuilder::FindLatestTimeAndCh(bool verbose){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MultiBuilder::FindEarlistTimeAmongLastData(bool verbose){
|
||||||
|
latestTime = -1;
|
||||||
|
latestCh = -1;
|
||||||
|
latestDigi = -1;
|
||||||
|
for( int i = 0; i < nData; i++){
|
||||||
|
for( unsigned ch = 0; ch < data[i]->GetNChannel(); ch++ ){
|
||||||
|
int index = data[i]->DataIndex[ch];
|
||||||
|
if( index == -1 ) continue;
|
||||||
|
if( data[i]->Timestamp[ch][index] < latestTime ) {
|
||||||
|
latestTime = data[i]->Timestamp[ch][index];
|
||||||
|
latestCh = ch;
|
||||||
|
latestDigi = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( verbose ) printf("%s | bd : %d, ch : %d, %lld \n", __func__, latestDigi, latestCh, latestTime);
|
||||||
|
}
|
||||||
|
|
||||||
void MultiBuilder::FindLatestTimeOfData(bool verbose){
|
void MultiBuilder::FindLatestTimeOfData(bool verbose){
|
||||||
latestTime = 0;
|
latestTime = 0;
|
||||||
latestCh = -1;
|
latestCh = -1;
|
||||||
|
@ -176,7 +194,8 @@ void MultiBuilder::FindLatestTimeOfData(bool verbose){
|
||||||
|
|
||||||
void MultiBuilder::BuildEvents(bool isFinal, bool skipTrace, bool verbose){
|
void MultiBuilder::BuildEvents(bool isFinal, bool skipTrace, bool verbose){
|
||||||
|
|
||||||
FindLatestTimeOfData(verbose);
|
FindEarlistTimeAmongLastData(verbose);
|
||||||
|
//FindLatestTimeOfData(verbose);
|
||||||
|
|
||||||
FindEarlistTimeAndCh(verbose);
|
FindEarlistTimeAndCh(verbose);
|
||||||
if( earlistCh == -1 || nExhaushedCh == nData * MaxNChannels) return; /// no data
|
if( earlistCh == -1 || nExhaushedCh == nData * MaxNChannels) return; /// no data
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
MultiBuilder(Data * singleData, int type, int sn);
|
MultiBuilder(Data * singleData, int type, int sn);
|
||||||
~MultiBuilder();
|
~MultiBuilder();
|
||||||
|
|
||||||
void SetTimeWindow(unsigned short ticks) {timeWindow = ticks;}
|
void SetTimeWindow(unsigned short ticks) {timeWindow = ticks; leftOverTime = ticks;}
|
||||||
unsigned short GetTimeWindow() const{return timeWindow;}
|
unsigned short GetTimeWindow() const{return timeWindow;}
|
||||||
|
|
||||||
void SetLeftOverTime(unsigned long long ticks) {leftOverTime = ticks;}
|
void SetLeftOverTime(unsigned long long ticks) {leftOverTime = ticks;}
|
||||||
|
@ -85,15 +85,16 @@ private:
|
||||||
int nExhaushedCh;
|
int nExhaushedCh;
|
||||||
bool chExhaused[MaxNDigitizer][MaxNChannels];
|
bool chExhaused[MaxNDigitizer][MaxNChannels];
|
||||||
|
|
||||||
void FindEarlistTimeAndCh(bool verbose = false); // search thtough the nextIndex
|
void FindEarlistTimeAndCh(bool verbose = false); // search through the nextIndex
|
||||||
unsigned long long earlistTime;
|
unsigned long long earlistTime;
|
||||||
int earlistDigi;
|
int earlistDigi;
|
||||||
int earlistCh;
|
int earlistCh;
|
||||||
void FindLatestTimeAndCh(bool verbose = false); // search thtough the nextIndex
|
void FindLatestTimeAndCh(bool verbose = false); // search through the nextIndex
|
||||||
unsigned long long latestTime;
|
unsigned long long latestTime;
|
||||||
int latestDigi;
|
int latestDigi;
|
||||||
int latestCh;
|
int latestCh;
|
||||||
|
|
||||||
|
void FindEarlistTimeAmongLastData(bool verbose = false);
|
||||||
void FindLatestTimeOfData(bool verbose = false);
|
void FindLatestTimeOfData(bool verbose = false);
|
||||||
|
|
||||||
int lastBackWardIndex[MaxNDigitizer][MaxNChannels];
|
int lastBackWardIndex[MaxNDigitizer][MaxNChannels];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user