Skip to content
Closed
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
35 changes: 25 additions & 10 deletions PWGEM/Dilepton/Tasks/taggingHFE.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#include <array>
#include <cmath>
#include <cstdint>
#include <iostream>

Check failure on line 59 in PWGEM/Dilepton/Tasks/taggingHFE.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[include-iostream]

Do not include iostream. Use O2 logging instead.
#include <random>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -830,8 +830,6 @@
template <bool isMC, typename TBCs, typename TCollisions, typename TTracks, typename TTrackAssoc, typename TV0s, typename TCascades, typename TMCCollisions, typename TMCParticles>
void runPairing(TBCs const&, TCollisions const& collisions, TTracks const& tracks, TTrackAssoc const& trackIndices, TV0s const& v0s, TCascades const& cascades, TMCCollisions const&, TMCParticles const& mcParticles)
{
used_electronIds.reserve(tracks.size());

for (const auto& collision : collisions) {
auto bc = collision.template foundBC_as<TBCs>();
initCCDB(bc);
Expand Down Expand Up @@ -906,11 +904,32 @@
}
}

} // end of track loop for electron selection

for (const auto& trackId : trackIdsThisCollision) {
auto track = trackId.template track_as<TTracks>();
if (!track.hasITS() || !track.hasTPC()) {
continue;
}

if (!track.has_mcParticle()) {
continue;
}
auto mcParticle = track.template mcParticle_as<aod::McParticles>();
if (!mcParticle.has_mothers()) {
continue;
}

auto trackParCov = getTrackParCov(track);
mDcaInfoCov.set(999, 999, 999, 999, 999);
trackParCov.setPID(track.pidForTracking());
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov);
dcaXY = mDcaInfoCov.getY();
dcaZ = mDcaInfoCov.getZ();
float dcaXY = mDcaInfoCov.getY();
float dcaZ = mDcaInfoCov.getZ();

if (std::find(electronIds.begin(), electronIds.end(), track.globalIndex()) != electronIds.end() || std::find(positronIds.begin(), positronIds.end(), track.globalIndex()) != positronIds.end()) {
continue;
}

if (isSelectedHadron(track, trackParCov, dcaXY, dcaZ)) { // electrons can be included in hadron sample.
fRegistry.fill(HIST("Hadron/hs"), trackParCov.getPt(), trackParCov.getEta(), RecoDecay::constrainAngle(trackParCov.getPhi(), 0, 1U));
Expand All @@ -923,7 +942,7 @@
}
}

} // end of track loop for electron selection
} // end of track loop for hadron selection

