Skip to content

Commit b4f0592

Browse files
authored
[ALICE3] Fix local path of LUT for ToT (AliceO2Group#14434)
1 parent 0391f17 commit b4f0592

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

ALICE3/TableProducer/OTF/onTheFlyTrackerPid.cxx

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,21 @@ class ToTLUT
140140
LOG(warning) << "Provided filename is empty for PDG " << pdg;
141141
return false;
142142
}
143-
if (strncmp(filename.c_str(), "ccdb:", 5) == 0) { // Check if filename starts with "ccdb:"
144-
const std::string basePath = std::string(filename).substr(5);
145-
const std::string outPath = "/tmp/ToTLUTs/" + basePath;
146-
const std::string localFilename = outPath + "/snapshot.root";
143+
if (filename.rfind("ccdb:", 0) == 0) { // Check if filename starts with "ccdb:"
144+
std::string ccdbPath = filename.substr(5); // remove "ccdb:" prefix
145+
const std::string outPath = "/tmp/ToTLUTs/";
146+
const std::string localFilename = outPath + ccdbPath + "/snapshot.root";
147147
std::ifstream checkFile(localFilename);
148148
if (!checkFile.is_open()) { // File is not found, need to download it from CCDB
149149
if (!mCcdbManager) {
150150
LOG(fatal) << "CCDB manager not set. Please set it before loading LUT from CCDB.";
151151
}
152152
std::map<std::string, std::string> metadata;
153-
mCcdbManager->getCCDBAccessor().retrieveBlob(basePath, outPath, metadata, 1);
153+
LOG(info) << "Retrieving " << localFilename << " from CCDB path: " << ccdbPath;
154+
mCcdbManager->getCCDBAccessor().retrieveBlob(ccdbPath, outPath, metadata, 1);
154155
std::ifstream testFile(localFilename);
155156
if (!testFile.is_open()) {
156-
LOG(fatal) << "Could not find downloaded CCDB file for PDG " << pdg;
157+
LOG(fatal) << "Could not find downloaded CCDB file for PDG " << pdg << " in file " << localFilename;
157158
return false;
158159
}
159160
testFile.close();
@@ -396,15 +397,15 @@ struct OnTheFlyTrackerPid {
396397

397398
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
398399

399-
Configurable<std::string> lutTotEl{"lutTotEl", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_11/", "ToT LUT for electrons"};
400-
Configurable<std::string> lutTotMu{"lutTotMu", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_13/", "ToT LUT for muons"};
401-
Configurable<std::string> lutTotPi{"lutTotPi", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_211/", "ToT LUT for pions"};
402-
Configurable<std::string> lutTotKa{"lutTotKa", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_321/", "ToT LUT for kaons"};
403-
Configurable<std::string> lutTotPr{"lutTotPr", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_2212/", "ToT LUT for protons"};
404-
Configurable<std::string> lutTotDe{"lutTotDe", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_1000010020/", "ToT LUT for deuteron"};
405-
Configurable<std::string> lutTotTr{"lutTotTr", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_1000010030/", "ToT LUT for triton"};
406-
Configurable<std::string> lutTotHe{"lutTotHe", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_1000020030/", "ToT LUT for helium-3"};
407-
Configurable<std::string> lutTotAl{"lutTotAl", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_1000020040/", "ToT LUT for alphas"};
400+
Configurable<std::string> lutTotEl{"lutTotEl", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_11", "ToT LUT for electrons"};
401+
Configurable<std::string> lutTotMu{"lutTotMu", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_13", "ToT LUT for muons"};
402+
Configurable<std::string> lutTotPi{"lutTotPi", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_211", "ToT LUT for pions"};
403+
Configurable<std::string> lutTotKa{"lutTotKa", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_321", "ToT LUT for kaons"};
404+
Configurable<std::string> lutTotPr{"lutTotPr", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_2212", "ToT LUT for protons"};
405+
Configurable<std::string> lutTotDe{"lutTotDe", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_1000010020", "ToT LUT for deuteron"};
406+
Configurable<std::string> lutTotTr{"lutTotTr", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_1000010030", "ToT LUT for triton"};
407+
Configurable<std::string> lutTotHe{"lutTotHe", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_1000020030", "ToT LUT for helium-3"};
408+
Configurable<std::string> lutTotAl{"lutTotAl", "ccdb:Users/h/hfribert/ToT_LUTs/PDG_1000020040", "ToT LUT for alphas"};
408409

409410
Configurable<int> maxBarrelLayers{"maxBarrelLayers", 11, "Maximum number of barrel layers"};
410411
Configurable<int> numLogBins{"numLogBins", 200, "Number of logarithmic momentum bins"};

0 commit comments

Comments
 (0)