Skip to content

Commit a182478

Browse files
authored
Add fixed timestamp option for Hyperloop tests (#1318)
1 parent 71f3c6a commit a182478

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

Tools/PIDML/simpleApplyPidOnnxInterface.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ struct SimpleApplyOnnxInterface {
5151
Configurable<bool> cfgUseCCDB{"useCCDB", true, "Whether to autofetch ML model from CCDB. If false, local file will be used."};
5252
Configurable<std::string> cfgPathLocal{"local-path", "/home/mkabus/PIDML/", "base path to the local directory with ONNX models"};
5353

54+
Configurable<bool> cfgUseFixedTimestamp{"use-fixed-timestamp", false, "Whether to use fixed timestamp from configurable instead of timestamp calculated from the data"};
55+
Configurable<uint64_t> cfgTimestamp{"timestamp", 1524176895000, "Hardcoded timestamp for tests"};
56+
5457
o2::ccdb::CcdbApi ccdbApi;
5558
int currentRunNumber = -1;
5659

@@ -75,7 +78,8 @@ struct SimpleApplyOnnxInterface {
7578
{
7679
auto bc = collisions.iteratorAt(0).bc_as<aod::BCsWithTimestamps>();
7780
if (cfgUseCCDB && bc.runNumber() != currentRunNumber) {
78-
pidInterface = PidONNXInterface(cfgPathLocal.value, cfgPathCCDB.value, cfgUseCCDB.value, ccdbApi, bc.timestamp(), cfgPids.value, cfgPTCuts.value, cfgCertainties.value, cfgAutoMode.value);
81+
uint64_t timestamp = cfgUseFixedTimestamp ? cfgTimestamp.value : bc.timestamp();
82+
pidInterface = PidONNXInterface(cfgPathLocal.value, cfgPathCCDB.value, cfgUseCCDB.value, ccdbApi, timestamp, cfgPids.value, cfgPTCuts.value, cfgCertainties.value, cfgAutoMode.value);
7983
}
8084

8185
for (auto& track : tracks) {

Tools/PIDML/simpleApplyPidOnnxModel.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ struct SimpleApplyOnnxModel {
4949
Configurable<bool> cfgUseCCDB{"useCCDB", true, "Whether to autofetch ML model from CCDB. If false, local file will be used."};
5050
Configurable<std::string> cfgPathLocal{"local-path", "/home/mkabus/PIDML", "base path to the local directory with ONNX models"};
5151

52+
Configurable<bool> cfgUseFixedTimestamp{"use-fixed-timestamp", false, "Whether to use fixed timestamp from configurable instead of timestamp calculated from the data"};
53+
Configurable<uint64_t> cfgTimestamp{"timestamp", 1524176895000, "Hardcoded timestamp for tests"};
54+
5255
o2::ccdb::CcdbApi ccdbApi;
5356
int currentRunNumber = -1;
5457

@@ -73,7 +76,8 @@ struct SimpleApplyOnnxModel {
7376
{
7477
auto bc = collisions.iteratorAt(0).bc_as<aod::BCsWithTimestamps>();
7578
if (cfgUseCCDB && bc.runNumber() != currentRunNumber) {
76-
pidModel = PidONNXModel(cfgPathLocal.value, cfgPathCCDB.value, cfgUseCCDB.value, ccdbApi, bc.timestamp(), cfgPid.value, static_cast<PidMLDetector>(cfgDetector.value), cfgCertainty.value);
79+
uint64_t timestamp = cfgUseFixedTimestamp ? cfgTimestamp.value : bc.timestamp();
80+
pidModel = PidONNXModel(cfgPathLocal.value, cfgPathCCDB.value, cfgUseCCDB.value, ccdbApi, timestamp, cfgPid.value, static_cast<PidMLDetector>(cfgDetector.value), cfgCertainty.value);
7781
}
7882

7983
for (auto& track : tracks) {

0 commit comments

Comments
 (0)