|
48 | 48 | #include <ReconstructionDataFormats/DCA.h> |
49 | 49 |
|
50 | 50 | #include <TF1.h> |
| 51 | +#include <TFile.h> |
| 52 | +#include <TH1F.h> |
51 | 53 | #include <TH2F.h> |
52 | 54 | #include <TString.h> |
53 | 55 | #include <TVector3.h> |
54 | | -#include <TFile.h> |
55 | | -#include <TH1F.h> |
56 | 56 |
|
57 | 57 | #include <algorithm> |
58 | 58 | #include <array> |
@@ -119,30 +119,30 @@ class ToTLUT |
119 | 119 | } |
120 | 120 | } |
121 | 121 |
|
122 | | - bool load(int pdg, const std::string& filename, o2::ccdb::BasicCCDBManager *ccdb=nullptr) |
| 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."; |
| 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(); |
135 | 143 | } |
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(); |
| 144 | + return load(pdg, filename); |
143 | 145 | } |
144 | | - return load(pdg, filename); |
145 | | - } |
146 | 146 | TFile* f = TFile::Open(filename.c_str()); |
147 | 147 | if (!f || f->IsZombie()) { |
148 | 148 | LOG(error) << "Failed to open LUT file: " << filename; |
|
0 commit comments