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
12 changes: 8 additions & 4 deletions PWGJE/Core/JetTaggingUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@

int motherStatusCode = std::abs(mother.getGenStatusCode());

if (motherStatusCode == 23 || motherStatusCode == 33 || motherStatusCode == 43 || motherStatusCode == 63) {

Check failure on line 166 in PWGJE/Core/JetTaggingUtilities.h

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.
return mother.globalIndex();
}
}
Expand Down Expand Up @@ -191,7 +191,7 @@

int motherStatusCode = std::abs(mother.getGenStatusCode());

if (motherStatusCode == 23 || motherStatusCode == 33 || motherStatusCode == 43 || motherStatusCode == 63 || (motherStatusCode == 51 && mother.template mothers_first_as<T>().pdgCode() == 21)) {

Check failure on line 194 in PWGJE/Core/JetTaggingUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return mother.globalIndex();
}
}
Expand Down Expand Up @@ -394,13 +394,13 @@
bool charmQuark = false;
for (auto const& mcpart : mcparticles) {
int pdgcode = mcpart.pdgCode();
if (std::abs(pdgcode) == 21 || (std::abs(pdgcode) >= 1 && std::abs(pdgcode) <= 5)) {

Check failure on line 397 in PWGJE/Core/JetTaggingUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
double dR = jetutilities::deltaR(jet, mcpart);

if (dR < jet.r() / 100.f) {
if (std::abs(pdgcode) == 5) {

Check failure on line 401 in PWGJE/Core/JetTaggingUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return JetTaggingSpecies::beauty; // Beauty jet
} else if (std::abs(pdgcode) == 4) {

Check failure on line 403 in PWGJE/Core/JetTaggingUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
charmQuark = true;
}
}
Expand Down Expand Up @@ -429,15 +429,15 @@

for (auto const& mcpart : mcparticles) {
int pdgcode = mcpart.pdgCode();
if (std::abs(pdgcode) == 21 || (std::abs(pdgcode) >= 1 && std::abs(pdgcode) <= 5)) {

Check failure on line 432 in PWGJE/Core/JetTaggingUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
double dR = jetutilities::deltaR(jet, mcpart);

if (dR < jet.r() / 100.f) {
if (std::abs(pdgcode) == 5) {

Check failure on line 436 in PWGJE/Core/JetTaggingUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
return JetTaggingSpecies::beauty; // Beauty jet
} else if (std::abs(pdgcode) == 4) {

Check failure on line 438 in PWGJE/Core/JetTaggingUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
charmQuark = true;
} else if (std::abs(pdgcode) == 3) {

Check failure on line 440 in PWGJE/Core/JetTaggingUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
strangeQuark = true;
}
}
Expand Down Expand Up @@ -962,7 +962,7 @@

trkLabels["trkVtxIndex"] = std::vector<int>(nTrks, -1);
if (count.size() != 0) { // If there is any SV cluster not only PV cluster
for (auto& [idx, avgDistance] : avgDistances) // o2-linter: disable=const-ref-in-for-loop

Check failure on line 965 in PWGJE/Core/JetTaggingUtilities.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.
avgDistance /= count[idx];

nVertices += avgDistances.size();
Expand Down Expand Up @@ -990,12 +990,16 @@
int trkIdx = 0;
for (auto const& constituent : jet.template tracks_as<AnyTracks>()) {
if (!constituent.has_mcParticle() || !constituent.template mcParticle_as<AnyParticles>().isPhysicalPrimary() || constituent.pt() < trackPtMin) {
trkLabels["trkOrigin"].push_back(0);
trkLabels["trkOrigin"].push_back(0); // fake track, non-physical primary track
} else {
const auto& particle = constituent.template mcParticle_as<AnyParticles>();
int orig = RecoDecay::getParticleOrigin(particles, particle, searchUpToQuark);
trkLabels["trkOrigin"].push_back((orig > 0) ? orig : (trkLabels["trkVtxIndex"][trkIdx] == 0) ? 3
: 4);
if (particle.mcCollisionId() != collision.globalIndex()) {
trkLabels["trkOrigin"].push_back(0); // mismatched coll track
} else {
int orig = RecoDecay::getParticleOrigin(particles, particle, searchUpToQuark);
trkLabels["trkOrigin"].push_back((orig != RecoDecay::OriginType::None) ? static_cast<int>(orig) : (trkLabels["trkVtxIndex"][trkIdx] == 0) ? 3
: 4); // 1: charm, 2: beauty, 3: primary, 4: other secondary
}
Comment thread
vkucera marked this conversation as resolved.
}

trkIdx++;
Expand Down
2 changes: 1 addition & 1 deletion PWGJE/TableProducer/derivedDataProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ struct JetDerivedDataProducerTask {
auto collisionTrackIndices = assocCollisions.sliceBy(preslices.perCollisionTrackIndices, collision.globalIndex());
for (auto const& collisionTrackIndex : collisionTrackIndices) {
auto track = collisionTrackIndex.track_as<soa::Join<aod::Tracks, aod::McTrackLabels>>();
if (track.collisionId() == collision.globalIndex() && track.has_mcParticle()) {
if (track.has_mcParticle()) {
products.jMcTracksLabelTable(track.mcParticleId());
} else {
products.jMcTracksLabelTable(-1);
Expand Down
Loading