Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 2 additions & 20 deletions ALICE3/TableProducer/OTF/onTheFlyDetectorGeometryProvider.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct OnTheFlyDetectorGeometryProvider {
ccdb->setURL("http://alice-ccdb.cern.ch");
ccdb->setTimestamp(-1);
o2::fastsim::GeometryContainer geometryContainer; // Checking that the geometry files can be accessed and loaded
geometryContainer.setCcdbManager(ccdb.operator->());
LOG(info) << "On-the-fly detector geometry provider running.";
if (detectorConfiguration.value.empty()) {
LOG(fatal) << "No detector configuration files provided.";
Expand All @@ -47,27 +48,8 @@ struct OnTheFlyDetectorGeometryProvider {
int idx = 0;
for (std::string& configFile : detectorConfiguration.value) {
LOG(info) << "Loading detector geometry from configuration file: " << configFile;
histos.add<TH1>(Form("GeometryConfigFile_%d", idx), configFile.c_str(), o2::framework::HistType::kTH1D, {{1, 0, 1}})->Fill(0.5);
// If the filename starts with ccdb: then take the file from the ccdb
if (configFile.rfind("ccdb:", 0) == 0) {
std::string ccdbPath = configFile.substr(5); // remove "ccdb:" prefix
const std::string outPath = "./.ALICE3/Configuration/";
configFile = Form("%s/%s/snapshot.root", outPath.c_str(), ccdbPath.c_str());
std::ifstream checkFile(configFile); // Check if file already exists
if (!checkFile.is_open()) { // File does not exist, retrieve from CCDB
LOG(info) << " --- CCDB source detected for detector geometry " << configFile;
std::map<std::string, std::string> metadata;
ccdb->getCCDBAccessor().retrieveBlob(ccdbPath, outPath, metadata, 1);
LOG(info) << " --- Now retrieving geometry configuration from CCDB to: " << configFile;
} else { // File exists, proceed to load
LOG(info) << " --- Geometry configuration file already exists: " << configFile << ". Skipping download.";
checkFile.close();
}
detectorConfiguration.value[idx] = configFile; // Update the filename to the local file
}
LOG(info) << "Adding " << configFile << " to geometry container";
histos.add<TH1>(Form("GeometryConfigFile_%d", idx++), configFile.c_str(), o2::framework::HistType::kTH1D, {{1, 0, 1}})->Fill(0.5);
geometryContainer.addEntry(configFile);
idx++;
}

// First we check that the magnetic field is consistent
Expand Down
Loading