File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 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
3234namespace 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 }
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments