diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index b0a9cf3e390..c32049c3976 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -141,21 +141,42 @@ DECLARE_SOA_TABLE(HfcRedTrigBases, "AOD", "HFCREDTRIGBASE", //! Table with trigg soa::Index<>, aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, aod::hf_correl_charm_had_reduced::PhiTrig, - aod::hf_correl_charm_had_reduced::EtaTrig, - aod::hf_correl_charm_had_reduced::PtTrig); + aod::hf_correl_charm_had_reduced::EtaTrig); DECLARE_SOA_TABLE(HfcRedTrigCharms, "AOD", "HFCREDTRIGCHARM", //! Table with Same Event Charm-Hadron pairs information + aod::hf_correl_charm_had_reduced::PtTrig, aod::hf_correl_charm_had_reduced::InvMassTrig, aod::hf_correl_charm_had_reduced::BdtScore0Trig, aod::hf_correl_charm_had_reduced::BdtScore1Trig); DECLARE_SOA_TABLE(HfcRedTrigTracks, "AOD", "HFCREDTRIGTRACK", //! Table with Same Event Charm-Hadron pairs information + aod::hf_correl_charm_had_reduced::PtTrig, aod::hf_correl_charm_had_reduced::NTpcCrossedRowsTrig, aod::hf_correl_charm_had_reduced::ItsClsMapTrig, aod::hf_correl_charm_had_reduced::ItsNClsTrig, aod::hf_correl_charm_had_reduced::DcaXYTrig, aod::hf_correl_charm_had_reduced::DcaZTrig); +namespace hf_correl_charm_had_reduced +{ +DECLARE_SOA_INDEX_COLUMN(HfcRedTrigCharm, hfcRedTrigCharm); //! Same Event pair index +DECLARE_SOA_INDEX_COLUMN(HfcRedTrigTrack, hfcRedTrigTrack); //! Same Event pair index +} // namespace hf_correl_charm_had_reduced + +DECLARE_SOA_TABLE(HfcRedSEChBases, "AOD", "HFCREDSECHBASE", //! Table with Same Event Trig-Assoc pairs + aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, + aod::hf_correl_charm_had_reduced::HfcRedTrigCharmId, + aod::hf_correl_charm_had_reduced::PtAssoc, + aod::hf_correl_charm_had_reduced::DeltaEta, + aod::hf_correl_charm_had_reduced::DeltaPhi); + +DECLARE_SOA_TABLE(HfcRedSEHadBases, "AOD", "HFCREDSEHADBASE", //! Table with Same Event Trig-Assoc pairs + aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, + aod::hf_correl_charm_had_reduced::HfcRedTrigTrackId, + aod::hf_correl_charm_had_reduced::PtAssoc, + aod::hf_correl_charm_had_reduced::DeltaEta, + aod::hf_correl_charm_had_reduced::DeltaPhi); + DECLARE_SOA_TABLE(HfcRedAssBases, "AOD", "HFCREDASSBASE", //! Table with associated candidate base info soa::Index<>, aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, @@ -170,13 +191,6 @@ DECLARE_SOA_TABLE(HfcRedAssTracks, "AOD", "HFCREDASSTRACK", //! Table with Same aod::hf_correl_charm_had_reduced::DcaXYAssoc, aod::hf_correl_charm_had_reduced::DcaZAssoc); -DECLARE_SOA_TABLE(HfcRedSEBases, "AOD", "HFCREDSEBASE", //! Table with Same Event Trig-Assoc pairs - aod::hf_correl_charm_had_reduced::HfcRedCorrCollId, - aod::hf_correl_charm_had_reduced::PtTrig, - aod::hf_correl_charm_had_reduced::PtAssoc, - aod::hf_correl_charm_had_reduced::DeltaEta, - aod::hf_correl_charm_had_reduced::DeltaPhi); - DECLARE_SOA_TABLE(HfcRedSEChHads, "AOD", "HFCREDSECHHAD", //! Correlation pairs information Same Event aod::hf_correl_charm_had_reduced::PoolBin, aod::hf_correl_charm_had_reduced::PtTrig, diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx index 85df595a4b0..bb3c7c34b0a 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadronsReduced.cxx @@ -116,8 +116,8 @@ struct HfCorrelatorFlowCharmHadronsReduced { int poolBins{0}; - using SameEvtPairsChHad = soa::Filtered>; - using SameEvtPairsHadHad = soa::Filtered>; + using SameEvtPairsChHad = soa::Filtered>; + using SameEvtPairsHadHad = soa::Filtered>; using AssocTracks = soa::Filtered>; using TrigCharmCands = soa::Join; @@ -261,14 +261,15 @@ struct HfCorrelatorFlowCharmHadronsReduced { /// \param trigCands are the selected trigger candidates /// \param assocTracks are the selected associated tracks /// \param binPolicy is the binning policy for the correlation - template + template void fillSameEvent(TPair const& pair, + TTrigCand const& trigCand, TBinningType binPolicy) { auto collision = pair.template hfcRedCorrColl_as(); - double ptTrig = pair.ptTrig(); - if constexpr (requires { pair.bdtScore0Trig(); }) { // ML selection on bkg score for Charm-Had case - if (!isSelBdtBkgScoreCut(pair, ptTrig)) { + double ptTrig = trigCand.ptTrig(); + if constexpr (requires { trigCand.bdtScore0Trig(); }) { // ML selection on bkg score for Charm-Had case + if (!isSelBdtBkgScoreCut(trigCand, ptTrig)) { return; } } @@ -282,21 +283,21 @@ struct HfCorrelatorFlowCharmHadronsReduced { registry.fill(HIST("hPoolBinTrigSE"), poolBin); registry.fill(HIST("hPoolBinAssocSE"), poolBin); if constexpr (fillTables) { - if constexpr (requires { pair.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases + if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases rowPairSECharmHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), - pair.invMassTrig(), pair.bdtScore0Trig(), pair.bdtScore1Trig(), + trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig(), pair.nTpcCrossedRowsAssoc(), pair.itsClsMapAssoc(), pair.itsNClsAssoc(), pair.dcaXYAssoc(), pair.dcaZAssoc()); } else { rowPairSEHadHads(poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi(), - pair.nTpcCrossedRowsTrig(), pair.itsClsMapTrig(), pair.itsNClsTrig(), pair.dcaXYTrig(), pair.dcaZTrig(), + trigCand.nTpcCrossedRowsTrig(), trigCand.itsClsMapTrig(), trigCand.itsNClsTrig(), trigCand.dcaXYTrig(), trigCand.dcaZTrig(), pair.nTpcCrossedRowsAssoc(), pair.itsClsMapAssoc(), pair.itsNClsAssoc(), pair.dcaXYAssoc(), pair.dcaZAssoc()); } rowCollInfos(collision.multiplicity(), collision.numPvContrib(), collision.centrality()); } if constexpr (fillSparses) { - if constexpr (requires { pair.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases + if constexpr (requires { trigCand.bdtScore0Trig(); }) { // Separate Charm-Had and Had-Had cases registry.fill(HIST("hSparseCorrelationsSECharmHad"), poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), - pair.deltaPhi(), pair.invMassTrig(), pair.bdtScore0Trig(), pair.bdtScore1Trig()); + pair.deltaPhi(), trigCand.invMassTrig(), trigCand.bdtScore0Trig(), trigCand.bdtScore1Trig()); } else { registry.fill(HIST("hSparseCorrelationsSEHadHad"), poolBin, ptTrig, pair.ptAssoc(), pair.deltaEta(), pair.deltaPhi()); } @@ -370,53 +371,61 @@ struct HfCorrelatorFlowCharmHadronsReduced { } void processSameEventCharmHadWMultMix(SameEvtPairsChHad::iterator const& pair, + aod::HfcRedTrigCharms const&, aod::HfcRedCorrColls const&) { + auto trigCand = pair.template hfcRedTrigCharm_as(); if (fillSparses && fillTables) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } else if (fillSparses) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } else if (fillTables) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventCharmHadWMultMix, "Process Same Event for Charm-Had with multiplicity pools", true); void processSameEventHadHadWMultMix(SameEvtPairsHadHad::iterator const& pair, + aod::HfcRedTrigTracks const&, aod::HfcRedCorrColls const&) { + auto trigCand = pair.template hfcRedTrigTrack_as(); if (fillSparses && fillTables) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } else if (fillSparses) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } else if (fillTables) { - fillSameEvent(pair, binPolicyPosZMult); + fillSameEvent(pair, trigCand, binPolicyPosZMult); } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventHadHadWMultMix, "Process Same Event for Had-Had with multiplicity pools", false); void processSameEventCharmHadWCentMix(SameEvtPairsChHad::iterator const& pair, + aod::HfcRedTrigCharms const&, aod::HfcRedCorrColls const&) { + auto trigCand = pair.template hfcRedTrigCharm_as(); if (fillSparses && fillTables) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } else if (fillSparses) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } else if (fillTables) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventCharmHadWCentMix, "Process Same Event for Charm-Had with centrality pools", true); void processSameEventHadHadWCentMix(SameEvtPairsHadHad::iterator const& pair, + aod::HfcRedTrigTracks const&, aod::HfcRedCorrColls const&) { + auto trigCand = pair.template hfcRedTrigTrack_as(); if (fillSparses && fillTables) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } else if (fillSparses) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } else if (fillTables) { - fillSameEvent(pair, binPolicyPosZCent); + fillSameEvent(pair, trigCand, binPolicyPosZCent); } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadronsReduced, processSameEventHadHadWCentMix, "Process Same Event for Had-Had with centrality pools", false); diff --git a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx index e46a1d27bca..7f09b9e15c1 100644 --- a/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx +++ b/PWGHF/HFC/TableProducer/derivedDataCreatorCorrelationsReduced.cxx @@ -62,13 +62,14 @@ enum CandType { /// Code to select collisions with at least one Ds meson struct HfDerivedDataCreatorCorrelationsReduced { - Produces rowCollisions; // Table with reduced collision info - Produces rowSEPairs; // Table with same-event pairs info - Produces rowAssocBases; // Table with associated candidate base info - Produces rowAssocTrkSels; // Table with associated track selection info - Produces rowTrigBases; // Table with base trigger candidate info - Produces rowTrigCharms; // Table with charm trigger candidate selection info - Produces rowTrigHads; // Table with hadron trigger candidate selection info + Produces rowCollisions; // Table with reduced collision info + Produces rowSECharmHadPairs; // Table with same-event pairs info + Produces rowSEHadHadPairs; // Table with same-event pairs info + Produces rowAssocBases; // Table with associated candidate base info + Produces rowAssocTrkSels; // Table with associated track selection info + Produces rowTrigBases; // Table with base trigger candidate info + Produces rowTrigCharms; // Table with charm trigger candidate selection info + Produces rowTrigHads; // Table with hadron trigger candidate selection info Configurable centEstimator{"centEstimator", 2, "Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3, FV0A: 4)"}; Configurable selectionFlag{"selectionFlag", 15, "Selection Flag for hadron (ML score tables are required to run the task)"}; @@ -320,6 +321,7 @@ struct HfDerivedDataCreatorCorrelationsReduced { double trigCandPt = trigCand.pt(); registry.fill(HIST("hPhiVsPtTrig"), RecoDecay::constrainAngle(trigCand.phi(), -o2::constants::math::PIHalf), trigCandPt); registry.fill(HIST("hEtaVsPtTrig"), trigCand.eta(), trigCandPt); + bool isFirstAssoc{true}; for (const auto& assTrk : assTrks) { double assTrkPt = assTrk.pt(); if (usePtDiffDcaXYCut) { @@ -347,13 +349,20 @@ struct HfDerivedDataCreatorCorrelationsReduced { registry.fill(HIST("hDcaZVsPtAssoc"), assTrk.dcaZ(), assTrkPt); double deltaPhi = RecoDecay::constrainAngle(assTrk.phi() - trigCand.phi(), -o2::constants::math::PIHalf); - rowSEPairs(rowCollisions.lastIndex(), trigCandPt, assTrkPt, deltaEta, deltaPhi); rowAssocTrkSels(assTrk.tpcNClsCrossedRows(), assTrk.itsClusterMap(), assTrk.itsNCls(), assTrk.dcaXY(), assTrk.dcaZ()); if constexpr (candType == CandType::Hadron) { - rowTrigHads(trigCand.tpcNClsCrossedRows(), trigCand.itsClusterMap(), trigCand.itsNCls(), trigCand.dcaXY(), trigCand.dcaZ()); + if (isFirstAssoc) { + rowTrigHads(trigCandPt, trigCand.tpcNClsCrossedRows(), trigCand.itsClusterMap(), trigCand.itsNCls(), trigCand.dcaXY(), trigCand.dcaZ()); + isFirstAssoc = false; + } + rowSEHadHadPairs(rowCollisions.lastIndex(), rowTrigHads.lastIndex(), assTrkPt, deltaEta, deltaPhi); } else { - std::array outputMl = getCandMlScores(trigCand); - rowTrigCharms(getCandMass(trigCand), outputMl[0], outputMl[1]); + if (isFirstAssoc) { + std::array outputMl = getCandMlScores(trigCand); + rowTrigCharms(trigCandPt, getCandMass(trigCand), outputMl[0], outputMl[1]); + isFirstAssoc = false; + } + rowSECharmHadPairs(rowCollisions.lastIndex(), rowTrigCharms.lastIndex(), assTrkPt, deltaEta, deltaPhi); } } } @@ -369,8 +378,8 @@ struct HfDerivedDataCreatorCorrelationsReduced { registry.fill(HIST("hEtaVsPtTrig"), trigCand.eta(), trigCand.pt()); std::array outputMl = getCandMlScores(trigCand); - rowTrigBases(rowCollisions.lastIndex(), trigCand.phi(), trigCand.eta(), trigCand.pt()); - rowTrigCharms(getCandMass(trigCand), outputMl[0], outputMl[1]); + rowTrigBases(rowCollisions.lastIndex(), trigCand.phi(), trigCand.eta()); + rowTrigCharms(trigCand.pt(), getCandMass(trigCand), outputMl[0], outputMl[1]); } }