add timeOffset

This commit is contained in:
Ryan@Home 2024-09-26 13:40:19 -04:00
parent 5c248984f3
commit 800fb4e55d

View File

@ -45,6 +45,14 @@ inline unsigned int getTime_us(){
#include <filesystem>
#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>> results;
std::regex pattern1(patternPrefix + "_" + R"_((\d{1,3})\.BIN)_");
@ -86,7 +94,8 @@ int ReadBatch(int bufferSize){
if( reader->ReadBlock() != 1 ){
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);
}
if( hitList_A.size() > 1){
@ -105,7 +114,8 @@ int ReadBatch(int bufferSize){
if( reader->ReadBlock() != 1 ){
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);
}
if( hitList_B.size() > 1 ){
@ -194,15 +204,10 @@ int main(int argc, char **argv) {
unsigned int runStartTime = getTime_us();
int bufferSize = 5000000;
///============= read input
long timeWindow = atoi(argv[1]); // ns
short runNum = atoi(argv[2]);
///============ time offset
std::vector<int64_t> timeOffsetList = {0, 0, 0, 0};
///=========== Form outFileName;
TString outFileName = Form("run%03d_%s.root", runNum, (timeWindow < 0 ? "single" : std::to_string(timeWindow).c_str()) );