Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PWGJE/Core/MlResponseHfTagging.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include <onnxruntime_c_api.h>
#include <onnxruntime_cxx_api.h>

#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cmath>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -209,7 +209,7 @@
static int replaceNaN(std::vector<T>& vec, T value)
{
int numNaN = 0;
for (auto& el : vec) {

Check failure on line 212 in PWGJE/Core/MlResponseHfTagging.h

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (std::isnan(el) || std::isinf(el)) {
el = value;
++numNaN;
Expand Down Expand Up @@ -409,7 +409,7 @@
static int replaceNaN(std::vector<T>& vec, T value)
{
int numNaN = 0;
for (auto& el : vec) { // o2-linter: disable=const-ref-in-for-loop

Check failure on line 412 in PWGJE/Core/MlResponseHfTagging.h

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (std::isnan(el)) {
el = value;
++numNaN;
Expand Down Expand Up @@ -455,7 +455,7 @@
std::vector<int64_t> featShape{nNodes, nJetFeat + nTrkFeat};

int numNaN = replaceNaN(jetFeat, 0.f);
for (auto& aTrkFeat : trkFeat) { // o2-linter: disable=const-ref-in-for-loop

Check failure on line 458 in PWGJE/Core/MlResponseHfTagging.h

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
for (size_t i = 0; i < jetFeat.size(); ++i)
feat.push_back(jetFeatureTransform(jetFeat[i], i));
numNaN += replaceNaN(aTrkFeat, 0.f);
Expand Down
122 changes: 65 additions & 57 deletions PWGJE/Tasks/bjetTaggingGnn.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#include "PWGJE/DataModel/JetReducedData.h"
#include "PWGJE/DataModel/JetTagging.h"

#include "Common/DataModel/EventSelection.h"
#include "Common/CCDB/TriggerAliases.h"
#include "Common/Core/Zorro.h"
#include "Common/Core/ZorroSummary.h"
#include "Common/DataModel/EventSelection.h"

#include "CCDB/BasicCCDBManager.h"
#include "Framework/ASoA.h"
Expand All @@ -46,62 +46,70 @@
using namespace o2::framework;
using namespace o2::framework::expressions;

namespace BjetTaggingGnnEvtSel {
enum class EvtSelFlag : uint8_t {
kNone = 0,
kINEL = 1 << 0,
kColl = 1 << 1,
kTVX = 1 << 2,
kNoTFB = 1 << 3,
kNoITSROFB = 1 << 4,
kZvtx = 1 << 5,
kINELgt0 = 1 << 6,
kINELgt0rec = 1 << 7,

INEL = kINEL,
INELZvtx = kINEL | kZvtx,
Coll = kINEL | kColl,
CollZvtx = kINEL | kColl | kZvtx,
TVX = kINEL | kColl | kTVX,
TVXZvtx = kINEL | kColl | kTVX | kZvtx,
SelMC = kINEL | kColl | kTVX | kNoTFB,
SelMCZvtx = kINEL | kColl | kTVX | kNoTFB | kZvtx,
Sel8 = kINEL | kColl | kTVX | kNoTFB | kNoITSROFB,
Sel8Zvtx = kINEL | kColl | kTVX | kNoTFB | kNoITSROFB | kZvtx,
INELgt0 = kINEL | kZvtx | kINELgt0,
INELgt0rec = kINEL | kZvtx | kColl | kTVX | kNoTFB | kNoITSROFB | kINELgt0rec
};
constexpr EvtSelFlag operator|(EvtSelFlag a, EvtSelFlag b)
{
return static_cast<EvtSelFlag>(
static_cast<uint8_t>(a) | static_cast<uint8_t>(b)
);
}
constexpr EvtSelFlag operator|=(EvtSelFlag& a, EvtSelFlag b)
{
return a = a | b;
}
constexpr EvtSelFlag operator&(EvtSelFlag a, EvtSelFlag b)
{
return static_cast<EvtSelFlag>(
static_cast<uint8_t>(a) & static_cast<uint8_t>(b)
);
}
constexpr bool hasAll(EvtSelFlag value, EvtSelFlag required)
{
return (value & required) == required;
}
constexpr bool hasAny(EvtSelFlag value, EvtSelFlag mask)
{
return (value & mask) != EvtSelFlag::kNone;
}
enum class EvtSel {
None,
INEL, INELZvtx, Coll, CollZvtx, TVX,
TVXZvtx, SelMC, SelMCZvtx, Sel8, Sel8Zvtx,
INELgt0, INELgt0rec
};
namespace BjetTaggingGnnEvtSel
{
enum class EvtSelFlag : uint8_t {
kNone = 0,
kINEL = 1 << 0,
kColl = 1 << 1,
kTVX = 1 << 2,
kNoTFB = 1 << 3,
kNoITSROFB = 1 << 4,
kZvtx = 1 << 5,
kINELgt0 = 1 << 6,
kINELgt0rec = 1 << 7,

INEL = kINEL,
INELZvtx = kINEL | kZvtx,
Coll = kINEL | kColl,
CollZvtx = kINEL | kColl | kZvtx,
TVX = kINEL | kColl | kTVX,
TVXZvtx = kINEL | kColl | kTVX | kZvtx,
SelMC = kINEL | kColl | kTVX | kNoTFB,
SelMCZvtx = kINEL | kColl | kTVX | kNoTFB | kZvtx,
Sel8 = kINEL | kColl | kTVX | kNoTFB | kNoITSROFB,
Sel8Zvtx = kINEL | kColl | kTVX | kNoTFB | kNoITSROFB | kZvtx,
INELgt0 = kINEL | kZvtx | kINELgt0,
INELgt0rec = kINEL | kZvtx | kColl | kTVX | kNoTFB | kNoITSROFB | kINELgt0rec
};
constexpr EvtSelFlag operator|(EvtSelFlag a, EvtSelFlag b)
{
return static_cast<EvtSelFlag>(
static_cast<uint8_t>(a) | static_cast<uint8_t>(b));
}
constexpr EvtSelFlag operator|=(EvtSelFlag& a, EvtSelFlag b)
{
return a = a | b;
}
constexpr EvtSelFlag operator&(EvtSelFlag a, EvtSelFlag b)
{
return static_cast<EvtSelFlag>(
static_cast<uint8_t>(a) & static_cast<uint8_t>(b));
}
constexpr bool hasAll(EvtSelFlag value, EvtSelFlag required)
{
return (value & required) == required;
}
constexpr bool hasAny(EvtSelFlag value, EvtSelFlag mask)
{
return (value & mask) != EvtSelFlag::kNone;
}
enum class EvtSel {
None,
INEL,
INELZvtx,
Coll,
CollZvtx,
TVX,
TVXZvtx,
SelMC,
SelMCZvtx,
Sel8,
Sel8Zvtx,
INELgt0,
INELgt0rec
};
}; // namespace BjetTaggingGnnEvtSel
using namespace BjetTaggingGnnEvtSel;

struct BjetTaggingGnn {
Expand Down Expand Up @@ -408,14 +416,14 @@
bool isAcceptedJet(AnalysisJet const& jet)
{

if (jetAreaFractionMin > -98.0) {

Check failure on line 419 in PWGJE/Tasks/bjetTaggingGnn.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (jet.area() < jetAreaFractionMin * M_PI * (jet.r() / 100.0) * (jet.r() / 100.0)) {
return false;
}
}
bool checkConstituentPt = true;
bool checkConstituentMinPt = (leadingConstituentPtMin > -98.0);

Check failure on line 425 in PWGJE/Tasks/bjetTaggingGnn.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
bool checkConstituentMaxPt = (leadingConstituentPtMax < 9998.0);

Check failure on line 426 in PWGJE/Tasks/bjetTaggingGnn.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (!checkConstituentMinPt && !checkConstituentMaxPt) {
checkConstituentPt = false;
}
Expand Down Expand Up @@ -549,7 +557,7 @@
continue;
auto p = pdg->GetParticle(mcparticle.pdgCode());
if (p != nullptr) {
if (std::abs(p->Charge()) >= 3) {

Check failure on line 560 in PWGJE/Tasks/bjetTaggingGnn.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (std::abs(mcparticle.eta()) < 1)
return true;
}
Expand Down Expand Up @@ -860,7 +868,7 @@
if (isMatched) {
registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_selmc"), analysisJet.pt(), mcpjetpT, hasAll(evtselCode, EvtSelFlag::SelMCZvtx) ? weightEvt : 0.0);
registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_sel8"), analysisJet.pt(), mcpjetpT, hasAll(evtselCode, EvtSelFlag::Sel8Zvtx) ? weightEvt : 0.0);
registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_inelgt0"), analysisJet.pt(), mcpjetpT, isTrueINELgt0 &&(hasAll(evtselCode, EvtSelFlag::INELgt0rec)) ? weightEvt : 0.0);
registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_inelgt0"), analysisJet.pt(), mcpjetpT, isTrueINELgt0 && (hasAll(evtselCode, EvtSelFlag::INELgt0rec)) ? weightEvt : 0.0);
}
if (jetFlavor == JetTaggingSpecies::beauty) {
registry.fill(HIST("h_jetpT_b_coll"), analysisJet.pt(), hasAll(evtselCode, EvtSelFlag::Coll) ? weightEvt : 0.0);
Expand Down
Loading