From 3fa5384d15b1f487b0a0f21776696e9a23e5ca0b Mon Sep 17 00:00:00 2001 From: Maja Kabus Date: Mon, 3 Oct 2022 10:06:55 +0200 Subject: [PATCH] Add fixed timestamp option for Hyperloop tests --- Tools/PIDML/simpleApplyPidOnnxInterface.cxx | 6 +++++- Tools/PIDML/simpleApplyPidOnnxModel.cxx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Tools/PIDML/simpleApplyPidOnnxInterface.cxx b/Tools/PIDML/simpleApplyPidOnnxInterface.cxx index 1f53a278831..7127f42e65a 100644 --- a/Tools/PIDML/simpleApplyPidOnnxInterface.cxx +++ b/Tools/PIDML/simpleApplyPidOnnxInterface.cxx @@ -51,6 +51,9 @@ struct SimpleApplyOnnxInterface { Configurable cfgUseCCDB{"useCCDB", true, "Whether to autofetch ML model from CCDB. If false, local file will be used."}; Configurable cfgPathLocal{"local-path", "/home/mkabus/PIDML/", "base path to the local directory with ONNX models"}; + Configurable cfgUseFixedTimestamp{"use-fixed-timestamp", false, "Whether to use fixed timestamp from configurable instead of timestamp calculated from the data"}; + Configurable cfgTimestamp{"timestamp", 1524176895000, "Hardcoded timestamp for tests"}; + o2::ccdb::CcdbApi ccdbApi; int currentRunNumber = -1; @@ -75,7 +78,8 @@ struct SimpleApplyOnnxInterface { { auto bc = collisions.iteratorAt(0).bc_as(); if (cfgUseCCDB && bc.runNumber() != currentRunNumber) { - pidInterface = PidONNXInterface(cfgPathLocal.value, cfgPathCCDB.value, cfgUseCCDB.value, ccdbApi, bc.timestamp(), cfgPids.value, cfgPTCuts.value, cfgCertainties.value, cfgAutoMode.value); + uint64_t timestamp = cfgUseFixedTimestamp ? cfgTimestamp.value : bc.timestamp(); + pidInterface = PidONNXInterface(cfgPathLocal.value, cfgPathCCDB.value, cfgUseCCDB.value, ccdbApi, timestamp, cfgPids.value, cfgPTCuts.value, cfgCertainties.value, cfgAutoMode.value); } for (auto& track : tracks) { diff --git a/Tools/PIDML/simpleApplyPidOnnxModel.cxx b/Tools/PIDML/simpleApplyPidOnnxModel.cxx index 50794478325..1601f096a58 100644 --- a/Tools/PIDML/simpleApplyPidOnnxModel.cxx +++ b/Tools/PIDML/simpleApplyPidOnnxModel.cxx @@ -49,6 +49,9 @@ struct SimpleApplyOnnxModel { Configurable cfgUseCCDB{"useCCDB", true, "Whether to autofetch ML model from CCDB. If false, local file will be used."}; Configurable cfgPathLocal{"local-path", "/home/mkabus/PIDML", "base path to the local directory with ONNX models"}; + Configurable cfgUseFixedTimestamp{"use-fixed-timestamp", false, "Whether to use fixed timestamp from configurable instead of timestamp calculated from the data"}; + Configurable cfgTimestamp{"timestamp", 1524176895000, "Hardcoded timestamp for tests"}; + o2::ccdb::CcdbApi ccdbApi; int currentRunNumber = -1; @@ -73,7 +76,8 @@ struct SimpleApplyOnnxModel { { auto bc = collisions.iteratorAt(0).bc_as(); if (cfgUseCCDB && bc.runNumber() != currentRunNumber) { - pidModel = PidONNXModel(cfgPathLocal.value, cfgPathCCDB.value, cfgUseCCDB.value, ccdbApi, bc.timestamp(), cfgPid.value, static_cast(cfgDetector.value), cfgCertainty.value); + uint64_t timestamp = cfgUseFixedTimestamp ? cfgTimestamp.value : bc.timestamp(); + pidModel = PidONNXModel(cfgPathLocal.value, cfgPathCCDB.value, cfgUseCCDB.value, ccdbApi, timestamp, cfgPid.value, static_cast(cfgDetector.value), cfgCertainty.value); } for (auto& track : tracks) {