Skip to content

Commit ee61fcf

Browse files
committed
fix for when using ini file for a3 detector setup from ccdb
1 parent 745cb50 commit ee61fcf

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

ALICE3/Core/FastTracker.cxx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <TRandom.h>
2525
#include <TSystem.h>
2626

27+
#include <filesystem>
2728
#include <fstream>
2829
#include <map>
2930
#include <string>
@@ -79,7 +80,24 @@ void GeometryContainer::init(o2::framework::InitContext& initContext)
7980
return;
8081
}
8182
LOG(info) << "Size of detector configuration: " << detectorConfiguration.size();
82-
for (const auto& configFile : detectorConfiguration) {
83+
for (std::string& configFile : detectorConfiguration) {
84+
if (configFile.rfind("ccdb:", 0) == 0) {
85+
LOG(info) << "ccdb source detected from on-the-fly-detector-geometry-provider";
86+
const std::string ccdbPath = configFile.substr(5); // remove "ccdb:" prefix
87+
const std::string outPath = "./.ALICE3/Configuration/";
88+
configFile = Form("%s/%s/snapshot.root", outPath.c_str(), ccdbPath.c_str());
89+
90+
int timeout = 600; // Wait max 10 minutes
91+
while (!std::filesystem::exists(configFile) && --timeout > 0) {
92+
std::this_thread::sleep_for(std::chrono::seconds(1));
93+
}
94+
95+
if (!std::filesystem::exists(configFile)) {
96+
LOG(fatal) << "Timed out waiting for geometry snapshot: " << configFile;
97+
return;
98+
}
99+
}
100+
83101
LOG(info) << "Detector geometry configuration file used: " << configFile;
84102
addEntry(configFile);
85103
}

ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct OnTheFlyDetectorGeometryProvider {
5050
// If the filename starts with ccdb: then take the file from the ccdb
5151
if (configFile.rfind("ccdb:", 0) == 0) {
5252
std::string ccdbPath = configFile.substr(5); // remove "ccdb:" prefix
53-
const std::string outPath = "/tmp/DetGeo/";
53+
const std::string outPath = "./.ALICE3/Configuration/";
5454
configFile = Form("%s/%s/snapshot.root", outPath.c_str(), ccdbPath.c_str());
5555
std::ifstream checkFile(configFile); // Check if file already exists
5656
if (!checkFile.is_open()) { // File does not exist, retrieve from CCDB
@@ -64,6 +64,7 @@ struct OnTheFlyDetectorGeometryProvider {
6464
}
6565
detectorConfiguration.value[idx] = configFile; // Update the filename to the local file
6666
}
67+
LOG(info) << "Adding " << configFile << "geometry container";
6768
geometryContainer.addEntry(configFile);
6869
idx++;
6970
}

0 commit comments

Comments
 (0)