Skip to content

Commit 7a19c99

Browse files
committed
Reuse simulation CCDB manager for ONNX model
1 parent 70d1cd2 commit 7a19c99

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎DataFormats/simulation/include/SimulationDataFormat/StackParam.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ struct StackParam : public o2::conf::ConfigurableParamHelper<StackParam> {
3030
bool transportPrimaryInvert = false;
3131
// Used when transportPrimary="onnx". The model is fetched as raw ONNX bytes
3232
// and class 1 means "skip GEANT transport".
33-
std::string transportPrimaryOnnxCCDBUrl = "http://alice-ccdb.cern.ch";
3433
std::string transportPrimaryOnnxCCDBPath = "";
35-
long transportPrimaryOnnxTimestamp = -1;
3634
float transportPrimaryOnnxThreshold = 0.5f;
3735
int transportPrimaryOnnxOutputIndex = 0;
3836
bool transportPrimaryOnnxApplySigmoid = true;

‎Detectors/Base/src/Stack.cxx‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "SimulationDataFormat/BaseHits.h"
2626
#include "SimulationDataFormat/StackParam.h"
2727
#include "CommonUtils/ConfigurationMacroHelper.h"
28-
#include "CCDB/CcdbApi.h"
28+
#include "CCDB/BasicCCDBManager.h"
2929
#include "ML/OrtInterface.h"
3030

3131
#include "TLorentzVector.h" // for TLorentzVector
@@ -70,11 +70,15 @@ class OnnxPrimaryTransport
7070
throw std::runtime_error("Stack.transportPrimaryOnnxCCDBPath must be configured");
7171
}
7272

73-
o2::ccdb::CcdbApi ccdb;
74-
ccdb.init(param.transportPrimaryOnnxCCDBUrl);
73+
auto& ccdbManager = o2::ccdb::BasicCCDBManager::instance();
74+
auto& ccdb = ccdbManager.getCCDBAccessor();
7575
std::map<std::string, std::string> headers;
76+
const auto createdNotAfter = ccdbManager.getCreatedNotAfter();
77+
const auto createdNotBefore = ccdbManager.getCreatedNotBefore();
7678
ccdb.loadFileToMemory(mModelBytes, param.transportPrimaryOnnxCCDBPath, {},
77-
param.transportPrimaryOnnxTimestamp, &headers, {}, {}, {});
79+
ccdbManager.getTimestamp(), &headers, {},
80+
createdNotAfter ? std::to_string(createdNotAfter) : "",
81+
createdNotBefore ? std::to_string(createdNotBefore) : "");
7882
if (mModelBytes.empty()) {
7983
throw std::runtime_error("failed to retrieve ONNX model from CCDB path " + param.transportPrimaryOnnxCCDBPath);
8084
}

0 commit comments

Comments
 (0)