From 5d6f1d6fe1d2290d44cef81aa296548a3264a887 Mon Sep 17 00:00:00 2001 From: Matthias Kleiner Date: Tue, 20 Oct 2026 10:18:39 +0200 Subject: [PATCH] TPC: store run and time range in the voxRes UserInfo TPCFastTransformInitCPM.C took the run number and validity range for its summary tree only from the output file name, which does not match the naming used on the Grid, so these fields were always -1. staticMapCreatorCPM.C now stores runNumber, firstTFTime, lastTFTime and the time span of the selected TFs in the voxResTree UserInfo (SmoothingExtrapolate.C already copies it), and TPCFastTransformInitCPM.C reads them from there. The file name is still parsed as a fallback for older inputs. Co-Authored-By: Claude Opus 5.5 --- .../SpacePoints/macro/staticMapCreatorCPM.C | 9 ++++++ .../macro/TPCFastTransformInitCPM.C | 32 +++++++++++++------ 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/Detectors/TPC/calibration/SpacePoints/macro/staticMapCreatorCPM.C b/Detectors/TPC/calibration/SpacePoints/macro/staticMapCreatorCPM.C index dea2b2f98c2ef..db9aeee5ac09b 100644 --- a/Detectors/TPC/calibration/SpacePoints/macro/staticMapCreatorCPM.C +++ b/Detectors/TPC/calibration/SpacePoints/macro/staticMapCreatorCPM.C @@ -2343,6 +2343,15 @@ void staticMapCreatorCPM(std::string fileInput = "files.txt", userInfo->Add(new TNamed("maxTracks", std::to_string(maxTracks))); userInfo->Add(new TNamed("minTracks", std::to_string(minTracks))); userInfo->Add(new TNamed("nTracksProcessed", std::to_string(nTracksProcessed_final))); + // run number and time range of the selected data + userInfo->Add(new TNamed("runNumber", std::to_string(runNumber))); + userInfo->Add(new TNamed("firstTFTime", std::to_string(firstTFTime))); + userInfo->Add(new TNamed("lastTFTime", std::to_string(lastTFTime))); + if (!timeMSsel.empty()) { + const auto [minTimeMSIt, maxTimeMSIt] = std::minmax_element(timeMSsel.begin(), timeMSsel.end()); + userInfo->Add(new TNamed("minTimeMS", std::to_string(*minTimeMSIt))); + userInfo->Add(new TNamed("maxTimeMS", std::to_string(*maxTimeMSIt))); + } if (isBadCalib) { userInfo->Add(new TNamed("badCalib", "1")); } diff --git a/GPU/TPCFastTransformation/macro/TPCFastTransformInitCPM.C b/GPU/TPCFastTransformation/macro/TPCFastTransformInitCPM.C index a83efef0cdd75..b5de036ad4b4f 100644 --- a/GPU/TPCFastTransformation/macro/TPCFastTransformInitCPM.C +++ b/GPU/TPCFastTransformation/macro/TPCFastTransformInitCPM.C @@ -187,21 +187,35 @@ void TPCFastTransformInitCPM(const char* fileName = "debugVoxRes.root", void createFastTransform(std::string outFileName, TTree* voxResTree, o2::tpc::TrackResiduals& trackResiduals, bool useSmoothed, bool invertSigns, float meanIDC, float meanCTP, int debug, int useCTPLumi) { LOGP(info, "create fast transformation ... "); - std::regex reg(".*FT_voxRes\\.residuals\\.([0-9]{6})_([0-9]{13})_([0-9]{13})_([0-9]+)_([0-9]+).*\\.root"); - std::smatch base_match; - int run = -1; - long validFrom = -1; - long validUntil = -1; + // run and validity range from the input UserInfo (written by staticMapCreatorCPM.C). The output file + // name is only parsed for older inputs without them and for the TF range of the old naming scheme. + auto getLongFromUserInfo = [voxResTree](const char* name) { + const auto obj = voxResTree->GetUserInfo()->FindObject(name); + return obj ? std::atol(obj->GetTitle()) : -1L; + }; + int run = static_cast(getLongFromUserInfo("runNumber")); + // requested time window if one was set, otherwise the time span of the selected TFs + const long firstTFTime = getLongFromUserInfo("firstTFTime"); + const long lastTFTime = getLongFromUserInfo("lastTFTime"); + long validFrom = (firstTFTime > 0) ? firstTFTime : getLongFromUserInfo("minTimeMS"); + long validUntil = (lastTFTime > 0) ? lastTFTime : getLongFromUserInfo("maxTimeMS"); int firstTF = -1; int lastTF = -1; + std::regex reg(".*FT_voxRes\\.residuals\\.([0-9]{6})_([0-9]{13})_([0-9]{13})_([0-9]+)_([0-9]+).*\\.root"); + std::smatch base_match; if (std::regex_match(outFileName, base_match, reg)) { - run = std::stoi(base_match[1].str()); - validFrom = std::stol(base_match[2].str()); - validUntil = std::stol(base_match[3].str()); + if (run < 0) { + run = std::stoi(base_match[1].str()); + validFrom = std::stol(base_match[2].str()); + validUntil = std::stol(base_match[3].str()); + } firstTF = std::stol(base_match[4].str()); lastTF = std::stol(base_match[5].str()); - LOGP(info, "Found run {}, validFrom {}, validUntil {}, firstTF {}, lastTF {}", run, validFrom, validUntil, firstTF, lastTF); } + if (run < 0) { + LOGP(warning, "Run number neither in the input UserInfo nor in the output file name {}", outFileName); + } + LOGP(info, "Found run {}, validFrom {}, validUntil {}, firstTF {}, lastTF {}", run, validFrom, validUntil, firstTF, lastTF); auto* helper = o2::tpc::TPCFastTransformHelperO2::instance();