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
28 changes: 14 additions & 14 deletions PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ using HfcRedCollision = HfcRedCollisions::iterator;

namespace hf_candidate_reduced
{
DECLARE_SOA_INDEX_COLUMN(HfcRedCollision, hfcRedCollision); //! ReducedCollision index
DECLARE_SOA_INDEX_COLUMN(HfcRedFlowColl, hfcRedFlowColl); //! ReducedCollision index
DECLARE_SOA_COLUMN(Prong0Id, prong0Id, int); //! Prong 0 index
DECLARE_SOA_COLUMN(Prong1Id, prong1Id, int); //! Prong 1 index
DECLARE_SOA_COLUMN(Prong2Id, prong2Id, int); //! Prong2 index
DECLARE_SOA_COLUMN(PhiCand, phiCand, float); //! Phi of the candidate
DECLARE_SOA_COLUMN(EtaCand, etaCand, float); //! Eta of the candidate
DECLARE_SOA_COLUMN(PtCand, ptCand, float); //! Pt of the candidate
DECLARE_SOA_COLUMN(InvMassDs, invMassDs, float); //! Invariant mass of Ds candidate
DECLARE_SOA_COLUMN(InvMassCharmHad, invMassCharmHad, float); //! Invariant mass of CharmHad candidate
DECLARE_SOA_COLUMN(BdtScorePrompt, bdtScorePrompt, float); //! BDT output score for prompt hypothesis
DECLARE_SOA_COLUMN(BdtScoreBkg, bdtScoreBkg, float); //! BDT output score for backgronud hypothesis
DECLARE_SOA_COLUMN(BdtScore0, bdtScore0, float); //! First BDT output score
DECLARE_SOA_COLUMN(BdtScore1, bdtScore1, float); //! Second BDT output score
DECLARE_SOA_INDEX_COLUMN(HfcRedCollision, hfcRedCollision); //! ReducedCollision index
DECLARE_SOA_INDEX_COLUMN(HfcRedFlowColl, hfcRedFlowColl); //! ReducedCollision index
DECLARE_SOA_COLUMN(Prong0Id, prong0Id, int); //! Prong 0 index
DECLARE_SOA_COLUMN(Prong1Id, prong1Id, int); //! Prong 1 index
DECLARE_SOA_COLUMN(Prong2Id, prong2Id, int); //! Prong2 index
DECLARE_SOA_COLUMN(PhiCand, phiCand, float); //! Phi of the candidate
DECLARE_SOA_COLUMN(EtaCand, etaCand, float); //! Eta of the candidate
DECLARE_SOA_COLUMN(PtCand, ptCand, float); //! Pt of the candidate
DECLARE_SOA_COLUMN(InvMassDs, invMassDs, float); //! Invariant mass of Ds candidate
DECLARE_SOA_COLUMN(InvMassCharmHad, invMassCharmHad, float); //! Invariant mass of CharmHad candidate
DECLARE_SOA_COLUMN(BdtScorePrompt, bdtScorePrompt, float); //! BDT output score for prompt hypothesis
DECLARE_SOA_COLUMN(BdtScoreBkg, bdtScoreBkg, float); //! BDT output score for backgronud hypothesis
DECLARE_SOA_COLUMN(BdtScore0, bdtScore0, float); //! First BDT output score
DECLARE_SOA_COLUMN(BdtScore1, bdtScore1, float); //! Second BDT output score
} // namespace hf_candidate_reduced
DECLARE_SOA_TABLE(DsCandReduceds, "AOD", "DSCANDREDUCED", //! Table with Ds candidate info
soa::Index<>,
Expand Down
50 changes: 25 additions & 25 deletions PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ using namespace o2;
using namespace o2::hf_centrality;
using namespace o2::hf_evsel;

enum DecayChannel {
enum DecayChannel {
DplusToPiKPi = 0,
DsToKKPi,
DsToPiKK
Expand Down Expand Up @@ -106,7 +106,8 @@ struct HfCorrelatorFlowCharmHadrons {

HistogramRegistry registry{"registry", {}};

void init(InitContext&) {
void init(InitContext&)
{
if (doprocessDplus || doprocessDplusWithMl) {
massCharm = o2::constants::physics::MassDPlus;
} else if (doprocessDs || doprocessDsWithMl) {
Expand Down Expand Up @@ -159,32 +160,32 @@ struct HfCorrelatorFlowCharmHadrons {
if constexpr (channel == DecayChannel::DsToKKPi) {
return hfHelper.invMassDsToKKPi(candidate);
}
if constexpr (channel == DecayChannel::DsToPiKK){
if constexpr (channel == DecayChannel::DsToPiKK) {
return hfHelper.invMassDsToPiKK(candidate);
}
if constexpr (channel == DecayChannel::DplusToPiKPi){
if constexpr (channel == DecayChannel::DplusToPiKPi) {
return hfHelper.invMassDplusToPiKPi(candidate);
}
return -1.;
}

/// Get charm hadron bdt scores
/// \param candidate is the charm hadron candidate
template <DecayChannel channel, typename TCand>
std::vector<float> getCandMlScores(const TCand& candidate)
{
std::vector<float> outputMl{ -999., -999. };
std::vector<float> outputMl{-999., -999.};
if constexpr (channel == DecayChannel::DsToKKPi) {
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
outputMl[iclass] = candidate.mlProbDsToKKPi()[classMl->at(iclass)];
}
}
if constexpr (channel == DecayChannel::DsToPiKK){
if constexpr (channel == DecayChannel::DsToPiKK) {
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
outputMl[iclass] = candidate.mlProbDsToPiKK()[classMl->at(iclass)];
}
}
if constexpr (channel == DecayChannel::DplusToPiKPi){
if constexpr (channel == DecayChannel::DplusToPiKPi) {
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)];
}
Expand All @@ -204,7 +205,7 @@ struct HfCorrelatorFlowCharmHadrons {
}
double massCand = getCandMass<channel>(candidate);
rowCharmCandidates(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id());

if constexpr (applyMl) {
std::vector<float> outputMl = getCandMlScores<channel>(candidate);
rowCharmCandidatesMl(indexRedColl, outputMl[0], outputMl[1]);
Expand Down Expand Up @@ -236,32 +237,32 @@ struct HfCorrelatorFlowCharmHadrons {
auto thisCollId = coll.globalIndex();
auto candsCThisColl = candsDplus.sliceBy(candsDplusPerColl, thisCollId);
if (forceCharmInCollision && candsCThisColl.size() < 1) {
continue;
continue;
}
if (!checkAndFillCollision(coll)) {
continue;
continue;
}
auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId);
fillCharmHadronTables<DecayChannel::DplusToPiKPi, false>(candsCThisColl);
fillTracksTables(trackIdsThisColl);
}
}
PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processDplus, "Process Dplus candidates", true);

// Dplus with ML selections
void processDplusWithMl(CollsWithCentMult const& colls,
CandDplusDataWMl const& candsDplus,
TracksData const& tracks)
{
for (const auto& coll : colls) {
auto thisCollId = coll.globalIndex();
auto candsCThisColl = candsDplus.sliceBy(candsDplusPerColl, thisCollId);
if (forceCharmInCollision && candsCThisColl.size() < 1) {
continue;
}
if (!checkAndFillCollision(coll)) {
continue;
}
{
for (const auto& coll : colls) {
auto thisCollId = coll.globalIndex();
auto candsCThisColl = candsDplus.sliceBy(candsDplusPerColl, thisCollId);
if (forceCharmInCollision && candsCThisColl.size() < 1) {
continue;
}
if (!checkAndFillCollision(coll)) {
continue;
}
auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId);
fillCharmHadronTables<DecayChannel::DplusToPiKPi, true>(candsCThisColl);
fillTracksTables(trackIdsThisColl);
Expand All @@ -279,10 +280,10 @@ struct HfCorrelatorFlowCharmHadrons {
auto candsDsToKKPi = selectedDsToKKPi->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache);
auto candsDsToPiKK = selectedDsToPiKK->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache);
if (forceCharmInCollision && candsDsToKKPi.size() < 1 && candsDsToPiKK.size() < 1) {
continue;
continue;
}
if (!checkAndFillCollision(coll)) {
continue;
continue;
}
auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId);
fillCharmHadronTables<DecayChannel::DsToPiKK, false>(candsDsToPiKK);
Expand Down Expand Up @@ -314,7 +315,6 @@ struct HfCorrelatorFlowCharmHadrons {
}
}
PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processDsWithMl, "Process Ds candidates with ML info", false);

};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
Loading