diff --git a/Bin2Root2.cpp b/Bin2Root2.cpp index 1e8dcbc..44c00e8 100644 --- a/Bin2Root2.cpp +++ b/Bin2Root2.cpp @@ -45,6 +45,14 @@ inline unsigned int getTime_us(){ #include #include +//^================================================ +///============ time offset +std::vector timeOffsetList = {0, 0, 0, 0}; + +int bufferSize = 5000000; + +//^================================================ + std::vector> findDataFiles(const std::string& patternPrefix) { std::vector> 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 timeOffsetList = {0, 0, 0, 0}; - ///=========== Form outFileName; TString outFileName = Form("run%03d_%s.root", runNum, (timeWindow < 0 ? "single" : std::to_string(timeWindow).c_str()) );