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
11 changes: 11 additions & 0 deletions PWGHF/HFC/DataModel/CorrelationTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,12 @@ DECLARE_SOA_TABLE(DstarHadronPair, "AOD", "DSTRHPAIR", // D* Hadrons pairs Infor
hf_correlation_dstar_hadron::DeltaEta<hf_correlation_dstar_hadron::EtaDstar, hf_correlation_dstar_hadron::EtaTrack>,
hf_correlation_dstar_hadron::DeltaM<hf_correlation_dstar_hadron::MDstar, hf_correlation_dstar_hadron::MD0>);

// must be filled row wise along with DstarHadronPair
DECLARE_SOA_TABLE(DstarHadronPairMcRec, "AOD", "DSTRHPAIRMCREC",
hf_cand_mc_flag::OriginMcRec,
hf_cand_mc_flag::PdgBhadMotherPart,
hf_cand_mc_flag::PtBhadMotherPart);

DECLARE_SOA_TABLE(Dstar, "AOD", "DSTAR", // Only Dstar properties
hf_correlation_dstar_hadron::CollisionIdx,
// D* only properties
Expand All @@ -575,6 +581,11 @@ DECLARE_SOA_TABLE(Dstar, "AOD", "DSTAR", // Only Dstar properties
hf_correlation_dstar_hadron::TimeStamp,
hf_correlation_dstar_hadron::PoolBin);

DECLARE_SOA_TABLE(DstarMcRec, "AOD", "DSTARMCREC",
hf_cand_mc_flag::OriginMcRec,
hf_cand_mc_flag::PdgBhadMotherPart,
hf_cand_mc_flag::PtBhadMotherPart);

// Note: Table for selection of Lc in a collision
namespace hf_selection_lc_collision
{
Expand Down
122 changes: 101 additions & 21 deletions PWGHF/HFC/TableProducer/correlatorDstarHadrons.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@

/// \brief Correlator for D* and hadrons. This task is used to produce table for D* and hadron pairs.

#include "PWGHF/Core/DecayChannels.h"
#include "PWGHF/DataModel/AliasTables.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/HFC/DataModel/CorrelationTables.h"
#include "PWGHF/Utils/utilsAnalysis.h"

#include "Common/Core/RecoDecay.h"
#include "Common/DataModel/Multiplicity.h"
#include "Common/DataModel/TrackSelectionTables.h"

Expand Down Expand Up @@ -52,20 +54,20 @@ using namespace o2::framework::expressions;

const int nBinsPtCorrelation = 8;

const double binsPtCorrelationsDefault[nBinsPtCorrelation + 1] = {0., 2., 4., 6., 8., 12., 16., 24., 100.};
const auto vecBinsPtCorrelationsDefault = std::vector<double>{binsPtCorrelationsDefault, binsPtCorrelationsDefault + nBinsPtCorrelation + 1};
const std::array<double, nBinsPtCorrelation + 1> binsPtCorrelationsDefault = {0., 2., 4., 6., 8., 12., 16., 24., 100.};
const auto vecBinsPtCorrelationsDefault = std::vector<double>{binsPtCorrelationsDefault.begin(), binsPtCorrelationsDefault.end()};

const double signalRegionLefBoundDefault[nBinsPtCorrelation] = {0.144, 0.144, 0.144, 0.144, 0.144, 0.144, 0.144, 0.144};
const auto vecSignalRegionLefBoundDefault = std::vector<double>{signalRegionLefBoundDefault, signalRegionLefBoundDefault + nBinsPtCorrelation};
const std::array<double, nBinsPtCorrelation> signalRegionLefBoundDefault = {0.144, 0.144, 0.144, 0.144, 0.144, 0.144, 0.144, 0.144};
const auto vecSignalRegionLefBoundDefault = std::vector<double>{signalRegionLefBoundDefault.begin(), signalRegionLefBoundDefault.end()};

const double signalRegionRightBoundDefault[nBinsPtCorrelation] = {0.146, 0.146, 0.146, 0.146, 0.146, 0.146, 0.146, 0.146};
const auto vecSignalRegionRightBoundDefault = std::vector<double>{signalRegionRightBoundDefault, signalRegionRightBoundDefault + nBinsPtCorrelation};
const std::array<double, nBinsPtCorrelation> signalRegionRightBoundDefault = {0.146, 0.146, 0.146, 0.146, 0.146, 0.146, 0.146, 0.146};
const auto vecSignalRegionRightBoundDefault = std::vector<double>{signalRegionRightBoundDefault.begin(), signalRegionRightBoundDefault.end()};

const double sidebandRightInnerDefault[nBinsPtCorrelation] = {0.147, 0.147, 0.147, 0.147, 0.147, 0.147, 0.147, 0.147};
const auto vecSidebandRightInnerDefault = std::vector<double>{sidebandRightInnerDefault, sidebandRightInnerDefault + nBinsPtCorrelation};
const std::array<double, nBinsPtCorrelation> sidebandRightInnerDefault = {0.147, 0.147, 0.147, 0.147, 0.147, 0.147, 0.147, 0.147};
const auto vecSidebandRightInnerDefault = std::vector<double>{sidebandRightInnerDefault.begin(), sidebandRightInnerDefault.end()};

const double sidebandRightOuterDefault[nBinsPtCorrelation] = {0.154, 0.154, 0.154, 0.154, 0.154, 0.154, 0.154, 0.154};
const auto vecSidebandRightOuterDefault = std::vector<double>{sidebandRightOuterDefault, sidebandRightOuterDefault + nBinsPtCorrelation};
const std::array<double, nBinsPtCorrelation> sidebandRightOuterDefault = {0.154, 0.154, 0.154, 0.154, 0.154, 0.154, 0.154, 0.154};
const auto vecSidebandRightOuterDefault = std::vector<double>{sidebandRightOuterDefault.begin(), sidebandRightOuterDefault.end()};

// flaging a collision if D* meson is found.
struct HfCorrelatorDstarHadronsCollisionSelector {
Expand Down Expand Up @@ -116,7 +118,9 @@ struct HfCorrelatorDstarHadronsCollisionSelector {

struct HfCorrelatorDstarHadrons {
Produces<aod::DstarHadronPair> rowsDstarHadronPair;
Produces<aod::DstarHadronPairMcRec> rowsDstarHadronPairMcRec;
Produces<aod::Dstar> rowsDstar;
Produces<aod::DstarMcRec> rowsDstarMcRec;
Produces<aod::Hadron> rowsAssoTrack;

// Enable separate tables for Dstar and Track for offline Event mixing
Expand Down Expand Up @@ -161,6 +165,9 @@ struct HfCorrelatorDstarHadrons {
using DstarCandidates = soa::Join<aod::HfCandDstars, aod::HfSelDstarToD0Pi>; // Added extra cloumns in HfCandDstar (Prong0Id, Prong1Id), so no need to add table HfCandD0Fromdstar
using FilteredCandidates = soa::Filtered<DstarCandidates>;

using DstarCandidatesMcRec = soa::Join<aod::HfCandDstars, aod::HfSelDstarToD0Pi, aod::HfCandDstarMcRec>;
using FilteredCandidatesMcRec = soa::Filtered<DstarCandidatesMcRec>;

using FilteredTracks = soa::Filtered<aod::TracksWDca>;

// collision table filter
Expand Down Expand Up @@ -192,7 +199,12 @@ struct HfCorrelatorDstarHadrons {

void init(InitContext&)
{
std::array<bool, 2> processes = {doprocessDataSameEvent, doprocessDataWithMixedEvent};

if (doprocessDataSameEvent && doprocessMCRecSameEvent) {
LOGP(fatal, "Both data same event and MC Rec same event processing cannot be enabled simultaneously.");
}

std::array<bool, 3> processes = {doprocessDataSameEvent, doprocessDataWithMixedEvent, doprocessMCRecSameEvent};
if (std::accumulate(processes.begin(), processes.end(), 0) != 1) {
LOGP(fatal, "One and only one process function must be enabled at a time.");
}
Expand Down Expand Up @@ -224,15 +236,24 @@ struct HfCorrelatorDstarHadrons {
registry.add("QA/hDPhiDEtaDstarAssoTrack", "Delta Phi vs Delta Eta distribution between Dstar and Associated Track", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}});
}

void processDataSameEvent(FilteredCollisions const& collisions, // only collisions who have altleast one D*
FilteredTracks const& tracks,
FilteredCandidates const& candidates,
aod::BCsWithTimestamps const&)
/// @brief Run the correlator for same event analysis
/// @tparam isMC Boolean indicating if the analysis is for MC reconstructed data
/// @tparam collisionsType Type of the collisions Table
/// @tparam tracksType Type of the tracks Table
/// @tparam candidatesType Type of the candidates Table
/// @param collisions The collisions Table
/// @param tracks The tracks Table
/// @param candidates The candidates Table
/// @return None
template <bool isMC, typename collisionsType, typename tracksType, typename candidatesType>
void runCorrelatorSameEvent(const collisionsType& collisions,
const tracksType& tracks,
const candidatesType& candidates
/*, aod::BCsWithTimestamps const&*/)
{
for (const auto& collision : collisions) {
registry.fill(HIST("hTriggerColCandPairCounts"), 0); // counting trigger collision

auto bc = collision.bc_as<aod::BCsWithTimestamps>();
auto bc = collision.template bc_as<aod::BCsWithTimestamps>();
auto timestamp = bc.timestamp();
binNumber = binningScheme.getBin(std::make_tuple(collision.posZ(), collision.multFT0M()));
auto candidatesPerCol = candidates.sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache);
Expand All @@ -252,6 +273,23 @@ struct HfCorrelatorDstarHadrons {
int nCandsSideBand = 0;
// Single particle distribution for canfdidates
for (const auto& cand : candidatesPerCol) {
if constexpr (isMC) {
// Handle MC-specific logic here
auto yCand = cand.y(constants::physics::MassDStar);
if (std::abs(yCand) > yAbsDstarMax) {
continue;
}
if (std::abs(cand.flagMcMatchRec()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) { // if MC matching is successful at Reconstruction Level
// auto ptMother = cand.ptBhadMotherPart();
int const pdgBhadMother = cand.pdgBhadMotherPart();
// For unknown reasons there are charm hadrons coming directly from beauty diquarks without an intermediate B-hadron which have an unreasonable correlation between the pT of the charm hadron and the beauty mother. We also remove charm hadrons from quarkonia.
if (cand.originMcRec() == RecoDecay::OriginType::NonPrompt && (pdgBhadMother == 5101 || pdgBhadMother == 5103 || pdgBhadMother == 5201 || pdgBhadMother == 5203 || pdgBhadMother == 5301 || pdgBhadMother == 5303 || pdgBhadMother == 5401 || pdgBhadMother == 5403 || pdgBhadMother == 5503 || pdgBhadMother == 553 || pdgBhadMother == 555 || pdgBhadMother == 557)) { // o2-linter: disable=pdg/explicit-code, magic-number (constants not in the PDG header)
continue;
}
} else {
continue; // Skip candidates that are not successfully MC matched at Reconstruction Level
}
}
auto gItriggerParticle = cand.globalIndex();
if (cand.signSoftPi() > 0) {
invMassDstarParticle = cand.invMassDstar();
Expand All @@ -274,6 +312,7 @@ struct HfCorrelatorDstarHadrons {
registry.fill(HIST("QA/hEtaDstarSideBand"), cand.eta());
nCandsSideBand++;
}
// Fill correlation histograms for signal and sideband candidates versus number of associated tracks
registry.fill(HIST("QA/hCandsSignalVsTracksPerCol"), nCandsSignal, tracksPerCol.size());
registry.fill(HIST("QA/hCandsSideBandVsTracksPerCol"), nCandsSideBand, tracksPerCol.size());

Expand All @@ -288,7 +327,13 @@ struct HfCorrelatorDstarHadrons {
timestamp,
binNumber);
}
} // Dstar loop
if constexpr (isMC) {
rowsDstarMcRec(cand.originMcRec(),
cand.pdgBhadMotherPart(),
cand.ptBhadMotherPart());
}
} // canidate loop

// Single particle distribution for tracks
for (const auto& track : tracksPerCol) {
registry.fill(HIST("QA/hPhiAssoTrack"), track.phi());
Expand Down Expand Up @@ -335,6 +380,22 @@ struct HfCorrelatorDstarHadrons {
invMassD0Particle = triggerParticle.invMassD0Bar();
}

if constexpr (isMC) {
// if MC matching is successful at Reconstruction Level
if (std::abs(triggerParticle.flagMcMatchRec()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) {
int const pdgBhadMother = triggerParticle.pdgBhadMotherPart();
if (triggerParticle.originMcRec() == RecoDecay::OriginType::NonPrompt && (pdgBhadMother == 5101 || pdgBhadMother == 5103 || pdgBhadMother == 5201 || pdgBhadMother == 5203 || pdgBhadMother == 5301 || pdgBhadMother == 5303 || pdgBhadMother == 5401 || pdgBhadMother == 5403 || pdgBhadMother == 5503 || pdgBhadMother == 553 || pdgBhadMother == 555 || pdgBhadMother == 557)) { // o2-linter: disable=pdg/explicit-code, magic-number (constants not in the PDG header)
continue;
}
} else {
continue; // Skip pair that are not successfully MC matched at Reconstruction Level
}

rowsDstarHadronPairMcRec(triggerParticle.originMcRec(),
triggerParticle.pdgBhadMotherPart(),
triggerParticle.ptBhadMotherPart());
}

// Fill Tables
rowsDstarHadronPair(collision.globalIndex(),
gItriggerParticle,
Expand All @@ -349,9 +410,18 @@ struct HfCorrelatorDstarHadrons {
assocParticle.pt(),
timestamp,
binNumber);

} // D-H pair loop
} // collision loop

} // runCorrelatorSameEvent template function

void processDataSameEvent(FilteredCollisions const& collisions, // only collisions who have altleast one D*
FilteredTracks const& tracks,
FilteredCandidates const& candidates,
aod::BCsWithTimestamps const&)
{
runCorrelatorSameEvent<false>(collisions, tracks, candidates);
} // processDataSameEvent
PROCESS_SWITCH(HfCorrelatorDstarHadrons, processDataSameEvent, "process only same event data", true);

Expand Down Expand Up @@ -406,10 +476,20 @@ struct HfCorrelatorDstarHadrons {

} // processDataWithMixedEvent
PROCESS_SWITCH(HfCorrelatorDstarHadrons, processDataWithMixedEvent, "process only mixed events data", false);

void processMCRecSameEvent(FilteredCollisions const& collisions,
FilteredTracks const& tracks,
FilteredCandidatesMcRec const& candidates,
aod::BCsWithTimestamps const&)
{
// Implementation for processing MC reconstructed same event data goes here
runCorrelatorSameEvent<true>(collisions, tracks, candidates);
}
PROCESS_SWITCH(HfCorrelatorDstarHadrons, processMCRecSameEvent, "process only MC reconstructed same event data", false);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
WorkflowSpec defineDataProcessing(ConfigContext const& context)
{
return WorkflowSpec{adaptAnalysisTask<HfCorrelatorDstarHadronsCollisionSelector>(cfgc),
adaptAnalysisTask<HfCorrelatorDstarHadrons>(cfgc)};
return WorkflowSpec{adaptAnalysisTask<HfCorrelatorDstarHadronsCollisionSelector>(context),
adaptAnalysisTask<HfCorrelatorDstarHadrons>(context)};
}
Loading
Loading