3636
3737#include " ALICE3/Core/DelphesO2TrackSmearer.h"
3838
39+ #include " ALICE3/Core/GeometryContainer.h"
40+
3941#include < CommonConstants/PhysicsConstants.h>
4042#include < Framework/Logger.h>
4143
@@ -61,42 +63,13 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
6163 LOG (info) << " --- LUT table for PDG " << pdg << " has been already loaded with index " << ipdg << std::endl;
6264 return false ;
6365 }
64- if (strncmp (filename, " ccdb:" , 5 ) == 0 ) { // Check if filename starts with "ccdb:"
65- LOG (info) << " --- LUT file source identified as CCDB." ;
66- std::string path = std::string (filename).substr (5 ); // Remove "ccdb:" prefix
67- filename = Form (" %s/%s/snapshot.root" , mOutPath .c_str (), path.c_str ());
68- LOG (info) << " --- Local LUT filename will be: " << filename;
69- std::ifstream checkFile (filename); // Check if file already exists
70- if (!checkFile.is_open ()) { // File does not exist, retrieve from CCDB
71- LOG (info) << " --- CCDB source detected for PDG " << pdg << " : " << path;
72- if (!mCcdbManager ) {
73- LOG (fatal) << " --- CCDB manager not set. Please set it before loading LUT from CCDB." ;
74- }
75- std::map<std::string, std::string> metadata;
76- mCcdbManager ->getCCDBAccessor ().retrieveBlob (path, mOutPath , metadata, 1 );
77- // Add CCDB handling logic here if needed
78- LOG (info) << " --- Now retrieving LUT file from CCDB to: " << filename;
79- if (mCleanupDownloadedFile ) { // Clean up the downloaded file if needed
80- bool status = loadTable (pdg, filename, forceReload);
81- if (std::remove (filename) != 0 ) {
82- LOG (warn) << " --- Could not remove temporary LUT file: " << filename;
83- } else {
84- LOG (info) << " --- Removed temporary LUT file: " << filename;
85- }
86- return status;
87- }
88- } else { // File exists, proceed to load
89- LOG (info) << " --- LUT file already exists: " << filename << " . Skipping download." ;
90- checkFile.close ();
91- }
92- return loadTable (pdg, filename, forceReload);
93- }
9466
67+ const std::string localFilename = o2::fastsim::GeometryEntry::accessFile (filename, " ./.ALICE3/LUTs/" , mCcdbManager , 10 );
9568 mLUTHeader [ipdg] = new lutHeader_t;
9669
97- std::ifstream lutFile (filename , std::ifstream::binary);
70+ std::ifstream lutFile (localFilename , std::ifstream::binary);
9871 if (!lutFile.is_open ()) {
99- LOG (info) << " --- cannot open covariance matrix file for PDG " << pdg << " : " << filename << std::endl;
72+ LOG (info) << " --- cannot open covariance matrix file for PDG " << pdg << " : " << localFilename << std::endl;
10073 delete mLUTHeader [ipdg];
10174 mLUTHeader [ipdg] = nullptr ;
10275 return false ;
@@ -147,7 +120,7 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
147120 mLUTEntry [ipdg][inch][irad][ieta][ipt] = new lutEntry_t;
148121 lutFile.read (reinterpret_cast <char *>(mLUTEntry [ipdg][inch][irad][ieta][ipt]), sizeof (lutEntry_t));
149122 if (lutFile.gcount () != sizeof (lutEntry_t)) {
150- LOG (info) << " --- troubles reading covariance matrix entry for PDG " << pdg << " : " << filename << std::endl;
123+ LOG (info) << " --- troubles reading covariance matrix entry for PDG " << pdg << " : " << localFilename << std::endl;
151124 LOG (info) << " --- expected/detected " << sizeof (lutHeader_t) << " /" << lutFile.gcount () << std::endl;
152125 return false ;
153126 }
0 commit comments