Skip to content
Open
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: 11 additions & 1 deletion PWGHF/HFC/DataModel/ReducedDMesonPairsTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ DECLARE_SOA_TABLE(HfCandDpMls, "AOD", "HFCANDDPML",
full::MlScore0,
full::MlScore1)

DECLARE_SOA_TABLE(HfCandDpTinys, "AOD", "HFCANDDPTINY",
full::CandidateSelFlag,
full::M,
full::Pt,
full::Eta,
full::Phi,
full::HfCandDpFullEvId,
hf_cand_3prong::FlagMcMatchRec,
hf_cand_3prong::OriginMcRec,
hf_cand_3prong::FlagMcDecayChanRec)

DECLARE_SOA_TABLE(HfCandDpLites, "AOD", "HFCANDDPLITE",
hf_cand::Chi2PCA,
full::DecayLength,
Expand Down Expand Up @@ -139,7 +150,6 @@ DECLARE_SOA_TABLE(HfCandDpLites, "AOD", "HFCANDDPLITE",
full::Phi,
full::Y,
full::Centrality,
collision::NumContrib,
full::HfCandDpFullEvId,
hf_cand_3prong::FlagMcMatchRec,
hf_cand_3prong::OriginMcRec,
Expand Down
51 changes: 31 additions & 20 deletions PWGHF/HFC/TableProducer/correlatorDplusDplusReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ using namespace o2::hf_centrality;
struct HfCorrelatorDplusDplusReduced {
Produces<o2::aod::HfCandDpFulls> rowCandidateFull;
Produces<o2::aod::HfCandDpLites> rowCandidateLite;
Produces<o2::aod::HfCandDpTinys> rowCandidateTiny;
Produces<o2::aod::HfCandDpFullEvs> rowCandidateFullEvents;
Produces<o2::aod::HfCandDpMls> rowCandidateMl;

Expand All @@ -60,6 +61,7 @@ struct HfCorrelatorDplusDplusReduced {

Configurable<int> selectionFlagDplus{"selectionFlagDplus", 1, "Selection Flag for Dplus"};
Configurable<bool> fillCandidateLiteTable{"fillCandidateLiteTable", false, "Switch to fill lite table with candidate properties"};
Configurable<bool> fillCandidateTinyTable{"fillCandidateTinyTable", false, "Switch to fill tiny table with candidate properties"};
// parameters for production of training samples
Configurable<bool> fillCorrBkgs{"fillCorrBkgs", false, "Flag to fill derived tables with correlated background candidates"};
Configurable<std::vector<int>> classMlIndexes{"classMlIndexes", {0, 2}, "Indexes of ML bkg and non-prompt scores."};
Expand Down Expand Up @@ -113,11 +115,12 @@ struct HfCorrelatorDplusDplusReduced {
}

template <typename Coll, bool doMc = false, bool doMl = false, typename T>
void fillCandidateTable(const T& candidate, int localEvIdx = -1)
void fillCandidateTable(const T& candidate, int localEvIdx = -1, int sign = 1)
{
int8_t flagMc = 0;
int8_t originMc = 0;
int8_t channelMc = 0;

if constexpr (doMc) {
flagMc = candidate.flagMcMatchRec();
originMc = candidate.originMcRec();
Expand All @@ -140,7 +143,18 @@ struct HfCorrelatorDplusDplusReduced {
cent = getCentralityColl(coll, centEstimator);
}

if (fillCandidateLiteTable) {
if (fillCandidateTinyTable) {
rowCandidateTiny(
candidate.isSelDplusToPiKPi(),
hfHelper.invMassDplusToPiKPi(candidate),
sign * candidate.pt(),
candidate.eta(),
candidate.phi(),
localEvIdx,
flagMc,
originMc,
channelMc);
} else if (fillCandidateLiteTable) {
rowCandidateLite(
candidate.chi2PCA(),
candidate.decayLength(),
Expand Down Expand Up @@ -176,15 +190,14 @@ struct HfCorrelatorDplusDplusReduced {
candidate.tpcTofNSigmaKa2(),
candidate.isSelDplusToPiKPi(),
hfHelper.invMassDplusToPiKPi(candidate),
candidate.pt(),
sign * candidate.pt(),
candidate.cpa(),
candidate.cpaXY(),
candidate.maxNormalisedDeltaIP(),
candidate.eta(),
candidate.phi(),
hfHelper.yDplus(candidate),
cent,
coll.numContrib(),
localEvIdx,
flagMc,
originMc,
Expand Down Expand Up @@ -252,7 +265,7 @@ struct HfCorrelatorDplusDplusReduced {
candidate.tpcTofNSigmaKa2(),
candidate.isSelDplusToPiKPi(),
hfHelper.invMassDplusToPiKPi(candidate),
candidate.pt(),
sign * candidate.pt(),
candidate.p(),
candidate.cpa(),
candidate.cpaXY(),
Expand All @@ -270,7 +283,7 @@ struct HfCorrelatorDplusDplusReduced {
}
}

void processData(aod::Collisions const& collisions, SelectedCandidates const& candidates)
void processData(aod::Collisions const& collisions, SelectedCandidates const& candidates, aod::Tracks const&)
{
static int lastRunNumber = -1;
// reserve memory
Expand All @@ -297,14 +310,14 @@ struct HfCorrelatorDplusDplusReduced {

const auto colId = collision.globalIndex();
auto candidatesInThisCollision = candidates.sliceBy(tracksPerCollision, colId);
if (skipSingleD) {
if (candidatesInThisCollision.size() < 2) { // o2-linter: disable=magic-number (number of candidate must be larger than 1)
if (skipSingleD)
if (candidatesInThisCollision.size() < 2) // o2-linter: disable=magic-number (number of candidate must be larger than 1)
continue;
}
}
fillEvent(collision);
for (const auto& candidate : candidatesInThisCollision) {
fillCandidateTable<aod::Collisions>(candidate, rowCandidateFullEvents.lastIndex());
auto prong_candidate = candidate.prong1_as<aod::Tracks>();
auto candidate_sign = prong_candidate.sign();
fillCandidateTable<aod::Collisions>(candidate, rowCandidateFullEvents.lastIndex(), candidate_sign);
}
}
}
Expand All @@ -324,14 +337,14 @@ struct HfCorrelatorDplusDplusReduced {
for (const auto& collision : collisions) { // No skimming for MC data. No Zorro !
const auto colId = collision.globalIndex();
auto candidatesInThisCollision = candidates.sliceBy(tracksPerCollision, colId);
if (skipSingleD) {
if (candidatesInThisCollision.size() < 2) { // o2-linter: disable=magic-number (number of candidate must be larger than 1)
if (skipSingleD)
if (candidatesInThisCollision.size() < 2) // o2-linter: disable=magic-number (number of candidate must be larger than 1)
continue;
}
}
fillEvent(collision);
for (const auto& candidate : candidatesInThisCollision) {
fillCandidateTable<aod::Collisions, true>(candidate, rowCandidateFullEvents.lastIndex());
auto prong_candidate = candidate.prong1_as<aod::Tracks>();
auto candidate_sign = prong_candidate.sign();
fillCandidateTable<aod::Collisions, true>(candidate, rowCandidateFullEvents.lastIndex(), candidate_sign);
}
}
}
Expand All @@ -346,11 +359,9 @@ struct HfCorrelatorDplusDplusReduced {
for (const auto& mccollision : mccollisions) { // No skimming for MC data. No Zorro !
const auto colId = mccollision.globalIndex();
const auto particlesInThisCollision = mcparticles.sliceBy(mcParticlesPerMcCollision, colId);
if (skipSingleD) {
if (particlesInThisCollision.size() < 2) { // o2-linter: disable=magic-number (number of candidate must be larger than 1)
if (skipSingleD)
if (particlesInThisCollision.size() < 2) // o2-linter: disable=magic-number (number of candidate must be larger than 1)
continue;
}
}
rowCandidateMcCollisions(
mccollision.posX(),
mccollision.posY(),
Expand Down
27 changes: 22 additions & 5 deletions PWGHF/HFC/Tasks/taskCorrelationDplusDplusReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ using namespace o2::framework::expressions;
struct HfTaskCorrelationDplusDplusReduced {
Configurable<int> selectionFlagDplus{"selectionFlagDplus", 1, "Selection Flag for Dplus"};

using SelectedCandidates = soa::Filtered<o2::aod::HfCandDpFulls>;
using SelectedCandidates = soa::Filtered<o2::aod::HfCandDpTinys>;
using SelectedMcParticles = o2::aod::HfCandDpMcPs;

Filter filterSelectCandidates = aod::full::candidateSelFlag >= selectionFlagDplus;
Expand All @@ -56,7 +56,9 @@ struct HfTaskCorrelationDplusDplusReduced {
{
registry.add("hMassDplus", "D+ candidates;inv. mass (#pi#pi K) (GeV/#it{c}^{2}))", {HistType::kTH1F, {{120, 1.5848, 2.1848}}});
registry.add("hMassDplusMatched", "D+ matched candidates;inv. mass (#pi#pi K) (GeV/#it{c}^{2}))", {HistType::kTH1F, {{120, 1.5848, 2.1848}}});
registry.add("hMassDMesonPair", "D Meson pair candidates;inv. mass (#pi K) (GeV/#it{c}^{2});inv. mass (#pi K) (GeV/#it{c}^{2})", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {120, 1.5848, 2.1848}}});
registry.add("hMassDplusminusPair", "D plus-minus pair candidates;inv. mass (#pi K) (GeV/#it{c}^{2});inv. mass (#pi K) (GeV/#it{c}^{2})", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {120, 1.5848, 2.1848}}});
registry.add("hMassDplusPair", "D plus pair candidates;inv. mass (#pi K) (GeV/#it{c}^{2});inv. mass (#pi K) (GeV/#it{c}^{2})", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {120, 1.5848, 2.1848}}});
registry.add("hMassDminusPair", "D minus pair candidates;inv. mass (#pi K) (GeV/#it{c}^{2});inv. mass (#pi K) (GeV/#it{c}^{2})", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {120, 1.5848, 2.1848}}});
registry.add("hDltPhiMcGen", "Azimuthal correlation for D mesons; #Delta#phi", {HistType::kTH1F, {{100, -3.141593, 3.141593}}});
}

Expand All @@ -67,9 +69,25 @@ struct HfTaskCorrelationDplusDplusReduced {

for (const auto& cand1 : localCandidates) {
auto mass1 = cand1.m();
auto sign1 = 1;
if (cand1.pt() < 0) {
sign1 = -1;
}
for (auto cand2 = cand1 + 1; cand2 != localCandidates.end(); ++cand2) {
auto mass2 = cand2.m();
registry.fill(HIST("hMassDMesonPair"), mass2, mass1);
auto sign2 = 1;
if (cand2.pt() < 0) {
sign2 = -1;
}
if (sign1 == sign2) {
if (sign1 == 1) {
registry.fill(HIST("hMassDplusPair"), mass2, mass1);
} else {
registry.fill(HIST("hMassDminusPair"), mass2, mass1);
}
} else {
registry.fill(HIST("hMassDplusminusPair"), mass2, mass1);
}
}
}
}
Expand All @@ -83,9 +101,8 @@ struct HfTaskCorrelationDplusDplusReduced {
for (const auto& cand1 : localCandidates) {
auto mass1 = cand1.m();
registry.fill(HIST("hMassDplus"), mass1);
if (std::abs(cand1.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) {
if (std::abs(cand1.flagMcMatchRec()) == hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi)
registry.fill(HIST("hMassDplusMatched"), mass1);
}
}
}
PROCESS_SWITCH(HfTaskCorrelationDplusDplusReduced, processLocalDataMcRec, "Process local MC data", false);
Expand Down
Loading