auto v0s_per_coll = v0s.sliceBy(perCol_v0, collision.globalIndex());
k0Ids.reserve(v0s_per_coll.size());
Expand Down Expand Up @@ -1061,9 +1080,9 @@
bool foundCommonMother = FindCommonMotherFrom2ProngsWithoutPDG(mcpos, mckaon) > 0;
if (mckaon.has_mothers() && !foundCommonMother) {
auto mcMother_of_kaon = mckaon.template mothers_first_as<aod::McParticles>();
if (mcMother_of_kaon.pdgCode() == -323 || mcMother_of_kaon.pdgCode() == -313 || mcMother_of_kaon.pdgCode() == 333) { // accept short-lived resonances such as phi->KK, K*(892)->Kpi for D+ -> anti-K*0(892) e+ nu_e -> (K- pi+) e+ nu_e and Ds+ -> phi e+ nu_e

Check failure on line 1083 in PWGEM/Dilepton/Tasks/taggingHFE.cxx

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.
int commonMotherId = FindCommonMotherFrom2ProngsWithoutPDG(mcpos, mcMother_of_kaon);
if (commonMotherId > 0 && std::abs(mcParticles.rawIteratorAt(commonMotherId).pdgCode()) != 2212) {

Check failure on line 1085 in PWGEM/Dilepton/Tasks/taggingHFE.cxx

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.
foundCommonMother = true;
// LOGF(info, "eK: e+ and K*(892) or phi is found. mother is %d", mcParticles.rawIteratorAt(commonMotherId).pdgCode());
}
Expand Down Expand Up @@ -1119,20 +1138,20 @@
int pdgCodeV0 = 0;
bool foundCommonMother = false;
if (mcK0SId > 0) { // true K0S
pdgCodeV0 = 310;

Check failure on line 1141 in PWGEM/Dilepton/Tasks/taggingHFE.cxx

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.
auto mcK0S = mcParticles.rawIteratorAt(mcK0SId);
auto mcK0 = mcK0S.template mothers_first_as<aod::McParticles>(); // mother of K0S is K0 in simulation.
// LOGF(info, "mcK0S.pdgCode() = %d, mcK0.pdgCode() = %d", mcK0S.pdgCode(), mcK0.pdgCode());
if (std::abs(mcK0.pdgCode()) == 311) {

Check failure on line 1145 in PWGEM/Dilepton/Tasks/taggingHFE.cxx

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.
mcK0S = mcK0;
}
foundCommonMother = FindCommonMotherFrom2ProngsWithoutPDG(mcpos, mcK0S) > 0;

if (mcK0S.has_mothers() && !foundCommonMother) {
auto mcMother_of_k0s = mcK0S.template mothers_first_as<aod::McParticles>();
if (mcMother_of_k0s.pdgCode() == -323 || mcMother_of_k0s.pdgCode() == -313 || mcMother_of_k0s.pdgCode() == 333) { // accept short-lived resonances such as phi->KK, K*(892)->Kpi for D+ -> anti-K*0(892) e+ nu_e -> (K- pi+) e+ nu_e and Ds+ -> phi e+ nu_e

Check failure on line 1152 in PWGEM/Dilepton/Tasks/taggingHFE.cxx

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.
int commonMotherId = FindCommonMotherFrom2ProngsWithoutPDG(mcpos, mcMother_of_k0s);
if (commonMotherId > 0 && std::abs(mcParticles.rawIteratorAt(commonMotherId).pdgCode()) != 2212) { // proton decay is implemented. reject it.

Check failure on line 1154 in PWGEM/Dilepton/Tasks/taggingHFE.cxx

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.
foundCommonMother = true;
// LOGF(info, "eK0S: e+ and K*(892) or phi is found. mother is %d", mcParticles.rawIteratorAt(commonMotherId).pdgCode());
}
Expand Down Expand Up @@ -1377,9 +1396,9 @@
bool foundCommonMother = FindCommonMotherFrom2ProngsWithoutPDG(mcele, mckaon) > 0;
if (mckaon.has_mothers() && !foundCommonMother) {
auto mcMother_of_kaon = mckaon.template mothers_first_as<aod::McParticles>();
if (mcMother_of_kaon.pdgCode() == 323 || mcMother_of_kaon.pdgCode() == 313 || mcMother_of_kaon.pdgCode() == 333) { // accept short-lived resonances such as phi->KK, K*(892)->Kpi for D+ -> anti-K*0(892) e+ nu_e -> (K- pi+) e+ nu_e and Ds+ -> phi e+ nu_e

Check failure on line 1399 in PWGEM/Dilepton/Tasks/taggingHFE.cxx

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.
int commonMotherId = FindCommonMotherFrom2ProngsWithoutPDG(mcele, mcMother_of_kaon);
if (commonMotherId > 0 && std::abs(mcParticles.rawIteratorAt(commonMotherId).pdgCode()) != 2212) {

Check failure on line 1401 in PWGEM/Dilepton/Tasks/taggingHFE.cxx

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.
foundCommonMother = true;
// LOGF(info, "eK: e- and K*(892) or phi is found. mother is %d", mcParticles.rawIteratorAt(commonMotherId).pdgCode());
}
Expand Down Expand Up @@ -1435,7 +1454,7 @@
int pdgCodeV0 = 0;
bool foundCommonMother = false;
if (mcK0SId > 0) { // true K0S
pdgCodeV0 = 310;

Check failure on line 1457 in PWGEM/Dilepton/Tasks/taggingHFE.cxx

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.
auto mcK0S = mcParticles.rawIteratorAt(mcK0SId);
auto mcK0 = mcK0S.template mothers_first_as<aod::McParticles>(); // mother of K0S is K0 in simulation.
// LOGF(info, "mcK0S.pdgCode() = %d, mcK0.pdgCode() = %d", mcK0S.pdgCode(), mcK0.pdgCode());
Expand Down Expand Up @@ -1675,10 +1694,8 @@
omegaPlusIds.shrink_to_fit();
omegaMinusIds.clear();
omegaMinusIds.shrink_to_fit();
} // end of collision loop

used_electronIds.clear();
used_electronIds.shrink_to_fit();
} // end of collision loop
}

template <typename TMCCollisions, typename TMCParticles>
Expand Down Expand Up @@ -1810,8 +1827,6 @@
std::vector<int> omegaPlusIds;
std::vector<int> omegaMinusIds;

std::vector<std::pair<int, int>> used_electronIds; // pair of hTypeId and electronId

void processMC(FilteredMyCollisionsWithMCLabel const& collisions, aod::BCsWithTimestamps const& bcs, MyTracksWithMCLabel const& tracks, aod::TrackAssoc const& trackIndices, filteredV0s const& v0s, filteredMyCascades const& cascades, aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles)
{
runPairing<true>(bcs, collisions, tracks, trackIndices, v0s, cascades, mcCollisions, mcParticles);
Expand Down
Loading