add timeOffset
This commit is contained in:
parent
5c248984f3
commit
800fb4e55d
|
@ -45,6 +45,14 @@ inline unsigned int getTime_us(){
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
|
//^================================================
|
||||||
|
///============ time offset
|
||||||
|
std::vector<int64_t> timeOffsetList = {0, 0, 0, 0};
|
||||||
|
|
||||||
|
int bufferSize = 5000000;
|
||||||
|
|
||||||
|
//^================================================
|
||||||
|
|
||||||
std::vector<std::pair<int, std::string>> findDataFiles(const std::string& patternPrefix) {
|
std::vector<std::pair<int, std::string>> findDataFiles(const std::string& patternPrefix) {
|
||||||
std::vector<std::pair<int, std::string>> results;
|
std::vector<std::pair<int, std::string>> results;
|
||||||
std::regex pattern1(patternPrefix + "_" + R"_((\d{1,3})\.BIN)_");
|
std::regex pattern1(patternPrefix + "_" + R"_((\d{1,3})\.BIN)_");
|
||||||
|
@ -86,7 +94,8 @@ int ReadBatch(int bufferSize){
|
||||||
if( reader->ReadBlock() != 1 ){
|
if( reader->ReadBlock() != 1 ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//<<< should apply time offset here
|
int bd = reader->data.BoardID;
|
||||||
|
if( bd < timeOffsetList.size() ) reader->data.TimeStamp += timeOffsetList[bd];
|
||||||
hitList_A.push_back(reader->data);
|
hitList_A.push_back(reader->data);
|
||||||
}
|
}
|
||||||
if( hitList_A.size() > 1){
|
if( hitList_A.size() > 1){
|
||||||
|
@ -105,7 +114,8 @@ int ReadBatch(int bufferSize){
|
||||||
if( reader->ReadBlock() != 1 ){
|
if( reader->ReadBlock() != 1 ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//<<< should apply time offset here
|
int bd = reader->data.BoardID;
|
||||||
|
if( bd < timeOffsetList.size() ) reader->data.TimeStamp += timeOffsetList[bd];
|
||||||
hitList_B.push_back(reader->data);
|
hitList_B.push_back(reader->data);
|
||||||
}
|
}
|
||||||
if( hitList_B.size() > 1 ){
|
if( hitList_B.size() > 1 ){
|
||||||
|
@ -194,15 +204,10 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
unsigned int runStartTime = getTime_us();
|
unsigned int runStartTime = getTime_us();
|
||||||
|
|
||||||
int bufferSize = 5000000;
|
|
||||||
|
|
||||||
///============= read input
|
///============= read input
|
||||||
long timeWindow = atoi(argv[1]); // ns
|
long timeWindow = atoi(argv[1]); // ns
|
||||||
short runNum = atoi(argv[2]);
|
short runNum = atoi(argv[2]);
|
||||||
|
|
||||||
///============ time offset
|
|
||||||
std::vector<int64_t> timeOffsetList = {0, 0, 0, 0};
|
|
||||||
|
|
||||||
///=========== Form outFileName;
|
///=========== Form outFileName;
|
||||||
TString outFileName = Form("run%03d_%s.root", runNum, (timeWindow < 0 ? "single" : std::to_string(timeWindow).c_str()) );
|
TString outFileName = Form("run%03d_%s.root", runNum, (timeWindow < 0 ? "single" : std::to_string(timeWindow).c_str()) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user