Skip to content

Commit fced339

Browse files
authored
[ALICE3] fix for when using ini file for a3 detector setup from ccdb (#14886)
1 parent 28d0ddc commit fced339

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

ALICE3/Core/FastTracker.cxx

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

27+
#include <chrono>
2728
#include <fstream>
2829
#include <map>
2930
#include <string>
31+
#include <thread>
3032
#include <vector>
3133

3234
namespace o2
@@ -79,7 +81,30 @@ void GeometryContainer::init(o2::framework::InitContext& initContext)
7981
return;
8082
}
8183
LOG(info) << "Size of detector configuration: " << detectorConfiguration.size();
82-
for (const auto& configFile : detectorConfiguration) {
84+
for (std::string& configFile : detectorConfiguration) {
85+
if (configFile.rfind("ccdb:", 0) == 0) {
86+
LOG(info) << "ccdb source detected from on-the-fly-detector-geometry-provider";
87+
const std::string ccdbPath = configFile.substr(5); // remove "ccdb:" prefix
88+
const std::string outPath = "./.ALICE3/Configuration/";
89+
configFile = Form("%s/%s/snapshot.root", outPath.c_str(), ccdbPath.c_str());
90+
91+
int timeout = 600; // Wait max 10 minutes
92+
while (--timeout > 0) {
93+
std::ifstream file(configFile);
94+
if (file.good()) {
95+
break;
96+
}
97+
98+
std::this_thread::sleep_for(std::chrono::seconds(1));
99+
}
100+
101+
std::ifstream checkFile(configFile);
102+
if (!checkFile.good()) {
103+
LOG(fatal) << "Timed out waiting for geometry snapshot: " << configFile;
104+
return;
105+
}
106+
}
107+
83108
LOG(info) << "Detector geometry configuration file used: " << configFile;
84109
addEntry(configFile);
85110
}

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)