|
28 | 28 | #include "Common/Core/trackUtilities.h" |
29 | 29 | #include "Common/DataModel/TrackSelectionTables.h" |
30 | 30 |
|
31 | | -#include "CCDB/BasicCCDBManager.h" |
32 | | -#include "CCDB/CcdbApi.h" |
33 | | -#include "CommonConstants/GeomConstants.h" |
34 | | -#include "CommonConstants/PhysicsConstants.h" |
35 | | -#include "CommonUtils/NameConf.h" |
36 | | -#include "DataFormatsCalibration/MeanVertexObject.h" |
37 | | -#include "DataFormatsParameters/GRPMagField.h" |
38 | | -#include "DetectorsBase/GeometryManager.h" |
39 | | -#include "DetectorsBase/Propagator.h" |
40 | | -#include "DetectorsVertexing/HelixHelper.h" |
41 | | -#include "Framework/ASoAHelpers.h" |
42 | | -#include "Framework/AnalysisDataModel.h" |
43 | | -#include "Framework/AnalysisTask.h" |
44 | | -#include "Framework/HistogramRegistry.h" |
45 | | -#include "Framework/O2DatabasePDGPlugin.h" |
46 | | -#include "Framework/RunningWorkflowInfo.h" |
47 | | -#include "Framework/runDataProcessing.h" |
48 | | -#include "ReconstructionDataFormats/DCA.h" |
49 | | - |
50 | | -#include "TF1.h" |
51 | | -#include "TH2F.h" |
52 | | -#include "TString.h" |
53 | | -#include "TVector3.h" |
| 31 | +#include <CCDB/BasicCCDBManager.h> |
| 32 | +#include <CCDB/CcdbApi.h> |
| 33 | +#include <CommonConstants/GeomConstants.h> |
| 34 | +#include <CommonConstants/PhysicsConstants.h> |
| 35 | +#include <CommonUtils/NameConf.h> |
| 36 | +#include <DataFormatsCalibration/MeanVertexObject.h> |
| 37 | +#include <DataFormatsParameters/GRPMagField.h> |
| 38 | +#include <DetectorsBase/GeometryManager.h> |
| 39 | +#include <DetectorsBase/Propagator.h> |
| 40 | +#include <DetectorsVertexing/HelixHelper.h> |
| 41 | +#include <Framework/ASoAHelpers.h> |
| 42 | +#include <Framework/AnalysisDataModel.h> |
| 43 | +#include <Framework/AnalysisTask.h> |
| 44 | +#include <Framework/HistogramRegistry.h> |
| 45 | +#include <Framework/O2DatabasePDGPlugin.h> |
| 46 | +#include <Framework/RunningWorkflowInfo.h> |
| 47 | +#include <Framework/runDataProcessing.h> |
| 48 | +#include <ReconstructionDataFormats/DCA.h> |
| 49 | + |
| 50 | +#include <TF1.h> |
| 51 | +#include <TH2F.h> |
| 52 | +#include <TString.h> |
| 53 | +#include <TVector3.h> |
54 | 54 | #include <TFile.h> |
55 | 55 | #include <TH1F.h> |
56 | 56 |
|
@@ -119,8 +119,30 @@ class ToTLUT |
119 | 119 | } |
120 | 120 | } |
121 | 121 |
|
122 | | - bool load(int pdg, const std::string& filename) |
| 122 | + bool load(int pdg, const std::string& filename, o2::ccdb::BasicCCDBManager *ccdb=nullptr) |
123 | 123 | { |
| 124 | + if (strncmp(filename, "ccdb:", 5) == 0) { // Check if filename starts with "ccdb:" |
| 125 | + // NOTE: this eventually will directly fetch the object from CCDB instead of accessing it via the root file |
| 126 | + LOG(info) << " --- ToT LUT file source identified as CCDB."; |
| 127 | + std::string path = std::string(filename).substr(5); // Remove "ccdb:" prefix |
| 128 | + const std::string outPath = "/tmp/ToTLUTs/"; |
| 129 | + filename = Form("%s/%s/snapshot.root", outPath.c_str(), path.c_str()); |
| 130 | + TFile checkFile(filename.c_str(), "READ"); |
| 131 | + if (!checkFile.IsOpen()) { // File does not exist, retrieve from CCDB |
| 132 | + LOG(info) << " --- CCDB source detected for PDG " << pdg << ": " << path; |
| 133 | + if (!ccdb) { |
| 134 | + LOG(fatal) << " --- CCDB manager not set. Please provide it."; |
| 135 | + } |
| 136 | + std::map<std::string, std::string> metadata; |
| 137 | + ccdb->getCCDBAccessor().retrieveBlob(path, outPath, metadata, 1); |
| 138 | + // Add CCDB handling logic here if needed |
| 139 | + LOG(info) << " --- Now retrieving ToT LUT file from CCDB to: " << filename; |
| 140 | + } else { // File exists, proceed to load |
| 141 | + LOG(info) << " --- ToT LUT file already exists: " << filename << ". Skipping download."; |
| 142 | + checkFile.Close(); |
| 143 | + } |
| 144 | + return load(pdg, filename); |
| 145 | + } |
124 | 146 | TFile* f = TFile::Open(filename.c_str()); |
125 | 147 | if (!f || f->IsZombie()) { |
126 | 148 | LOG(error) << "Failed to open LUT file: " << filename; |
|
0 commit comments