Skip to content

Commit

Permalink
[PWGHF] Ds-h correlation, fix bug in ME derived data (AliceO2Group#9086)
Browse files Browse the repository at this point in the history
Co-authored-by: ALICE Action Bot <[email protected]>
  • Loading branch information
scattaru and alibuild authored Dec 21, 2024
1 parent 7d7ca05 commit 52fcea8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 33 deletions.
20 changes: 10 additions & 10 deletions PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ struct HfCorrelatorDsHadrons {
track.pt(),
poolBin);
entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), false, false);
entryDsHadronGenInfo(false, false, 0);
// entryDsHadronGenInfo(false, false, 0);
entryDsHadronMlInfo(outputMl[0], outputMl[2]);
entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows());
} else if (candidate.isSelDsToPiKK() >= selectionFlagDs) {
Expand All @@ -427,7 +427,7 @@ struct HfCorrelatorDsHadrons {
track.pt(),
poolBin);
entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), false, false);
entryDsHadronGenInfo(false, false, 0);
// entryDsHadronGenInfo(false, false, 0);
entryDsHadronMlInfo(outputMl[0], outputMl[2]);
entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows());
}
Expand Down Expand Up @@ -688,8 +688,8 @@ struct HfCorrelatorDsHadrons {
entryDsHadronRecoInfo(MassDS, true, isDecayChan);
entryDsHadronGenInfo(isDsPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin);
}
}
}
} // end loop generated particles
} // end loop generated Ds
} // end loop reconstructed collision
} // end loop generated collision
}
Expand All @@ -706,7 +706,7 @@ struct HfCorrelatorDsHadrons {
auto tracksThisColl = tracks.sliceBy(trackIndicesPerCollision, thisCollId);

// Ds fill histograms and Ds candidates information stored
for (const auto& candidate : candidates) {
for (const auto& candidate : candsDsThisColl) {
// candidate selected
if (candidate.isSelDsToKKPi() >= selectionFlagDs) {
candReduced(hfcReducedCollisionIndex, candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToKKPi(candidate));
Expand All @@ -716,7 +716,7 @@ struct HfCorrelatorDsHadrons {
}

// tracks information
for (const auto& track : tracks) {
for (const auto& track : tracksThisColl) {
if (!track.isGlobalTrackWoDCA()) {
continue;
}
Expand All @@ -742,7 +742,7 @@ struct HfCorrelatorDsHadrons {
int indexHfcReducedCollision = collReduced.lastIndex() + 1;

// Ds fill histograms and Ds candidates information stored
for (const auto& candidate : candidates) {
for (const auto& candidate : candsDsThisColl) {
// candidate selected
if (candidate.isSelDsToKKPi() >= selectionFlagDs) {
candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToKKPi(candidate));
Expand All @@ -752,7 +752,7 @@ struct HfCorrelatorDsHadrons {
}

// tracks information
for (const auto& track : tracks) {
for (const auto& track : tracksThisColl) {
if (!track.isGlobalTrackWoDCA()) {
continue;
}
Expand Down Expand Up @@ -808,7 +808,7 @@ struct HfCorrelatorDsHadrons {
pAssoc.pt(),
poolBin);
entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(cand), false, false);
entryDsHadronGenInfo(false, false, 0);
// entryDsHadronGenInfo(false, false, 0);
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
outputMl[iclass] = cand.mlProbDsToKKPi()[classMl->at(iclass)];
}
Expand All @@ -822,7 +822,7 @@ struct HfCorrelatorDsHadrons {
pAssoc.pt(),
poolBin);
entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(cand), false, false);
entryDsHadronGenInfo(false, false, 0);
// entryDsHadronGenInfo(false, false, 0);
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
outputMl[iclass] = cand.mlProbDsToPiKK()[classMl->at(iclass)];
}
Expand Down
4 changes: 2 additions & 2 deletions PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ using BinningTypeDerived = ColumnBinningPolicy<aod::hf_collisions_reduced::PosZ,
struct HfCorrelatorDsHadronsReduced {
Produces<aod::DsHadronPair> entryDsHadronPair;
Produces<aod::DsHadronRecoInfo> entryDsHadronRecoInfo;
Produces<aod::DsHadronGenInfo> entryDsHadronGenInfo;
// Produces<aod::DsHadronGenInfo> entryDsHadronGenInfo;

Configurable<bool> fillHistoData{"fillHistoData", true, "Flag for filling histograms in data processes"};
Configurable<int> numberEventsMixed{"numberEventsMixed", 5, "Number of events mixed in ME process"};
Expand Down Expand Up @@ -109,7 +109,7 @@ struct HfCorrelatorDsHadronsReduced {
pAssoc.ptAssocTrack(),
poolBin);
entryDsHadronRecoInfo(cand.invMassDs(), false, false);
entryDsHadronGenInfo(false, false, 0);
// entryDsHadronGenInfo(false, false, 0);
}
}
}
Expand Down
45 changes: 24 additions & 21 deletions PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
/// \author Grazia Luparello <[email protected]>
/// \author Samuele Cattaruzzi <[email protected]>

#include <vector>

#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/runDataProcessing.h"
Expand Down Expand Up @@ -59,8 +61,8 @@ struct HfTaskCorrelationDsHadrons {
Configurable<std::vector<int>> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."};
Configurable<std::vector<double>> binsPtD{"binsPtD", std::vector<double>{o2::analysis::hf_cuts_ds_to_k_k_pi::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"};
Configurable<std::vector<double>> binsPtHadron{"binsPtHadron", std::vector<double>{0.3, 2., 4., 8., 12., 50.}, "pT bin limits for assoc particle efficiency"};
Configurable<std::vector<double>> mlOutputPrompt{"mlScorePrompt", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for prompt"};
Configurable<std::vector<double>> mlOutputBkg{"mlScoreBkg", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for bkg"};
Configurable<std::vector<double>> mlOutputPrompt{"mlOutputPrompt", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for prompt"};
Configurable<std::vector<double>> mlOutputBkg{"mlOutputBkg", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for bkg"};
Configurable<std::vector<double>> binsPtEfficiencyD{"binsPtEfficiencyD", std::vector<double>{o2::analysis::hf_cuts_ds_to_k_k_pi::vecBinsPt}, "pT bin limits for D-meson efficiency"};
Configurable<std::vector<double>> binsPtEfficiencyHad{"binsPtEfficiencyHad", std::vector<double>{0.3, 2., 4., 8., 12., 50.}, "pT bin limits for associated particle efficiency"};
Configurable<std::vector<double>> efficiencyD{"efficiencyD", {1., 1., 1., 1., 1., 1.}, "efficiency values for Ds meson"};
Expand All @@ -71,15 +73,6 @@ struct HfTaskCorrelationDsHadrons {
Configurable<std::vector<double>> sidebandLeftOuter{"sidebandLeftOuter", {1.9040, 1.9040, 1.9040, 1.9040, 1.9040, 1.9040, 1.9040, 1.9040}, "Outer values of left sideband vs pT"};
Configurable<std::vector<double>> sidebandRightInner{"sidebandRightInner", {2.0000, 2.0000, 2.0000, 2.0000, 2.0000, 2.0000, 2.0000, 2.0000}, "Inner values of right sideband vs pT"};
Configurable<std::vector<double>> sidebandRightOuter{"sidebandRightOuter", {2.0320, 2.0320, 2.0320, 2.0320, 2.0320, 2.0320, 2.0320, 2.0320}, "Outer values of right sideband vs pT"};
ConfigurableAxis binsMassD{"binsMassD", {200, 1.7, 2.25}, "inv. mass (K^{#pm}K^{-}#pi^{+}) (GeV/#it{c}^{2})"};
ConfigurableAxis binsBdtScore{"binsBdtScore", {100, 0., 1.}, "Bdt output scores"};
ConfigurableAxis binsEta{"binsEta", {100, -2., 2.}, "#it{#eta}"};
ConfigurableAxis binsPhi{"binsPhi", {64, -PIHalf, 3. * PIHalf}, "#it{#varphi}"};
ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 8000.}, "Multiplicity as FT0M signal amplitude"};
ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "primary vertex z coordinate"};
ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"};

HfHelper hfHelper;

enum CandidateStep {
kCandidateStepMcGenDsToKKPi = 0,
Expand All @@ -98,7 +91,11 @@ struct HfTaskCorrelationDsHadrons {
kAssocTrackStepRecoSpecies,
kAssocTrackNSteps };

HfHelper hfHelper;
SliceCache cache;

using DsHadronPairFull = soa::Join<aod::DsHadronPair, aod::DsHadronRecoInfo, aod::DsHadronGenInfo>;
using DsHadronPairWithMl = soa::Join<aod::DsHadronPair, aod::DsHadronRecoInfo, aod::DsHadronMlInfo, aod::TrackRecoInfo>;
using DsHadronPairFullWithMl = soa::Join<aod::DsHadronPair, aod::DsHadronRecoInfo, aod::DsHadronGenInfo, aod::DsHadronMlInfo, aod::TrackRecoInfo>;
using CandDsMcReco = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi, aod::HfMlDsToKKPi, aod::HfCand3ProngMcRec>>; // flagDsFilter applied
using CandDsMcGen = soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>; // flagDsFilter applied
Expand All @@ -107,6 +104,20 @@ struct HfTaskCorrelationDsHadrons {
Filter flagDsFilter = ((o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(1 << aod::hf_cand_3prong::DecayType::DsToKKPi)) != static_cast<uint8_t>(0)) && (aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlagDs || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlagDs);
Filter trackFilter = (nabs(aod::track::eta) < etaTrackMax) && (aod::track::pt > ptTrackMin) && (aod::track::pt < ptTrackMax) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax);

Preslice<CandDsMcReco> perCollisionCand = o2::aod::hf_cand::collisionId;
Preslice<CandDsMcGen> perCollisionCandMc = o2::aod::mcparticle::mcCollisionId;
Preslice<TracksWithMc> perCollision = o2::aod::track::collisionId;
Preslice<o2::aod::McParticles> perCollisionMc = o2::aod::mcparticle::mcCollisionId;
PresliceUnsorted<soa::Join<aod::Collisions, aod::FT0Mults, aod::EvSels, aod::McCollisionLabels>> collPerCollMc = o2::aod::mccollisionlabel::mcCollisionId;

ConfigurableAxis binsMassD{"binsMassD", {200, 1.7, 2.25}, "inv. mass (K^{#pm}K^{-}#pi^{+}) (GeV/#it{c}^{2})"};
ConfigurableAxis binsBdtScore{"binsBdtScore", {100, 0., 1.}, "Bdt output scores"};
ConfigurableAxis binsEta{"binsEta", {100, -2., 2.}, "#it{#eta}"};
ConfigurableAxis binsPhi{"binsPhi", {64, -PIHalf, 3. * PIHalf}, "#it{#varphi}"};
ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 8000.}, "Multiplicity as FT0M signal amplitude"};
ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "primary vertex z coordinate"};
ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"};

HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject};

void init(InitContext&)
Expand Down Expand Up @@ -218,7 +229,7 @@ struct HfTaskCorrelationDsHadrons {
}
}

void processData(DsHadronPairFullWithMl const& pairEntries,
void processData(DsHadronPairWithMl const& pairEntries,
aod::DsCandRecoInfo const& candidates)
{
for (const auto& candidate : candidates) {
Expand Down Expand Up @@ -410,7 +421,7 @@ struct HfTaskCorrelationDsHadrons {
}
PROCESS_SWITCH(HfTaskCorrelationDsHadrons, processMcGen, "Process MC Gen mode", false);

void processDataME(DsHadronPairFullWithMl const& pairEntries)
void processDataME(DsHadronPairWithMl const& pairEntries)
{
for (const auto& pairEntry : pairEntries) {
// define variables for widely used quantities
Expand Down Expand Up @@ -524,11 +535,6 @@ struct HfTaskCorrelationDsHadrons {
}
PROCESS_SWITCH(HfTaskCorrelationDsHadrons, processMcRecME, "Process MC Reco ME", false);

SliceCache cache;
Preslice<CandDsMcReco> perCollisionCand = o2::aod::hf_cand::collisionId;
Preslice<CandDsMcGen> perCollisionCandMc = o2::aod::mcparticle::mcCollisionId;
PresliceUnsorted<soa::Join<aod::Collisions, aod::FT0Mults, aod::EvSels, aod::McCollisionLabels>> collPerCollMc = o2::aod::mccollisionlabel::mcCollisionId;

/// Ds-Hadron correlation - for calculating candidate reconstruction efficiency using MC reco-level analysis
void processMcCandEfficiency(soa::Join<aod::Collisions, aod::FT0Mults, aod::EvSels, aod::McCollisionLabels> const& collisions,
soa::Join<aod::McCollisions, aod::MultsExtraMC> const& mcCollisions,
Expand Down Expand Up @@ -727,9 +733,6 @@ struct HfTaskCorrelationDsHadrons {
}
PROCESS_SWITCH(HfTaskCorrelationDsHadrons, processMcCandEfficiencyWoColl, "Process MC for calculating candidate reconstruction efficiency", false);

Preslice<TracksWithMc> perCollision = o2::aod::track::collisionId;
Preslice<o2::aod::McParticles> perCollisionMc = o2::aod::mcparticle::mcCollisionId;

/// Ds-Hadron correlation - for calculating associated particle tracking efficiency using MC reco-level analysis
void processMcTrackEfficiency(soa::Join<aod::Collisions, aod::FT0Mults, aod::EvSels, aod::McCollisionLabels> const& collisions,
soa::Join<aod::McCollisions, aod::MultsExtraMC> const& mcCollisions,
Expand Down

0 comments on commit 52fcea8

Please sign in to comment.