Skip to content

Commit 5d6f1d6

Browse files
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 <noreply@anthropic.com>
1 parent 8cc0b98 commit 5d6f1d6

2 files changed

Lines changed: 32 additions & 9 deletions

File tree

‎Detectors/TPC/calibration/SpacePoints/macro/staticMapCreatorCPM.C‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,6 +2343,15 @@ void staticMapCreatorCPM(std::string fileInput = "files.txt",
23432343
userInfo->Add(new TNamed("maxTracks", std::to_string(maxTracks)));
23442344
userInfo->Add(new TNamed("minTracks", std::to_string(minTracks)));
23452345
userInfo->Add(new TNamed("nTracksProcessed", std::to_string(nTracksProcessed_final)));
2346+
// run number and time range of the selected data
2347+
userInfo->Add(new TNamed("runNumber", std::to_string(runNumber)));
2348+
userInfo->Add(new TNamed("firstTFTime", std::to_string(firstTFTime)));
2349+
userInfo->Add(new TNamed("lastTFTime", std::to_string(lastTFTime)));
2350+
if (!timeMSsel.empty()) {
2351+
const auto [minTimeMSIt, maxTimeMSIt] = std::minmax_element(timeMSsel.begin(), timeMSsel.end());
2352+
userInfo->Add(new TNamed("minTimeMS", std::to_string(*minTimeMSIt)));
2353+
userInfo->Add(new TNamed("maxTimeMS", std::to_string(*maxTimeMSIt)));
2354+
}
23462355
if (isBadCalib) {
23472356
userInfo->Add(new TNamed("badCalib", "1"));
23482357
}

‎GPU/TPCFastTransformation/macro/TPCFastTransformInitCPM.C‎

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,21 +187,35 @@ void TPCFastTransformInitCPM(const char* fileName = "debugVoxRes.root",
187187
void createFastTransform(std::string outFileName, TTree* voxResTree, o2::tpc::TrackResiduals& trackResiduals, bool useSmoothed, bool invertSigns, float meanIDC, float meanCTP, int debug, int useCTPLumi)
188188
{
189189
LOGP(info, "create fast transformation ... ");
190-
std::regex reg(".*FT_voxRes\\.residuals\\.([0-9]{6})_([0-9]{13})_([0-9]{13})_([0-9]+)_([0-9]+).*\\.root");
191-
std::smatch base_match;
192-
int run = -1;
193-
long validFrom = -1;
194-
long validUntil = -1;
190+
// run and validity range from the input UserInfo (written by staticMapCreatorCPM.C). The output file
191+
// name is only parsed for older inputs without them and for the TF range of the old naming scheme.
192+
auto getLongFromUserInfo = [voxResTree](const char* name) {
193+
const auto obj = voxResTree->GetUserInfo()->FindObject(name);
194+
return obj ? std::atol(obj->GetTitle()) : -1L;
195+
};
196+
int run = static_cast<int>(getLongFromUserInfo("runNumber"));
197+
// requested time window if one was set, otherwise the time span of the selected TFs
198+
const long firstTFTime = getLongFromUserInfo("firstTFTime");
199+
const long lastTFTime = getLongFromUserInfo("lastTFTime");
200+
long validFrom = (firstTFTime > 0) ? firstTFTime : getLongFromUserInfo("minTimeMS");
201+
long validUntil = (lastTFTime > 0) ? lastTFTime : getLongFromUserInfo("maxTimeMS");
195202
int firstTF = -1;
196203
int lastTF = -1;
204+
std::regex reg(".*FT_voxRes\\.residuals\\.([0-9]{6})_([0-9]{13})_([0-9]{13})_([0-9]+)_([0-9]+).*\\.root");
205+
std::smatch base_match;
197206
if (std::regex_match(outFileName, base_match, reg)) {
198-
run = std::stoi(base_match[1].str());
199-
validFrom = std::stol(base_match[2].str());
200-
validUntil = std::stol(base_match[3].str());
207+
if (run < 0) {
208+
run = std::stoi(base_match[1].str());
209+
validFrom = std::stol(base_match[2].str());
210+
validUntil = std::stol(base_match[3].str());
211+
}
201212
firstTF = std::stol(base_match[4].str());
202213
lastTF = std::stol(base_match[5].str());
203-
LOGP(info, "Found run {}, validFrom {}, validUntil {}, firstTF {}, lastTF {}", run, validFrom, validUntil, firstTF, lastTF);
204214
}
215+
if (run < 0) {
216+
LOGP(warning, "Run number neither in the input UserInfo nor in the output file name {}", outFileName);
217+
}
218+
LOGP(info, "Found run {}, validFrom {}, validUntil {}, firstTF {}, lastTF {}", run, validFrom, validUntil, firstTF, lastTF);
205219

206220
auto* helper = o2::tpc::TPCFastTransformHelperO2::instance();
207221

0 commit comments

Comments
 (0)