Skip to content

Commit c2fc428

Browse files
authored
Fix small bugs (AliceO2Group#812)
1 parent 26902a3 commit c2fc428

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

EventFiltering/PWGHF/HFFilter.cxx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,17 @@ struct HfFilter { // Main struct for HF triggers
383383
onnxFileXicToPiKPConf};
384384

385385
for (auto iCharmPart{0}; iCharmPart < kNCharmParticles; ++iCharmPart) {
386-
sessionML[iCharmPart].reset(new Ort::Experimental::Session{env[iCharmPart], onnxFiles[iCharmPart], sessionOptions[iCharmPart]});
387-
inputNamesML[iCharmPart] = sessionML[iCharmPart]->GetInputNames();
388-
inputShapesML[iCharmPart] = sessionML[iCharmPart]->GetInputShapes();
389-
if (inputShapesML[iCharmPart][0][0] < 0) {
390-
LOGF(warning, Form("Model for %s with negative input shape likely because converted with ummingbird, setting it to 1.", charmParticleNames[iCharmPart].data()));
391-
inputShapesML[iCharmPart][0][0] = 1;
386+
if (onnxFiles[iCharmPart] != "") {
387+
sessionML[iCharmPart].reset(new Ort::Experimental::Session{env[iCharmPart], onnxFiles[iCharmPart], sessionOptions[iCharmPart]});
388+
inputNamesML[iCharmPart] = sessionML[iCharmPart]->GetInputNames();
389+
inputShapesML[iCharmPart] = sessionML[iCharmPart]->GetInputShapes();
390+
if (inputShapesML[iCharmPart][0][0] < 0) {
391+
LOGF(warning, Form("Model for %s with negative input shape likely because converted with ummingbird, setting it to 1.", charmParticleNames[iCharmPart].data()));
392+
inputShapesML[iCharmPart][0][0] = 1;
393+
}
394+
outputNamesML[iCharmPart] = sessionML[iCharmPart]->GetOutputNames();
395+
outputShapesML[iCharmPart] = sessionML[iCharmPart]->GetOutputShapes();
392396
}
393-
outputNamesML[iCharmPart] = sessionML[iCharmPart]->GetOutputNames();
394-
outputShapesML[iCharmPart] = sessionML[iCharmPart]->GetOutputShapes();
395397
}
396398
}
397399
}
@@ -708,7 +710,7 @@ struct HfFilter { // Main struct for HF triggers
708710
assert(typeInfo.GetElementCount() == 3); // we need multiclass
709711
auto scores = outputTensorD0[1].GetTensorMutableData<float>();
710712

711-
if (applyML) {
713+
if (applyML && activateQA) {
712714
hBDTScoreBkg[kD0]->Fill(scores[0]);
713715
hBDTScorePrompt[kD0]->Fill(scores[1]);
714716
hBDTScoreNonPrompt[kD0]->Fill(scores[2]);
@@ -836,7 +838,7 @@ struct HfFilter { // Main struct for HF triggers
836838
assert(typeInfo.GetElementCount() == 3); // we need multiclass
837839
auto scores = outputTensor[1].GetTensorMutableData<float>();
838840

839-
if (applyML) {
841+
if (applyML && activateQA) {
840842
hBDTScoreBkg[iCharmPart]->Fill(scores[0]);
841843
hBDTScorePrompt[iCharmPart]->Fill(scores[1]);
842844
hBDTScoreNonPrompt[iCharmPart]->Fill(scores[2]);

0 commit comments

Comments
 (0)