From 1d464606f88aefde3592893b0b96dcbe0ad22ef0 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Wed, 15 May 2024 21:13:57 +0800 Subject: [PATCH 01/17] Add files via upload --- PWGHF/HFC/DataModel/CorrelationTables.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PWGHF/HFC/DataModel/CorrelationTables.h b/PWGHF/HFC/DataModel/CorrelationTables.h index 0d47f9b71aa..f05c40d3351 100644 --- a/PWGHF/HFC/DataModel/CorrelationTables.h +++ b/PWGHF/HFC/DataModel/CorrelationTables.h @@ -59,6 +59,7 @@ DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D0 DECLARE_SOA_COLUMN(MDbar, mDbar, float); //! Invariant mass of D0bar DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for D0,D0bar DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(CorrelationStatus, correlationStatus, int); //!Correlation Status enum ParticleTypeData { D0Only = 1, // Identified as D0 @@ -85,7 +86,8 @@ DECLARE_SOA_TABLE(DHadronPair, "AOD", "DHADRONPAIR", //! D0-Hadrons pairs Inform aod::hf_correlation_d0_hadron::DeltaEta, aod::hf_correlation_d0_hadron::PtD, aod::hf_correlation_d0_hadron::PtHadron, - aod::hf_correlation_d0_hadron::PoolBin); + aod::hf_correlation_d0_hadron::PoolBin, + aod::hf_correlation_d0_hadron::CorrelationStatus); DECLARE_SOA_TABLE(DHadronRecoInfo, "AOD", "DHADRONRECOINFO", //! D0-Hadrons pairs Reconstructed Informations aod::hf_correlation_d0_hadron::MD, From 8e8aa3a8155785eb22993f61c633507b7045ce3e Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 16 May 2024 20:20:27 +0800 Subject: [PATCH 02/17] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 5c9bf60277a..bb91fc4d21a 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -185,6 +185,7 @@ struct HfCorrelatorD0Hadrons { Configurable multMax{"multMax", 10000., "maximum multiplicity accepted"}; Configurable ptSoftPionMax{"ptSoftPionMax", 3 * 800. * pow(10., -6.), "max. pT cut for soft pion identification"}; Configurable correlateD0WithLeadingParticle{"correlateD0WithLeadingParticle", false, "Switch for correlation of D0 mesons with leading particle only"}; + Configurable setCorrelationState{"setCorrelationState", false, "Set correlation state"}; HfHelper hfHelper; @@ -367,8 +368,12 @@ struct HfCorrelatorD0Hadrons { for (const auto& track : tracks) { registry.fill(HIST("hTrackCounter"), 1); // fill total no. of tracks // Remove D0 daughters by checking track indices + int correlationState = 0; if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { - continue; + if (!setCorrelationState) { + continue; + } + correlationState = 1; } if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) continue; // Remove secondary tracks @@ -416,7 +421,8 @@ struct HfCorrelatorD0Hadrons { track.eta() - candidate1.eta(), candidate1.pt(), track.pt(), - poolBin); + poolBin, + correlationState); entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), signalStatus); } // end inner loop (tracks) From fa051f73e9e2b24d3fb995310b6763dd70f1b1d3 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 16 May 2024 20:40:49 +0800 Subject: [PATCH 03/17] Add files via upload --- PWGHF/DataModel/correlatorD0Hadrons.cxx | 913 ++++++++++++++++++++++++ 1 file changed, 913 insertions(+) create mode 100644 PWGHF/DataModel/correlatorD0Hadrons.cxx diff --git a/PWGHF/DataModel/correlatorD0Hadrons.cxx b/PWGHF/DataModel/correlatorD0Hadrons.cxx new file mode 100644 index 00000000000..919f4e3a3f0 --- /dev/null +++ b/PWGHF/DataModel/correlatorD0Hadrons.cxx @@ -0,0 +1,913 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file correlatorD0Hadrons.cxx +/// \brief D0-Hadron correlator task - data-like, MC-reco and MC-kine analyses. +/// +/// \author Samrangy Sadhu , INFN Bari +/// \author Swapnesh Santosh Khade , IIT Indore + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/HFC/DataModel/CorrelationTables.h" + +using namespace o2; +using namespace o2::analysis; +using namespace o2::constants::physics; +using namespace o2::framework; +using namespace o2::framework::expressions; + +/// +/// Returns deltaPhi value in range [-pi/2., 3.*pi/2], typically used for correlation studies +/// +double getDeltaPhi(double phiHadron, double phiD) +{ + return RecoDecay::constrainAngle(phiHadron - phiD, -o2::constants::math::PIHalf); +} + +const int nPtBinsMassAndEfficiency = o2::analysis::hf_cuts_d0_to_pi_k::nBinsPt; +const double efficiencyDmesonDefault[nPtBinsMassAndEfficiency] = {}; +auto vecEfficiencyDmeson = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + nPtBinsMassAndEfficiency}; + +// histogram binning definition +const int massAxisNBins = 200; +const double massAxisMin = 1.3848; +const double massAxisMax = 2.3848; +const int phiAxisNBins = 32; +const double phiAxisMin = 0.; +const double phiAxisMax = o2::constants::math::TwoPI; +const int yAxisNBins = 100; +const double yAxisMin = -5.; +const double yAxisMax = 5.; +const int ptDAxisNBins = 180; +const double ptDAxisMin = 0.; +const double ptDAxisMax = 36.; + +// definition of ME variables and new types +std::vector zBins{VARIABLE_WIDTH, -10.0, -2.5, 2.5, 10.0}; +std::vector multBins{VARIABLE_WIDTH, 0., 200., 500.0, 5000.}; +std::vector multBinsMcGen{VARIABLE_WIDTH, 0., 20., 50.0, 500.}; // In MCGen multiplicity is defined by counting primaries +using BinningType = ColumnBinningPolicy>; +BinningType corrBinning{{zBins, multBins}, true}; + +using SelectedCollisions = soa::Filtered>; +using SelectedTracks = soa::Filtered; +using SelectedCandidatesData = soa::Filtered>; +using SelectedCandidatesMcRec = soa::Filtered>; +using SelectedCollisionsMcGen = soa::Filtered>; +using SelectedTracksMcGen = soa::Filtered; + +// Code to select collisions with at least one D0 +struct HfCorrelatorD0HadronsSelection { + SliceCache cache; + + Produces d0Sel; + + Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; + Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable yCandMax{"yCandMax", 4.0, "max. cand. rapidity"}; + Configurable ptCandMin{"ptCandMin", -1., "min. cand. pT"}; + + HfHelper hfHelper; + + Preslice perCol = aod::hf_cand::collisionId; + Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + Partition> selectedD0candidatesMc = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + + void processD0SelectionData(aod::Collision const& collision, + soa::Join const&) + { + bool isD0Found = 0; + if (selectedD0Candidates.size() > 0) { + auto selectedD0CandidatesGrouped = selectedD0Candidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + + for (const auto& candidate1 : selectedD0CandidatesGrouped) { + // check decay channel flag for candidate1 + if (!TESTBIT(candidate1.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { + continue; + } + if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { + continue; + } + if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { + continue; + } + isD0Found = 1; + } + } + d0Sel(isD0Found); + } + PROCESS_SWITCH(HfCorrelatorD0HadronsSelection, processD0SelectionData, "Process D0 Selection Data", false); + + void processD0SelectionMcRec(aod::Collision const& collision, + soa::Join const&) + { + bool isD0Found = 0; + if (selectedD0candidatesMc.size() > 0) { + auto selectedD0CandidatesGroupedMc = selectedD0candidatesMc->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + for (const auto& candidate1 : selectedD0CandidatesGroupedMc) { + // check decay channel flag for candidate1 + if (!TESTBIT(candidate1.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { + continue; + } + if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { + continue; + } + if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { + continue; + } + isD0Found = 1; + } + } + d0Sel(isD0Found); + } + PROCESS_SWITCH(HfCorrelatorD0HadronsSelection, processD0SelectionMcRec, "Process D0 Selection MCRec", true); + + void processD0SelectionMcGen(aod::McCollision const&, + aod::McParticles const& mcParticles) + { + bool isD0Found = 0; + for (const auto& particle1 : mcParticles) { + if (std::abs(particle1.pdgCode()) != Pdg::kD0) { + continue; + } + double yD = RecoDecay::y(particle1.pVector(), MassD0); + if (yCandMax >= 0. && std::abs(yD) > yCandMax) { + continue; + } + if (ptCandMin >= 0. && particle1.pt() < ptCandMin) { + continue; + } + isD0Found = 1; + } + d0Sel(isD0Found); + } + PROCESS_SWITCH(HfCorrelatorD0HadronsSelection, processD0SelectionMcGen, "Process D0 Selection MCGen", false); +}; + +struct HfCorrelatorD0Hadrons { + SliceCache cache; + + Produces entryD0HadronPair; + Produces entryD0HadronRecoInfo; + + Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; + Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable yCandMax{"yCandMax", -1., "max. cand. rapidity"}; + Configurable etaTrackMax{"etaTrackMax", 4., "max. eta of tracks"}; + Configurable dcaXYTrackMax{"dcaXYTrackMax", 0.0025, "max. DCAxy of tracks"}; + Configurable dcaZTrackMax{"dcaZTrackMax", 0.0025, "max. DCAz of tracks"}; + Configurable ptCandMin{"ptCandMin", -1., "min. cand. pT"}; + Configurable ptTrackMin{"ptTrackMin", -1., "min. track pT"}; + Configurable> bins{"ptBinsForMassAndEfficiency", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; + Configurable> efficiencyDmeson{"efficiencyDmeson", std::vector{vecEfficiencyDmeson}, "Efficiency values for D0 meson"}; + Configurable applyEfficiency{"efficiencyFlagD", 1, "Flag for applying D-meson efficiency weights"}; + Configurable multMin{"multMin", 0., "minimum multiplicity accepted"}; + Configurable multMax{"multMax", 10000., "maximum multiplicity accepted"}; + Configurable ptSoftPionMax{"ptSoftPionMax", 3 * 800. * pow(10., -6.), "max. pT cut for soft pion identification"}; + Configurable correlateD0WithLeadingParticle{"correlateD0WithLeadingParticle", false, "Switch for correlation of D0 mesons with leading particle only"}; + Configurable setCorrelationState{"setCorrelationState", false, "Set correlation state"}; + + HfHelper hfHelper; + + int leadingIndex = 0; + double massD0{0.}; + double massPi{0.}; + double massK{0.}; + double softPiMass = 0.14543; // pion mass + Q-value of the D*->D0pi decay + + Preslice perCol = aod::hf_cand::collisionId; + + Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + Partition> selectedD0candidatesMc = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + + // Filters for ME + Filter collisionFilter = aod::hf_selection_dmeson_collision::dmesonSel == true; + Filter trackFilter = (aod::track::eta > static_cast(-etaTrackMax)) && (aod::track::eta < static_cast(etaTrackMax)) && (aod::track::pt > static_cast(ptTrackMin)) && (aod::track::dcaXY > static_cast(-dcaXYTrackMax)) && (aod::track::dcaXY < static_cast(dcaXYTrackMax)) && + (aod::track::dcaZ > static_cast(-dcaZTrackMax)) && (aod::track::dcaZ < static_cast(dcaZTrackMax)); + Filter d0Filter = (aod::hf_sel_candidate_d0::isSelD0 >= 1) || (aod::hf_sel_candidate_d0::isSelD0bar >= 1); + Filter collisionFilterGen = aod::hf_selection_dmeson_collision::dmesonSel == true; + Filter particlesFilter = nabs(aod::mcparticle::pdgCode) == static_cast(Pdg::kD0) || ((aod::mcparticle::flags & (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary); + + HistogramRegistry registry{ + "registry", + // NOTE: use hMassD0 for trigger normalisation (S*0.955), and hMass2DCorrelationPairs (in final task) for 2D-sideband-subtraction purposes + {{"hPtCand", "D0,D0bar candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, + {"hPtProng0", "D0,D0bar candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, + {"hPtProng1", "D0,D0bar candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, + {"hSelectionStatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{4, -0.5, 3.5}}}}, + {"hEta", "D0,D0bar candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, + {"hPhi", "D0,D0bar candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{phiAxisNBins, phiAxisMin, phiAxisMax}}}}, + {"hY", "D0,D0bar candidates;candidate #it{y};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, + {"hMultiplicityPreSelection", "multiplicity prior to selection;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}}, + {"hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}}, + {"hPtCandRec", "D0,D0bar candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, + {"hPtProng0Rec", "D0,D0bar candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, + {"hPtProng1Rec", "D0,D0bar candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, + {"hSelectionStatusRec", "D0,D0bar candidates - MC reco;selection status;entries", {HistType::kTH1F, {{4, -0.5, 3.5}}}}, + {"hSignalStatusMERec", "Signal Status - MC reco ME;candidate sidnalStatus;entries", {HistType::kTH1F, {{200, 0, 200}}}}, + {"hEtaRec", "D0,D0bar candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, + {"hPhiRec", "D0,D0bar candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{phiAxisNBins, phiAxisMin, phiAxisMax}}}}, + {"hYRec", "D0,D0bar candidates - MC reco;candidate #it{y};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, + {"hEvtCountGen", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, + {"hPtCandGen", "D0,D0bar particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, + {"hEtaGen", "D0,D0bar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, + {"hPhiGen", "D0,D0bar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{phiAxisNBins, phiAxisMin, phiAxisMax}}}}, + {"hYGen", "D0,D0bar candidates - MC gen;candidate #it{y};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, + {"hTrackCounter", "soft pion counter - Data", {HistType::kTH1F, {{5, 0., 5.}}}}, + {"hTrackCounterRec", "soft pion counter - MC rec", {HistType::kTH1F, {{5, 0., 5.}}}}, + {"hTrackCounterGen", "soft pion counter - MC gen", {HistType::kTH1F, {{5, 0., 5.}}}}, + {"hMultV0M", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}}, + {"hZvtx", "z vertex;z vertex;entries", {HistType::kTH1F, {{200, -20., 20.}}}}, + {"hD0Bin", "D0 selected in pool Bin;pool Bin;entries", {HistType::kTH1F, {{9, 0., 9.}}}}, + {"hTracksBin", "Tracks selected in pool Bin;pool Bin;entries", {HistType::kTH1F, {{9, 0., 9.}}}}}}; + + void init(InitContext&) + { + massD0 = MassD0; + massPi = MassPiPlus; + massK = MassKPlus; + + auto vbins = (std::vector)bins; + registry.add("hMass", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMass1D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); + registry.add("hMassD01D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); + registry.add("hMassD0bar1D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); + // mass histogram for D0 signal only + registry.add("hMassD0RecSig", "D0 signal candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + // mass histogram for D0 Reflection candidates only + registry.add("hMassD0RecRef", "D0 reflection candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + // mass histogram for D0 background candidates only + registry.add("hMassD0RecBg", "D0 background candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + // mass histogram for D0bar signal only + registry.add("hMassD0barRecSig", "D0bar signal candidates - MC reco;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + // mass histogram for D0bar Reflection candidates only + registry.add("hMassD0barRecRef", "D0bar reflection candidates - MC reco;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + // mass histogram for D0bar background candidates only + registry.add("hMassD0barRecBg", "D0bar background candidates - MC reco;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCountD0TriggersGen", "D0 trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + // Find Leading Particle + template + int findLeadingParticle(TTracks const& tracks) + { + auto leadingParticle = tracks.begin(); + for (auto const& track : tracks) { + if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) { + continue; + } + if (track.pt() > leadingParticle.pt()) { + leadingParticle = track; + } + } + int leadingIndex = leadingParticle.globalIndex(); + return leadingIndex; + } + // ======= Process starts for Data, Same event ============ + + /// D0-h correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) + void processData(soa::Join::iterator const& collision, + aod::TracksWDca const& tracks, + soa::Join const&) + { + // protection against empty tables to be sliced + if (selectedD0Candidates.size() == 0) { + return; + } + // find leading particle + if (correlateD0WithLeadingParticle) { + leadingIndex = findLeadingParticle(tracks); + } + + int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); + int nTracks = 0; + if (collision.numContrib() > 1) { + for (const auto& track : tracks) { + if (std::abs(track.eta()) > etaTrackMax) { + continue; + } + if (std::abs(track.dcaXY()) > dcaXYTrackMax || std::abs(track.dcaZ()) > dcaZTrackMax) { + continue; + } + nTracks++; + } + } + registry.fill(HIST("hMultiplicityPreSelection"), nTracks); + if (nTracks < multMin || nTracks > multMax) { + return; + } + registry.fill(HIST("hMultiplicity"), nTracks); + + auto selectedD0CandidatesGrouped = selectedD0Candidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + + for (const auto& candidate1 : selectedD0CandidatesGrouped) { + if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { + continue; + } + if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { + continue; + } + // check decay channel flag for candidate1 + if (!TESTBIT(candidate1.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { + continue; + } + + // ========================== Define parameters for soft pion removal ================================ + auto ePiK = RecoDecay::e(candidate1.pVectorProng0(), massPi) + RecoDecay::e(candidate1.pVectorProng1(), massK); + auto eKPi = RecoDecay::e(candidate1.pVectorProng0(), massK) + RecoDecay::e(candidate1.pVectorProng1(), massPi); + + // ========================== trigger efficiency ================================ + double efficiencyWeight = 1.; + if (applyEfficiency) { + efficiencyWeight = 1. / efficiencyDmeson->at(o2::analysis::findBin(bins, candidate1.pt())); + } + // ========================== Fill mass histo ================================ + if (candidate1.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMass1D"), hfHelper.invMassD0ToPiK(candidate1), efficiencyWeight); + registry.fill(HIST("hMassD01D"), hfHelper.invMassD0ToPiK(candidate1), efficiencyWeight); + } + if (candidate1.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + registry.fill(HIST("hMass1D"), hfHelper.invMassD0barToKPi(candidate1), efficiencyWeight); + registry.fill(HIST("hMassD0bar1D"), hfHelper.invMassD0barToKPi(candidate1), efficiencyWeight); + } + // ========================== Fill general histos ================================ + registry.fill(HIST("hPtCand"), candidate1.pt()); + registry.fill(HIST("hPtProng0"), candidate1.ptProng0()); + registry.fill(HIST("hPtProng1"), candidate1.ptProng1()); + registry.fill(HIST("hEta"), candidate1.eta()); + registry.fill(HIST("hPhi"), candidate1.phi()); + registry.fill(HIST("hY"), hfHelper.yD0(candidate1)); + registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); + registry.fill(HIST("hD0Bin"), poolBin); + + // ============ D-h correlation dedicated section ================================== + + // ========================== track loop starts here ================================ + for (const auto& track : tracks) { + registry.fill(HIST("hTrackCounter"), 1); // fill total no. of tracks + // Remove D0 daughters by checking track indices + bool correlationState = false; + if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { + if (!setCorrelationState) { + continue; + } + correlationState = true; + } + if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) + continue; // Remove secondary tracks + + registry.fill(HIST("hTrackCounter"), 2); // fill no. of tracks before soft pion removal + + // ========== soft pion removal =================================================== + double invMassDstar1 = 0., invMassDstar2 = 0.; + bool isSoftPiD0 = false, isSoftPiD0bar = false; + auto pSum2 = RecoDecay::p2(candidate1.pVector(), track.pVector()); + auto ePion = track.energy(massPi); + invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); + invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); + + if (candidate1.isSelD0() >= selectionFlagD0) { + if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate1)) - softPiMass) < ptSoftPionMax) { + isSoftPiD0 = true; + continue; + } + } + + if (candidate1.isSelD0bar() >= selectionFlagD0bar) { + if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate1)) - softPiMass) < ptSoftPionMax) { + isSoftPiD0bar = true; + continue; + } + } + registry.fill(HIST("hTrackCounter"), 3); // fill no. of tracks after soft pion removal + + int signalStatus = 0; + if ((candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { + signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0Only; + } + if ((candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { + signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnly; + } + + if (correlateD0WithLeadingParticle) { + if (track.globalIndex() != leadingIndex) { + continue; + } + registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle + } + entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), + track.eta() - candidate1.eta(), + candidate1.pt(), + track.pt(), + poolBin, + correlationState); + entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), signalStatus); + + } // end inner loop (tracks) + + } // end outer loop + } + PROCESS_SWITCH(HfCorrelatorD0Hadrons, processData, "Process data", false); + + // ================ Process starts for MCRec, same event ======================== + + void processMcRec(soa::Join::iterator const& collision, + aod::TracksWDca const& tracks, + soa::Join const&) + { + // protection against empty tables to be sliced + if (selectedD0candidatesMc.size() == 0) { + return; + } + int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); + int nTracks = 0; + if (collision.numContrib() > 1) { + for (const auto& track : tracks) { + if (std::abs(track.eta()) > etaTrackMax) { + continue; + } + if (std::abs(track.dcaXY()) > dcaXYTrackMax || std::abs(track.dcaZ()) > dcaZTrackMax) { + continue; + } + nTracks++; + } + } + registry.fill(HIST("hMultiplicityPreSelection"), nTracks); + if (nTracks < multMin || nTracks > multMax) { + return; + } + registry.fill(HIST("hMultiplicity"), nTracks); + + auto selectedD0CandidatesGroupedMc = selectedD0candidatesMc->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + // MC reco level + bool flagD0 = false; + bool flagD0bar = false; + + for (const auto& candidate1 : selectedD0CandidatesGroupedMc) { + // check decay channel flag for candidate1 + if (!TESTBIT(candidate1.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { + continue; + } + if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { + continue; + } + if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { + continue; + } + + double efficiencyWeight = 1.; + if (applyEfficiency) { + efficiencyWeight = 1. / efficiencyDmeson->at(o2::analysis::findBin(bins, candidate1.pt())); + } + + if (std::abs(candidate1.flagMcMatchRec()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { + // fill per-candidate distributions from D0/D0bar true candidates + registry.fill(HIST("hPtCandRec"), candidate1.pt()); + registry.fill(HIST("hPtProng0Rec"), candidate1.ptProng0()); + registry.fill(HIST("hPtProng1Rec"), candidate1.ptProng1()); + registry.fill(HIST("hEtaRec"), candidate1.eta()); + registry.fill(HIST("hPhiRec"), candidate1.phi()); + registry.fill(HIST("hYRec"), hfHelper.yD0(candidate1)); + registry.fill(HIST("hSelectionStatusRec"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); + } + // fill invariant mass plots from D0/D0bar signal and background candidates + if (candidate1.isSelD0() >= selectionFlagD0) { // only reco as D0 + if (candidate1.flagMcMatchRec() == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { // also matched as D0 + registry.fill(HIST("hMassD0RecSig"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + } else if (candidate1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + registry.fill(HIST("hMassD0RecRef"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + } else { + registry.fill(HIST("hMassD0RecBg"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); + } + } + if (candidate1.isSelD0bar() >= selectionFlagD0bar) { // only reco as D0bar + if (candidate1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { // also matched as D0bar + registry.fill(HIST("hMassD0barRecSig"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + } else if (candidate1.flagMcMatchRec() == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { + registry.fill(HIST("hMassD0barRecRef"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + } else { + registry.fill(HIST("hMassD0barRecBg"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); + } + } + + // ===================== Define parameters for soft pion removal ======================== + auto ePiK = RecoDecay::e(candidate1.pVectorProng0(), massPi) + RecoDecay::e(candidate1.pVectorProng1(), massK); + auto eKPi = RecoDecay::e(candidate1.pVectorProng0(), massK) + RecoDecay::e(candidate1.pVectorProng1(), massPi); + + // ============== D-h correlation dedicated section ==================================== + + flagD0 = candidate1.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Signal 'true' if candidate1 matched to D0 (particle) + flagD0bar = candidate1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Reflection 'true' if candidate1, selected as D0 (particle), is matched to D0bar (antiparticle) + + // ========== track loop starts here ======================== + + for (const auto& track : tracks) { + registry.fill(HIST("hTrackCounterRec"), 1); // fill total no. of tracks + if (std::abs(track.eta()) > etaTrackMax) { + continue; + } + if (track.pt() < ptTrackMin) { + continue; + } + // Removing D0 daughters by checking track indices + if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { + continue; + } + if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) { + continue; // Remove secondary tracks + } + registry.fill(HIST("hTrackCounterRec"), 2); // fill no. of tracks before soft pion removal + + // ===== soft pion removal =================================================== + double invMassDstar1 = 0, invMassDstar2 = 0; + bool isSoftPiD0 = false, isSoftPiD0bar = false; + auto pSum2 = RecoDecay::p2(candidate1.pVector(), track.pVector()); + auto ePion = track.energy(massPi); + invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); + invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); + + if (candidate1.isSelD0() >= selectionFlagD0) { + if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate1)) - softPiMass) < ptSoftPionMax) { + isSoftPiD0 = true; + continue; + } + } + + if (candidate1.isSelD0bar() >= selectionFlagD0bar) { + if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate1)) - softPiMass) < ptSoftPionMax) { + isSoftPiD0bar = true; + continue; + } + } + + registry.fill(HIST("hTrackCounterRec"), 3); // fill no. of tracks after soft pion removal + + int signalStatus = 0; + if (flagD0 && (candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Sig); + } // signal case D0 + if (flagD0bar && (candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Ref); + } // reflection case D0 + if (!flagD0 && !flagD0bar && (candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Bg); + } // background case D0 + + if (flagD0bar && (candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barSig); + } // signal case D0bar + if (flagD0 && (candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barRef); + } // reflection case D0bar + if (!flagD0 && !flagD0bar && (candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barBg); + } // background case D0bar + + entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), + track.eta() - candidate1.eta(), + candidate1.pt(), + track.pt(), + poolBin); + entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), signalStatus); + } // end inner loop (Tracks) + } // end of outer loop (D0) + registry.fill(HIST("hZvtx"), collision.posZ()); + registry.fill(HIST("hMultV0M"), collision.multFV0M()); + } + + PROCESS_SWITCH(HfCorrelatorD0Hadrons, processMcRec, "Process MC Reco mode", true); + + // ================= Process starts for MCGen, same event =================== + + void processMcGen(aod::McCollision const& mcCollision, + soa::Join const& mcParticles) + { + registry.fill(HIST("hEvtCountGen"), 0); + // MC gen level + for (const auto& particle1 : mcParticles) { + // check if the particle is D0 or D0bar (for general plot filling and selection, so both cases are fine) - NOTE: decay channel is not probed! + if (std::abs(particle1.pdgCode()) != Pdg::kD0) { + continue; + } + double yD = RecoDecay::y(particle1.pVector(), MassD0); + if (yCandMax >= 0. && std::abs(yD) > yCandMax) { + continue; + } + if (ptCandMin >= 0. && particle1.pt() < ptCandMin) { + continue; + } + registry.fill(HIST("hPtCandGen"), particle1.pt()); + registry.fill(HIST("hEtaGen"), particle1.eta()); + registry.fill(HIST("hPhiGen"), particle1.phi()); + registry.fill(HIST("hYGen"), yD); + + // =============== D-h correlation dedicated section ===================== + + if (std::abs(particle1.pdgCode()) != Pdg::kD0) { // just checking the particle PDG, not the decay channel (differently from Reco: you have a BR factor btw such levels!) + continue; + } + registry.fill(HIST("hCountD0TriggersGen"), 0, particle1.pt()); // to count trigger D0 (for normalisation) + + for (const auto& particle2 : mcParticles) { + registry.fill(HIST("hTrackCounterGen"), 1); // total no. of tracks + if (std::abs(particle2.eta()) > etaTrackMax) { + continue; + } + if (particle2.pt() < ptTrackMin) { + continue; + } + if ((std::abs(particle2.pdgCode()) != kElectron) && (std::abs(particle2.pdgCode()) != kMuonMinus) && (std::abs(particle2.pdgCode()) != kPiPlus) && (std::abs(particle2.pdgCode()) != kKPlus) && (std::abs(particle2.pdgCode()) != kProton)) { + continue; + } + + // ==============================soft pion removal================================ + registry.fill(HIST("hTrackCounterGen"), 2); // fill before soft pi removal + // method used: indexMother = -1 by default if the mother doesn't match with given PID of the mother. We find mother of pion if it is D* and mother of D0 if it is D*. If they are both positive and they both match each other, then it is detected as a soft pion + + auto indexMotherPi = RecoDecay::getMother(mcParticles, particle2, Pdg::kDStar, true, nullptr, 1); // last arguement 1 is written to consider immediate decay mother only + auto indexMotherD0 = RecoDecay::getMother(mcParticles, particle1, Pdg::kDStar, true, nullptr, 1); + if (std::abs(particle2.pdgCode()) == kPiPlus && indexMotherPi >= 0 && indexMotherD0 >= 0 && indexMotherPi == indexMotherD0) + continue; + + registry.fill(HIST("hTrackCounterGen"), 3); // fill after soft pion removal + + auto getTracksSize = [&mcParticles](aod::McCollision const& /*collision*/) { + int nTracks = 0; + for (const auto& track : mcParticles) { + if (track.isPhysicalPrimary() && std::abs(track.eta()) < 1.0) { + nTracks++; + } + } + return nTracks; + }; + using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; + BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zBins, multBinsMcGen}, true}; + int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), getTracksSize(mcCollision))); + + entryD0HadronPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt(), + poolBin); + entryD0HadronRecoInfo(massD0, massD0, 0); // dummy info + } // end inner loop (Tracks) + } // end outer loop (D0) + } + + PROCESS_SWITCH(HfCorrelatorD0Hadrons, processMcGen, "Process MC Gen mode", false); + + // ====================== Implement Event mixing on Data =================================== + + void processDataMixedEvent(SelectedCollisions const& collisions, + SelectedCandidatesData const& candidates, + SelectedTracks const& tracks) + { + auto tracksTuple = std::make_tuple(candidates, tracks); + Pair pairData{corrBinning, 5, -1, collisions, tracksTuple, &cache}; + + for (const auto& [c1, tracks1, c2, tracks2] : pairData) { + // LOGF(info, "Mixed event collisions: Index = (%d, %d), tracks Size: (%d, %d), Z Vertex: (%f, %f), Pool Bin: (%d, %d)", c1.globalIndex(), c2.globalIndex(), tracks1.size(), tracks2.size(), c1.posZ(), c2.posZ(), corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFV0M())),corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFV0M()))); // For debug + int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFV0M())); + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + + if (yCandMax >= 0. && std::abs(hfHelper.yD0(t1)) > yCandMax) { + continue; + } + + // soft pion removal, signal status 1,3 for D0 and 2,3 for D0bar (SoftPi removed), signal status 11,13 for D0 and 12.13 for D0bar (only SoftPi) + auto ePiK = RecoDecay::e(t1.pVectorProng0(), massPi) + RecoDecay::e(t1.pVectorProng1(), massK); + auto eKPi = RecoDecay::e(t1.pVectorProng0(), massK) + RecoDecay::e(t1.pVectorProng1(), massPi); + double invMassDstar1 = 0., invMassDstar2 = 0.; + bool isSoftPiD0 = false, isSoftPiD0bar = false; + auto pSum2 = RecoDecay::p2(t1.pVector(), t2.pVector()); + auto ePion = t2.energy(massPi); + invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); + invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); + + if (t1.isSelD0() >= selectionFlagD0) { + if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(t1)) - softPiMass) < ptSoftPionMax) { + isSoftPiD0 = true; + } + } + + if (t1.isSelD0bar() >= selectionFlagD0bar) { + if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(t1)) - softPiMass) < ptSoftPionMax) { + isSoftPiD0bar = true; + } + } + + int signalStatus = 0; + if (t1.isSelD0() >= selectionFlagD0) { + if (!isSoftPiD0) { + signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0Only; + } else { + signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0OnlySoftPi; + } + } + if (t1.isSelD0bar() >= selectionFlagD0bar) { + if (!isSoftPiD0bar) { + signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnly; + } else { + signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnlySoftPi; + } + } + + entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin); + entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(t1), hfHelper.invMassD0barToKPi(t1), signalStatus); + } + } + } + PROCESS_SWITCH(HfCorrelatorD0Hadrons, processDataMixedEvent, "Process data mixed event", false); + + // ====================== Implement Event mixing on McRec =================================== + + void processMcRecMixedEvent(SelectedCollisions const& collisions, + SelectedCandidatesMcRec const& candidates, + SelectedTracks const& tracks) + { + auto tracksTuple = std::make_tuple(candidates, tracks); + Pair pairMcRec{corrBinning, 5, -1, collisions, tracksTuple, &cache}; + bool flagD0 = false; + bool flagD0bar = false; + for (const auto& [c1, tracks1, c2, tracks2] : pairMcRec) { + int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFV0M())); + + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + + if (yCandMax >= 0. && std::abs(hfHelper.yD0(t1)) > yCandMax) { + continue; + } + + // soft pion removal + auto ePiK = RecoDecay::e(t1.pVectorProng0(), massPi) + RecoDecay::e(t1.pVectorProng1(), massK); + auto eKPi = RecoDecay::e(t1.pVectorProng0(), massK) + RecoDecay::e(t1.pVectorProng1(), massPi); + double invMassDstar1 = 0., invMassDstar2 = 0.; + bool isSoftPiD0 = false, isSoftPiD0bar = false; + auto pSum2 = RecoDecay::p2(t1.pVector(), t2.pVector()); + auto ePion = t2.energy(massPi); + invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); + invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); + + if (t1.isSelD0() >= selectionFlagD0) { + if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(t1)) - softPiMass) < ptSoftPionMax) { + isSoftPiD0 = true; + } + } + + if (t1.isSelD0bar() >= selectionFlagD0bar) { + if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(t1)) - softPiMass) < ptSoftPionMax) { + isSoftPiD0bar = true; + } + } + + flagD0 = t1.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Signal 'true' if candidate1 matched to D0 (particle) + flagD0bar = t1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Reflection 'true' if candidate1, selected as D0 (particle), is matched to D0bar (antiparticle) + int signalStatus = 0; + + if (flagD0 && (t1.isSelD0() >= selectionFlagD0)) { + if (!isSoftPiD0) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Sig); // signalStatus += 1; + } else { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); // signalStatus += 64; + } + } // signal case D0 + + if (flagD0bar && (t1.isSelD0() >= selectionFlagD0)) { + if (!isSoftPiD0) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Ref); // signalStatus += 2; + } else { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); // signalStatus += 64; + } + } // reflection case D0 + + if (!flagD0 && !flagD0bar && (t1.isSelD0() >= selectionFlagD0)) { + if (!isSoftPiD0) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Bg); // signalStatus += 4; + } else { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); + } + } // background case D0 + + if (flagD0bar && (t1.isSelD0bar() >= selectionFlagD0bar)) { + if (!isSoftPiD0bar) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barSig); // signalStatus += 8; + } else { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); + } + } // signal case D0bar + + if (flagD0 && (t1.isSelD0bar() >= selectionFlagD0bar)) { + if (!isSoftPiD0bar) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barRef); // signalStatus += 16; + } else { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); + } + } // reflection case D0bar + + if (!flagD0 && !flagD0bar && (t1.isSelD0bar() >= selectionFlagD0bar)) { + if (!isSoftPiD0bar) { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barBg); // signalStatus += 32; + } else { + SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); + } + } // background case D0bar + + registry.fill(HIST("hSignalStatusMERec"), signalStatus); + entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin); + entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(t1), hfHelper.invMassD0barToKPi(t1), signalStatus); + } + } + } + PROCESS_SWITCH(HfCorrelatorD0Hadrons, processMcRecMixedEvent, "Process Mixed Event MCRec", false); + + // ====================== Implement Event mixing on McGen =================================== + + void processMcGenMixedEvent(SelectedCollisionsMcGen const& collisions, + SelectedTracksMcGen const& mcParticles) + { + + auto getTracksSize = [&mcParticles, this](SelectedCollisionsMcGen::iterator const& collision) { + int nTracks = 0; + auto associatedTracks = mcParticles.sliceByCached(o2::aod::mcparticle::mcCollisionId, collision.globalIndex(), this->cache); + for (const auto& track : associatedTracks) { + if (track.isPhysicalPrimary() && std::abs(track.eta()) < 1.0) { + nTracks++; + } + } + return nTracks; + }; + + using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; + BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zBins, multBins}, true}; + + auto tracksTuple = std::make_tuple(mcParticles, mcParticles); + Pair pairMcGen{corrBinningMcGen, 5, -1, collisions, tracksTuple, &cache}; + + for (const auto& [c1, tracks1, c2, tracks2] : pairMcGen) { + for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + + // Check track t1 is D0 + if (std::abs(t1.pdgCode()) != Pdg::kD0) { + continue; + } + + double yD = RecoDecay::y(t1.pVector(), MassD0); + if (yCandMax >= 0. && std::abs(yD) > yCandMax) { + continue; + } + if (ptCandMin >= 0. && t1.pt() < ptCandMin) { + continue; + } + + if (std::abs(t2.eta()) > etaTrackMax) { + continue; + } + if (t2.pt() < ptTrackMin) { + continue; + } + + // ==============================soft pion removal================================ + // method used: indexMother = -1 by default if the mother doesn't match with given PID of the mother. We find mother of pion if it is D* and mother of D0 if it is D*. If they are both positive and they both match each other, then it is detected as a soft pion + + auto indexMotherPi = RecoDecay::getMother(mcParticles, t2, Pdg::kDStar, true, nullptr, 1); // last arguement 1 is written to consider immediate decay mother only + auto indexMotherD0 = RecoDecay::getMother(mcParticles, t1, Pdg::kDStar, true, nullptr, 1); + if (std::abs(t2.pdgCode()) == kPiPlus && indexMotherPi >= 0 && indexMotherD0 >= 0 && indexMotherPi == indexMotherD0) { + continue; + } + int poolBin = corrBinningMcGen.getBin(std::make_tuple(c2.posZ(), getTracksSize(c2))); + entryD0HadronPair(getDeltaPhi(t2.phi(), t1.phi()), t2.eta() - t1.eta(), t1.pt(), t2.pt(), poolBin); + entryD0HadronRecoInfo(massD0, massD0, 0); // dummy info + } + } + } + PROCESS_SWITCH(HfCorrelatorD0Hadrons, processMcGenMixedEvent, "Process Mixed Event MCGen", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; +} From 0b0ca553f6c95d9482c77402e5a86b132442f23d Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 16 May 2024 20:41:32 +0800 Subject: [PATCH 04/17] Add files via upload --- PWGHF/HFC/DataModel/CorrelationTables.h | 43 ++++++++----------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/PWGHF/HFC/DataModel/CorrelationTables.h b/PWGHF/HFC/DataModel/CorrelationTables.h index f05c40d3351..2156e9e8553 100644 --- a/PWGHF/HFC/DataModel/CorrelationTables.h +++ b/PWGHF/HFC/DataModel/CorrelationTables.h @@ -59,7 +59,7 @@ DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D0 DECLARE_SOA_COLUMN(MDbar, mDbar, float); //! Invariant mass of D0bar DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for D0,D0bar DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent -DECLARE_SOA_COLUMN(CorrelationStatus, correlationStatus, int); //!Correlation Status +DECLARE_SOA_COLUMN(CorrelationStatus, correlationStatus, bool); //!Correlation Status enum ParticleTypeData { D0Only = 1, // Identified as D0 @@ -120,22 +120,17 @@ DECLARE_SOA_TABLE(LcHadronRecoInfo, "AOD", "LCHRECOINFO", //! Lc-Hadrons pairs R // definition of columns and tables for Ds-Hadron correlation pairs namespace hf_correlation_ds_hadron { -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Ds and Hadrons -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Ds and Hadrons -DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of Ds -DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron -DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of Ds -DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML background score for Ds selection -DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML prompt score for Ds selection -DECLARE_SOA_COLUMN(TrackDcaXY, trackDcaXY, float); //! DCA xy of the track -DECLARE_SOA_COLUMN(TrackDcaZ, trackDcaZ, float); //! DCA z of the track -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent -DECLARE_SOA_COLUMN(TrackTPCNClsCrossedRows, trackTPCNClsCrossedRows, int); //! Number of crossed TPC Rows -DECLARE_SOA_COLUMN(TrackOrigin, trackOrigin, int); //! Number of crossed TPC Rows -DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! Used in MC-Rec, Ds Signal -DECLARE_SOA_COLUMN(IsDecayChan, isDecayChan, bool); //! Used in MC-Rec, Ds decay channel check -DECLARE_SOA_COLUMN(IsPrompt, isPrompt, bool); //! Used in MC-Rec, Ds Prompt or Non-Prompt -DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); //! Used in MC-Rec, primary associated particles +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Ds and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Ds and Hadrons +DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of Ds +DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron +DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of Ds +DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML background score for Ds selection +DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML prompt score for Ds selection +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! Used in MC-Rec, Ds Signal +DECLARE_SOA_COLUMN(IsPrompt, isPrompt, bool); //! Used in MC-Rec, Ds Prompt or Non-Prompt +DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); //! Used in MC-Rec, primary associated particles } // namespace hf_correlation_ds_hadron DECLARE_SOA_TABLE(DsHadronPair, "AOD", "DSHPAIR", //! Ds-Hadrons pairs Information @@ -147,13 +142,11 @@ DECLARE_SOA_TABLE(DsHadronPair, "AOD", "DSHPAIR", //! Ds-Hadrons pairs Informati DECLARE_SOA_TABLE(DsHadronRecoInfo, "AOD", "DSHRECOINFO", //! Ds-Hadrons pairs Reconstructed Information aod::hf_correlation_ds_hadron::MD, - aod::hf_correlation_ds_hadron::IsSignal, - aod::hf_correlation_ds_hadron::IsDecayChan); + aod::hf_correlation_ds_hadron::IsSignal); DECLARE_SOA_TABLE(DsHadronGenInfo, "AOD", "DSHGENINFO", //! Ds-Hadrons pairs Generated Information aod::hf_correlation_ds_hadron::IsPrompt, - aod::hf_correlation_ds_hadron::IsPhysicalPrimary, - aod::hf_correlation_ds_hadron::TrackOrigin); + aod::hf_correlation_ds_hadron::IsPhysicalPrimary); DECLARE_SOA_TABLE(DsHadronMlInfo, "AOD", "DSHMLINFO", //! Ds-Hadrons pairs Machine Learning Information aod::hf_correlation_ds_hadron::MlScorePrompt, @@ -165,14 +158,6 @@ DECLARE_SOA_TABLE(DsCandRecoInfo, "AOD", "DSCANDRECOINFO", //! Ds candidates Rec aod::hf_correlation_ds_hadron::MlScorePrompt, aod::hf_correlation_ds_hadron::MlScoreBkg); -DECLARE_SOA_TABLE(DsCandGenInfo, "AOD", "DSCANDGENOINFO", //! Ds candidates Generated Information - aod::hf_correlation_ds_hadron::IsPrompt); - -DECLARE_SOA_TABLE(TrackRecoInfo, "AOD", "TRACKRECOINFO", //! Tracks Reconstructed Information - aod::hf_correlation_ds_hadron::TrackDcaXY, - aod::hf_correlation_ds_hadron::TrackDcaZ, - aod::hf_correlation_ds_hadron::TrackTPCNClsCrossedRows); - // definition of columns and tables for Dplus properties namespace hf_dplus_meson { From 187c23bdbe6c65114024d70039325cdb716411cb Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 16 May 2024 20:44:16 +0800 Subject: [PATCH 05/17] Delete PWGHF/DataModel/correlatorD0Hadrons.cxx --- PWGHF/DataModel/correlatorD0Hadrons.cxx | 913 ------------------------ 1 file changed, 913 deletions(-) delete mode 100644 PWGHF/DataModel/correlatorD0Hadrons.cxx diff --git a/PWGHF/DataModel/correlatorD0Hadrons.cxx b/PWGHF/DataModel/correlatorD0Hadrons.cxx deleted file mode 100644 index 919f4e3a3f0..00000000000 --- a/PWGHF/DataModel/correlatorD0Hadrons.cxx +++ /dev/null @@ -1,913 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file correlatorD0Hadrons.cxx -/// \brief D0-Hadron correlator task - data-like, MC-reco and MC-kine analyses. -/// -/// \author Samrangy Sadhu , INFN Bari -/// \author Swapnesh Santosh Khade , IIT Indore - -#include "CommonConstants/PhysicsConstants.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" - -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/Multiplicity.h" - -#include "PWGHF/Core/HfHelper.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/HFC/DataModel/CorrelationTables.h" - -using namespace o2; -using namespace o2::analysis; -using namespace o2::constants::physics; -using namespace o2::framework; -using namespace o2::framework::expressions; - -/// -/// Returns deltaPhi value in range [-pi/2., 3.*pi/2], typically used for correlation studies -/// -double getDeltaPhi(double phiHadron, double phiD) -{ - return RecoDecay::constrainAngle(phiHadron - phiD, -o2::constants::math::PIHalf); -} - -const int nPtBinsMassAndEfficiency = o2::analysis::hf_cuts_d0_to_pi_k::nBinsPt; -const double efficiencyDmesonDefault[nPtBinsMassAndEfficiency] = {}; -auto vecEfficiencyDmeson = std::vector{efficiencyDmesonDefault, efficiencyDmesonDefault + nPtBinsMassAndEfficiency}; - -// histogram binning definition -const int massAxisNBins = 200; -const double massAxisMin = 1.3848; -const double massAxisMax = 2.3848; -const int phiAxisNBins = 32; -const double phiAxisMin = 0.; -const double phiAxisMax = o2::constants::math::TwoPI; -const int yAxisNBins = 100; -const double yAxisMin = -5.; -const double yAxisMax = 5.; -const int ptDAxisNBins = 180; -const double ptDAxisMin = 0.; -const double ptDAxisMax = 36.; - -// definition of ME variables and new types -std::vector zBins{VARIABLE_WIDTH, -10.0, -2.5, 2.5, 10.0}; -std::vector multBins{VARIABLE_WIDTH, 0., 200., 500.0, 5000.}; -std::vector multBinsMcGen{VARIABLE_WIDTH, 0., 20., 50.0, 500.}; // In MCGen multiplicity is defined by counting primaries -using BinningType = ColumnBinningPolicy>; -BinningType corrBinning{{zBins, multBins}, true}; - -using SelectedCollisions = soa::Filtered>; -using SelectedTracks = soa::Filtered; -using SelectedCandidatesData = soa::Filtered>; -using SelectedCandidatesMcRec = soa::Filtered>; -using SelectedCollisionsMcGen = soa::Filtered>; -using SelectedTracksMcGen = soa::Filtered; - -// Code to select collisions with at least one D0 -struct HfCorrelatorD0HadronsSelection { - SliceCache cache; - - Produces d0Sel; - - Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; - Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; - Configurable yCandMax{"yCandMax", 4.0, "max. cand. rapidity"}; - Configurable ptCandMin{"ptCandMin", -1., "min. cand. pT"}; - - HfHelper hfHelper; - - Preslice perCol = aod::hf_cand::collisionId; - Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - Partition> selectedD0candidatesMc = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - - void processD0SelectionData(aod::Collision const& collision, - soa::Join const&) - { - bool isD0Found = 0; - if (selectedD0Candidates.size() > 0) { - auto selectedD0CandidatesGrouped = selectedD0Candidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - - for (const auto& candidate1 : selectedD0CandidatesGrouped) { - // check decay channel flag for candidate1 - if (!TESTBIT(candidate1.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { - continue; - } - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { - continue; - } - if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { - continue; - } - isD0Found = 1; - } - } - d0Sel(isD0Found); - } - PROCESS_SWITCH(HfCorrelatorD0HadronsSelection, processD0SelectionData, "Process D0 Selection Data", false); - - void processD0SelectionMcRec(aod::Collision const& collision, - soa::Join const&) - { - bool isD0Found = 0; - if (selectedD0candidatesMc.size() > 0) { - auto selectedD0CandidatesGroupedMc = selectedD0candidatesMc->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - for (const auto& candidate1 : selectedD0CandidatesGroupedMc) { - // check decay channel flag for candidate1 - if (!TESTBIT(candidate1.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { - continue; - } - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { - continue; - } - if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { - continue; - } - isD0Found = 1; - } - } - d0Sel(isD0Found); - } - PROCESS_SWITCH(HfCorrelatorD0HadronsSelection, processD0SelectionMcRec, "Process D0 Selection MCRec", true); - - void processD0SelectionMcGen(aod::McCollision const&, - aod::McParticles const& mcParticles) - { - bool isD0Found = 0; - for (const auto& particle1 : mcParticles) { - if (std::abs(particle1.pdgCode()) != Pdg::kD0) { - continue; - } - double yD = RecoDecay::y(particle1.pVector(), MassD0); - if (yCandMax >= 0. && std::abs(yD) > yCandMax) { - continue; - } - if (ptCandMin >= 0. && particle1.pt() < ptCandMin) { - continue; - } - isD0Found = 1; - } - d0Sel(isD0Found); - } - PROCESS_SWITCH(HfCorrelatorD0HadronsSelection, processD0SelectionMcGen, "Process D0 Selection MCGen", false); -}; - -struct HfCorrelatorD0Hadrons { - SliceCache cache; - - Produces entryD0HadronPair; - Produces entryD0HadronRecoInfo; - - Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; - Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; - Configurable yCandMax{"yCandMax", -1., "max. cand. rapidity"}; - Configurable etaTrackMax{"etaTrackMax", 4., "max. eta of tracks"}; - Configurable dcaXYTrackMax{"dcaXYTrackMax", 0.0025, "max. DCAxy of tracks"}; - Configurable dcaZTrackMax{"dcaZTrackMax", 0.0025, "max. DCAz of tracks"}; - Configurable ptCandMin{"ptCandMin", -1., "min. cand. pT"}; - Configurable ptTrackMin{"ptTrackMin", -1., "min. track pT"}; - Configurable> bins{"ptBinsForMassAndEfficiency", std::vector{o2::analysis::hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; - Configurable> efficiencyDmeson{"efficiencyDmeson", std::vector{vecEfficiencyDmeson}, "Efficiency values for D0 meson"}; - Configurable applyEfficiency{"efficiencyFlagD", 1, "Flag for applying D-meson efficiency weights"}; - Configurable multMin{"multMin", 0., "minimum multiplicity accepted"}; - Configurable multMax{"multMax", 10000., "maximum multiplicity accepted"}; - Configurable ptSoftPionMax{"ptSoftPionMax", 3 * 800. * pow(10., -6.), "max. pT cut for soft pion identification"}; - Configurable correlateD0WithLeadingParticle{"correlateD0WithLeadingParticle", false, "Switch for correlation of D0 mesons with leading particle only"}; - Configurable setCorrelationState{"setCorrelationState", false, "Set correlation state"}; - - HfHelper hfHelper; - - int leadingIndex = 0; - double massD0{0.}; - double massPi{0.}; - double massK{0.}; - double softPiMass = 0.14543; // pion mass + Q-value of the D*->D0pi decay - - Preslice perCol = aod::hf_cand::collisionId; - - Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - Partition> selectedD0candidatesMc = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - - // Filters for ME - Filter collisionFilter = aod::hf_selection_dmeson_collision::dmesonSel == true; - Filter trackFilter = (aod::track::eta > static_cast(-etaTrackMax)) && (aod::track::eta < static_cast(etaTrackMax)) && (aod::track::pt > static_cast(ptTrackMin)) && (aod::track::dcaXY > static_cast(-dcaXYTrackMax)) && (aod::track::dcaXY < static_cast(dcaXYTrackMax)) && - (aod::track::dcaZ > static_cast(-dcaZTrackMax)) && (aod::track::dcaZ < static_cast(dcaZTrackMax)); - Filter d0Filter = (aod::hf_sel_candidate_d0::isSelD0 >= 1) || (aod::hf_sel_candidate_d0::isSelD0bar >= 1); - Filter collisionFilterGen = aod::hf_selection_dmeson_collision::dmesonSel == true; - Filter particlesFilter = nabs(aod::mcparticle::pdgCode) == static_cast(Pdg::kD0) || ((aod::mcparticle::flags & (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary) == (uint8_t)o2::aod::mcparticle::enums::PhysicalPrimary); - - HistogramRegistry registry{ - "registry", - // NOTE: use hMassD0 for trigger normalisation (S*0.955), and hMass2DCorrelationPairs (in final task) for 2D-sideband-subtraction purposes - {{"hPtCand", "D0,D0bar candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, - {"hPtProng0", "D0,D0bar candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, - {"hPtProng1", "D0,D0bar candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, - {"hSelectionStatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{4, -0.5, 3.5}}}}, - {"hEta", "D0,D0bar candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, - {"hPhi", "D0,D0bar candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{phiAxisNBins, phiAxisMin, phiAxisMax}}}}, - {"hY", "D0,D0bar candidates;candidate #it{y};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, - {"hMultiplicityPreSelection", "multiplicity prior to selection;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}}, - {"hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}}, - {"hPtCandRec", "D0,D0bar candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, - {"hPtProng0Rec", "D0,D0bar candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, - {"hPtProng1Rec", "D0,D0bar candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, - {"hSelectionStatusRec", "D0,D0bar candidates - MC reco;selection status;entries", {HistType::kTH1F, {{4, -0.5, 3.5}}}}, - {"hSignalStatusMERec", "Signal Status - MC reco ME;candidate sidnalStatus;entries", {HistType::kTH1F, {{200, 0, 200}}}}, - {"hEtaRec", "D0,D0bar candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, - {"hPhiRec", "D0,D0bar candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{phiAxisNBins, phiAxisMin, phiAxisMax}}}}, - {"hYRec", "D0,D0bar candidates - MC reco;candidate #it{y};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, - {"hEvtCountGen", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, - {"hPtCandGen", "D0,D0bar particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{ptDAxisNBins, ptDAxisMin, ptDAxisMax}}}}, - {"hEtaGen", "D0,D0bar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, - {"hPhiGen", "D0,D0bar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{phiAxisNBins, phiAxisMin, phiAxisMax}}}}, - {"hYGen", "D0,D0bar candidates - MC gen;candidate #it{y};entries", {HistType::kTH1F, {{yAxisNBins, yAxisMin, yAxisMax}}}}, - {"hTrackCounter", "soft pion counter - Data", {HistType::kTH1F, {{5, 0., 5.}}}}, - {"hTrackCounterRec", "soft pion counter - MC rec", {HistType::kTH1F, {{5, 0., 5.}}}}, - {"hTrackCounterGen", "soft pion counter - MC gen", {HistType::kTH1F, {{5, 0., 5.}}}}, - {"hMultV0M", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}}, - {"hZvtx", "z vertex;z vertex;entries", {HistType::kTH1F, {{200, -20., 20.}}}}, - {"hD0Bin", "D0 selected in pool Bin;pool Bin;entries", {HistType::kTH1F, {{9, 0., 9.}}}}, - {"hTracksBin", "Tracks selected in pool Bin;pool Bin;entries", {HistType::kTH1F, {{9, 0., 9.}}}}}}; - - void init(InitContext&) - { - massD0 = MassD0; - massPi = MassPiPlus; - massK = MassKPlus; - - auto vbins = (std::vector)bins; - registry.add("hMass", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMass1D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); - registry.add("hMassD01D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); - registry.add("hMassD0bar1D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); - // mass histogram for D0 signal only - registry.add("hMassD0RecSig", "D0 signal candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - // mass histogram for D0 Reflection candidates only - registry.add("hMassD0RecRef", "D0 reflection candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - // mass histogram for D0 background candidates only - registry.add("hMassD0RecBg", "D0 background candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - // mass histogram for D0bar signal only - registry.add("hMassD0barRecSig", "D0bar signal candidates - MC reco;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - // mass histogram for D0bar Reflection candidates only - registry.add("hMassD0barRecRef", "D0bar reflection candidates - MC reco;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - // mass histogram for D0bar background candidates only - registry.add("hMassD0barRecBg", "D0bar background candidates - MC reco;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisNBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCountD0TriggersGen", "D0 trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - } - - // Find Leading Particle - template - int findLeadingParticle(TTracks const& tracks) - { - auto leadingParticle = tracks.begin(); - for (auto const& track : tracks) { - if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) { - continue; - } - if (track.pt() > leadingParticle.pt()) { - leadingParticle = track; - } - } - int leadingIndex = leadingParticle.globalIndex(); - return leadingIndex; - } - // ======= Process starts for Data, Same event ============ - - /// D0-h correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) - void processData(soa::Join::iterator const& collision, - aod::TracksWDca const& tracks, - soa::Join const&) - { - // protection against empty tables to be sliced - if (selectedD0Candidates.size() == 0) { - return; - } - // find leading particle - if (correlateD0WithLeadingParticle) { - leadingIndex = findLeadingParticle(tracks); - } - - int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); - int nTracks = 0; - if (collision.numContrib() > 1) { - for (const auto& track : tracks) { - if (std::abs(track.eta()) > etaTrackMax) { - continue; - } - if (std::abs(track.dcaXY()) > dcaXYTrackMax || std::abs(track.dcaZ()) > dcaZTrackMax) { - continue; - } - nTracks++; - } - } - registry.fill(HIST("hMultiplicityPreSelection"), nTracks); - if (nTracks < multMin || nTracks > multMax) { - return; - } - registry.fill(HIST("hMultiplicity"), nTracks); - - auto selectedD0CandidatesGrouped = selectedD0Candidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - - for (const auto& candidate1 : selectedD0CandidatesGrouped) { - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { - continue; - } - if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { - continue; - } - // check decay channel flag for candidate1 - if (!TESTBIT(candidate1.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { - continue; - } - - // ========================== Define parameters for soft pion removal ================================ - auto ePiK = RecoDecay::e(candidate1.pVectorProng0(), massPi) + RecoDecay::e(candidate1.pVectorProng1(), massK); - auto eKPi = RecoDecay::e(candidate1.pVectorProng0(), massK) + RecoDecay::e(candidate1.pVectorProng1(), massPi); - - // ========================== trigger efficiency ================================ - double efficiencyWeight = 1.; - if (applyEfficiency) { - efficiencyWeight = 1. / efficiencyDmeson->at(o2::analysis::findBin(bins, candidate1.pt())); - } - // ========================== Fill mass histo ================================ - if (candidate1.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); - registry.fill(HIST("hMass1D"), hfHelper.invMassD0ToPiK(candidate1), efficiencyWeight); - registry.fill(HIST("hMassD01D"), hfHelper.invMassD0ToPiK(candidate1), efficiencyWeight); - } - if (candidate1.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); - registry.fill(HIST("hMass1D"), hfHelper.invMassD0barToKPi(candidate1), efficiencyWeight); - registry.fill(HIST("hMassD0bar1D"), hfHelper.invMassD0barToKPi(candidate1), efficiencyWeight); - } - // ========================== Fill general histos ================================ - registry.fill(HIST("hPtCand"), candidate1.pt()); - registry.fill(HIST("hPtProng0"), candidate1.ptProng0()); - registry.fill(HIST("hPtProng1"), candidate1.ptProng1()); - registry.fill(HIST("hEta"), candidate1.eta()); - registry.fill(HIST("hPhi"), candidate1.phi()); - registry.fill(HIST("hY"), hfHelper.yD0(candidate1)); - registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); - registry.fill(HIST("hD0Bin"), poolBin); - - // ============ D-h correlation dedicated section ================================== - - // ========================== track loop starts here ================================ - for (const auto& track : tracks) { - registry.fill(HIST("hTrackCounter"), 1); // fill total no. of tracks - // Remove D0 daughters by checking track indices - bool correlationState = false; - if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { - if (!setCorrelationState) { - continue; - } - correlationState = true; - } - if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) - continue; // Remove secondary tracks - - registry.fill(HIST("hTrackCounter"), 2); // fill no. of tracks before soft pion removal - - // ========== soft pion removal =================================================== - double invMassDstar1 = 0., invMassDstar2 = 0.; - bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(candidate1.pVector(), track.pVector()); - auto ePion = track.energy(massPi); - invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); - invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); - - if (candidate1.isSelD0() >= selectionFlagD0) { - if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate1)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0 = true; - continue; - } - } - - if (candidate1.isSelD0bar() >= selectionFlagD0bar) { - if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate1)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0bar = true; - continue; - } - } - registry.fill(HIST("hTrackCounter"), 3); // fill no. of tracks after soft pion removal - - int signalStatus = 0; - if ((candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { - signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0Only; - } - if ((candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { - signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnly; - } - - if (correlateD0WithLeadingParticle) { - if (track.globalIndex() != leadingIndex) { - continue; - } - registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle - } - entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), - track.eta() - candidate1.eta(), - candidate1.pt(), - track.pt(), - poolBin, - correlationState); - entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), signalStatus); - - } // end inner loop (tracks) - - } // end outer loop - } - PROCESS_SWITCH(HfCorrelatorD0Hadrons, processData, "Process data", false); - - // ================ Process starts for MCRec, same event ======================== - - void processMcRec(soa::Join::iterator const& collision, - aod::TracksWDca const& tracks, - soa::Join const&) - { - // protection against empty tables to be sliced - if (selectedD0candidatesMc.size() == 0) { - return; - } - int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); - int nTracks = 0; - if (collision.numContrib() > 1) { - for (const auto& track : tracks) { - if (std::abs(track.eta()) > etaTrackMax) { - continue; - } - if (std::abs(track.dcaXY()) > dcaXYTrackMax || std::abs(track.dcaZ()) > dcaZTrackMax) { - continue; - } - nTracks++; - } - } - registry.fill(HIST("hMultiplicityPreSelection"), nTracks); - if (nTracks < multMin || nTracks > multMax) { - return; - } - registry.fill(HIST("hMultiplicity"), nTracks); - - auto selectedD0CandidatesGroupedMc = selectedD0candidatesMc->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - // MC reco level - bool flagD0 = false; - bool flagD0bar = false; - - for (const auto& candidate1 : selectedD0CandidatesGroupedMc) { - // check decay channel flag for candidate1 - if (!TESTBIT(candidate1.hfflag(), aod::hf_cand_2prong::DecayType::D0ToPiK)) { - continue; - } - if (yCandMax >= 0. && std::abs(hfHelper.yD0(candidate1)) > yCandMax) { - continue; - } - if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { - continue; - } - - double efficiencyWeight = 1.; - if (applyEfficiency) { - efficiencyWeight = 1. / efficiencyDmeson->at(o2::analysis::findBin(bins, candidate1.pt())); - } - - if (std::abs(candidate1.flagMcMatchRec()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { - // fill per-candidate distributions from D0/D0bar true candidates - registry.fill(HIST("hPtCandRec"), candidate1.pt()); - registry.fill(HIST("hPtProng0Rec"), candidate1.ptProng0()); - registry.fill(HIST("hPtProng1Rec"), candidate1.ptProng1()); - registry.fill(HIST("hEtaRec"), candidate1.eta()); - registry.fill(HIST("hPhiRec"), candidate1.phi()); - registry.fill(HIST("hYRec"), hfHelper.yD0(candidate1)); - registry.fill(HIST("hSelectionStatusRec"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); - } - // fill invariant mass plots from D0/D0bar signal and background candidates - if (candidate1.isSelD0() >= selectionFlagD0) { // only reco as D0 - if (candidate1.flagMcMatchRec() == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { // also matched as D0 - registry.fill(HIST("hMassD0RecSig"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); - } else if (candidate1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { - registry.fill(HIST("hMassD0RecRef"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); - } else { - registry.fill(HIST("hMassD0RecBg"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt(), efficiencyWeight); - } - } - if (candidate1.isSelD0bar() >= selectionFlagD0bar) { // only reco as D0bar - if (candidate1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { // also matched as D0bar - registry.fill(HIST("hMassD0barRecSig"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); - } else if (candidate1.flagMcMatchRec() == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { - registry.fill(HIST("hMassD0barRecRef"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); - } else { - registry.fill(HIST("hMassD0barRecBg"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt(), efficiencyWeight); - } - } - - // ===================== Define parameters for soft pion removal ======================== - auto ePiK = RecoDecay::e(candidate1.pVectorProng0(), massPi) + RecoDecay::e(candidate1.pVectorProng1(), massK); - auto eKPi = RecoDecay::e(candidate1.pVectorProng0(), massK) + RecoDecay::e(candidate1.pVectorProng1(), massPi); - - // ============== D-h correlation dedicated section ==================================== - - flagD0 = candidate1.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Signal 'true' if candidate1 matched to D0 (particle) - flagD0bar = candidate1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Reflection 'true' if candidate1, selected as D0 (particle), is matched to D0bar (antiparticle) - - // ========== track loop starts here ======================== - - for (const auto& track : tracks) { - registry.fill(HIST("hTrackCounterRec"), 1); // fill total no. of tracks - if (std::abs(track.eta()) > etaTrackMax) { - continue; - } - if (track.pt() < ptTrackMin) { - continue; - } - // Removing D0 daughters by checking track indices - if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { - continue; - } - if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) { - continue; // Remove secondary tracks - } - registry.fill(HIST("hTrackCounterRec"), 2); // fill no. of tracks before soft pion removal - - // ===== soft pion removal =================================================== - double invMassDstar1 = 0, invMassDstar2 = 0; - bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(candidate1.pVector(), track.pVector()); - auto ePion = track.energy(massPi); - invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); - invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); - - if (candidate1.isSelD0() >= selectionFlagD0) { - if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(candidate1)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0 = true; - continue; - } - } - - if (candidate1.isSelD0bar() >= selectionFlagD0bar) { - if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(candidate1)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0bar = true; - continue; - } - } - - registry.fill(HIST("hTrackCounterRec"), 3); // fill no. of tracks after soft pion removal - - int signalStatus = 0; - if (flagD0 && (candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Sig); - } // signal case D0 - if (flagD0bar && (candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Ref); - } // reflection case D0 - if (!flagD0 && !flagD0bar && (candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Bg); - } // background case D0 - - if (flagD0bar && (candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barSig); - } // signal case D0bar - if (flagD0 && (candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barRef); - } // reflection case D0bar - if (!flagD0 && !flagD0bar && (candidate1.isSelD0bar() >= selectionFlagD0bar) && !isSoftPiD0bar) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barBg); - } // background case D0bar - - entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), - track.eta() - candidate1.eta(), - candidate1.pt(), - track.pt(), - poolBin); - entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), signalStatus); - } // end inner loop (Tracks) - } // end of outer loop (D0) - registry.fill(HIST("hZvtx"), collision.posZ()); - registry.fill(HIST("hMultV0M"), collision.multFV0M()); - } - - PROCESS_SWITCH(HfCorrelatorD0Hadrons, processMcRec, "Process MC Reco mode", true); - - // ================= Process starts for MCGen, same event =================== - - void processMcGen(aod::McCollision const& mcCollision, - soa::Join const& mcParticles) - { - registry.fill(HIST("hEvtCountGen"), 0); - // MC gen level - for (const auto& particle1 : mcParticles) { - // check if the particle is D0 or D0bar (for general plot filling and selection, so both cases are fine) - NOTE: decay channel is not probed! - if (std::abs(particle1.pdgCode()) != Pdg::kD0) { - continue; - } - double yD = RecoDecay::y(particle1.pVector(), MassD0); - if (yCandMax >= 0. && std::abs(yD) > yCandMax) { - continue; - } - if (ptCandMin >= 0. && particle1.pt() < ptCandMin) { - continue; - } - registry.fill(HIST("hPtCandGen"), particle1.pt()); - registry.fill(HIST("hEtaGen"), particle1.eta()); - registry.fill(HIST("hPhiGen"), particle1.phi()); - registry.fill(HIST("hYGen"), yD); - - // =============== D-h correlation dedicated section ===================== - - if (std::abs(particle1.pdgCode()) != Pdg::kD0) { // just checking the particle PDG, not the decay channel (differently from Reco: you have a BR factor btw such levels!) - continue; - } - registry.fill(HIST("hCountD0TriggersGen"), 0, particle1.pt()); // to count trigger D0 (for normalisation) - - for (const auto& particle2 : mcParticles) { - registry.fill(HIST("hTrackCounterGen"), 1); // total no. of tracks - if (std::abs(particle2.eta()) > etaTrackMax) { - continue; - } - if (particle2.pt() < ptTrackMin) { - continue; - } - if ((std::abs(particle2.pdgCode()) != kElectron) && (std::abs(particle2.pdgCode()) != kMuonMinus) && (std::abs(particle2.pdgCode()) != kPiPlus) && (std::abs(particle2.pdgCode()) != kKPlus) && (std::abs(particle2.pdgCode()) != kProton)) { - continue; - } - - // ==============================soft pion removal================================ - registry.fill(HIST("hTrackCounterGen"), 2); // fill before soft pi removal - // method used: indexMother = -1 by default if the mother doesn't match with given PID of the mother. We find mother of pion if it is D* and mother of D0 if it is D*. If they are both positive and they both match each other, then it is detected as a soft pion - - auto indexMotherPi = RecoDecay::getMother(mcParticles, particle2, Pdg::kDStar, true, nullptr, 1); // last arguement 1 is written to consider immediate decay mother only - auto indexMotherD0 = RecoDecay::getMother(mcParticles, particle1, Pdg::kDStar, true, nullptr, 1); - if (std::abs(particle2.pdgCode()) == kPiPlus && indexMotherPi >= 0 && indexMotherD0 >= 0 && indexMotherPi == indexMotherD0) - continue; - - registry.fill(HIST("hTrackCounterGen"), 3); // fill after soft pion removal - - auto getTracksSize = [&mcParticles](aod::McCollision const& /*collision*/) { - int nTracks = 0; - for (const auto& track : mcParticles) { - if (track.isPhysicalPrimary() && std::abs(track.eta()) < 1.0) { - nTracks++; - } - } - return nTracks; - }; - using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; - BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zBins, multBinsMcGen}, true}; - int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), getTracksSize(mcCollision))); - - entryD0HadronPair(getDeltaPhi(particle2.phi(), particle1.phi()), - particle2.eta() - particle1.eta(), - particle1.pt(), - particle2.pt(), - poolBin); - entryD0HadronRecoInfo(massD0, massD0, 0); // dummy info - } // end inner loop (Tracks) - } // end outer loop (D0) - } - - PROCESS_SWITCH(HfCorrelatorD0Hadrons, processMcGen, "Process MC Gen mode", false); - - // ====================== Implement Event mixing on Data =================================== - - void processDataMixedEvent(SelectedCollisions const& collisions, - SelectedCandidatesData const& candidates, - SelectedTracks const& tracks) - { - auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairData{corrBinning, 5, -1, collisions, tracksTuple, &cache}; - - for (const auto& [c1, tracks1, c2, tracks2] : pairData) { - // LOGF(info, "Mixed event collisions: Index = (%d, %d), tracks Size: (%d, %d), Z Vertex: (%f, %f), Pool Bin: (%d, %d)", c1.globalIndex(), c2.globalIndex(), tracks1.size(), tracks2.size(), c1.posZ(), c2.posZ(), corrBinning.getBin(std::make_tuple(c1.posZ(), c1.multFV0M())),corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFV0M()))); // For debug - int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFV0M())); - for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - - if (yCandMax >= 0. && std::abs(hfHelper.yD0(t1)) > yCandMax) { - continue; - } - - // soft pion removal, signal status 1,3 for D0 and 2,3 for D0bar (SoftPi removed), signal status 11,13 for D0 and 12.13 for D0bar (only SoftPi) - auto ePiK = RecoDecay::e(t1.pVectorProng0(), massPi) + RecoDecay::e(t1.pVectorProng1(), massK); - auto eKPi = RecoDecay::e(t1.pVectorProng0(), massK) + RecoDecay::e(t1.pVectorProng1(), massPi); - double invMassDstar1 = 0., invMassDstar2 = 0.; - bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(t1.pVector(), t2.pVector()); - auto ePion = t2.energy(massPi); - invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); - invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); - - if (t1.isSelD0() >= selectionFlagD0) { - if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(t1)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0 = true; - } - } - - if (t1.isSelD0bar() >= selectionFlagD0bar) { - if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(t1)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0bar = true; - } - } - - int signalStatus = 0; - if (t1.isSelD0() >= selectionFlagD0) { - if (!isSoftPiD0) { - signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0Only; - } else { - signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0OnlySoftPi; - } - } - if (t1.isSelD0bar() >= selectionFlagD0bar) { - if (!isSoftPiD0bar) { - signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnly; - } else { - signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnlySoftPi; - } - } - - entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin); - entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(t1), hfHelper.invMassD0barToKPi(t1), signalStatus); - } - } - } - PROCESS_SWITCH(HfCorrelatorD0Hadrons, processDataMixedEvent, "Process data mixed event", false); - - // ====================== Implement Event mixing on McRec =================================== - - void processMcRecMixedEvent(SelectedCollisions const& collisions, - SelectedCandidatesMcRec const& candidates, - SelectedTracks const& tracks) - { - auto tracksTuple = std::make_tuple(candidates, tracks); - Pair pairMcRec{corrBinning, 5, -1, collisions, tracksTuple, &cache}; - bool flagD0 = false; - bool flagD0bar = false; - for (const auto& [c1, tracks1, c2, tracks2] : pairMcRec) { - int poolBin = corrBinning.getBin(std::make_tuple(c2.posZ(), c2.multFV0M())); - - for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - - if (yCandMax >= 0. && std::abs(hfHelper.yD0(t1)) > yCandMax) { - continue; - } - - // soft pion removal - auto ePiK = RecoDecay::e(t1.pVectorProng0(), massPi) + RecoDecay::e(t1.pVectorProng1(), massK); - auto eKPi = RecoDecay::e(t1.pVectorProng0(), massK) + RecoDecay::e(t1.pVectorProng1(), massPi); - double invMassDstar1 = 0., invMassDstar2 = 0.; - bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(t1.pVector(), t2.pVector()); - auto ePion = t2.energy(massPi); - invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); - invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); - - if (t1.isSelD0() >= selectionFlagD0) { - if ((std::abs(invMassDstar1 - hfHelper.invMassD0ToPiK(t1)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0 = true; - } - } - - if (t1.isSelD0bar() >= selectionFlagD0bar) { - if ((std::abs(invMassDstar2 - hfHelper.invMassD0barToKPi(t1)) - softPiMass) < ptSoftPionMax) { - isSoftPiD0bar = true; - } - } - - flagD0 = t1.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Signal 'true' if candidate1 matched to D0 (particle) - flagD0bar = t1.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK); // flagD0Reflection 'true' if candidate1, selected as D0 (particle), is matched to D0bar (antiparticle) - int signalStatus = 0; - - if (flagD0 && (t1.isSelD0() >= selectionFlagD0)) { - if (!isSoftPiD0) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Sig); // signalStatus += 1; - } else { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); // signalStatus += 64; - } - } // signal case D0 - - if (flagD0bar && (t1.isSelD0() >= selectionFlagD0)) { - if (!isSoftPiD0) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Ref); // signalStatus += 2; - } else { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); // signalStatus += 64; - } - } // reflection case D0 - - if (!flagD0 && !flagD0bar && (t1.isSelD0() >= selectionFlagD0)) { - if (!isSoftPiD0) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0Bg); // signalStatus += 4; - } else { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); - } - } // background case D0 - - if (flagD0bar && (t1.isSelD0bar() >= selectionFlagD0bar)) { - if (!isSoftPiD0bar) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barSig); // signalStatus += 8; - } else { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); - } - } // signal case D0bar - - if (flagD0 && (t1.isSelD0bar() >= selectionFlagD0bar)) { - if (!isSoftPiD0bar) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barRef); // signalStatus += 16; - } else { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); - } - } // reflection case D0bar - - if (!flagD0 && !flagD0bar && (t1.isSelD0bar() >= selectionFlagD0bar)) { - if (!isSoftPiD0bar) { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::D0barBg); // signalStatus += 32; - } else { - SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); - } - } // background case D0bar - - registry.fill(HIST("hSignalStatusMERec"), signalStatus); - entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin); - entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(t1), hfHelper.invMassD0barToKPi(t1), signalStatus); - } - } - } - PROCESS_SWITCH(HfCorrelatorD0Hadrons, processMcRecMixedEvent, "Process Mixed Event MCRec", false); - - // ====================== Implement Event mixing on McGen =================================== - - void processMcGenMixedEvent(SelectedCollisionsMcGen const& collisions, - SelectedTracksMcGen const& mcParticles) - { - - auto getTracksSize = [&mcParticles, this](SelectedCollisionsMcGen::iterator const& collision) { - int nTracks = 0; - auto associatedTracks = mcParticles.sliceByCached(o2::aod::mcparticle::mcCollisionId, collision.globalIndex(), this->cache); - for (const auto& track : associatedTracks) { - if (track.isPhysicalPrimary() && std::abs(track.eta()) < 1.0) { - nTracks++; - } - } - return nTracks; - }; - - using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; - BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zBins, multBins}, true}; - - auto tracksTuple = std::make_tuple(mcParticles, mcParticles); - Pair pairMcGen{corrBinningMcGen, 5, -1, collisions, tracksTuple, &cache}; - - for (const auto& [c1, tracks1, c2, tracks2] : pairMcGen) { - for (const auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - - // Check track t1 is D0 - if (std::abs(t1.pdgCode()) != Pdg::kD0) { - continue; - } - - double yD = RecoDecay::y(t1.pVector(), MassD0); - if (yCandMax >= 0. && std::abs(yD) > yCandMax) { - continue; - } - if (ptCandMin >= 0. && t1.pt() < ptCandMin) { - continue; - } - - if (std::abs(t2.eta()) > etaTrackMax) { - continue; - } - if (t2.pt() < ptTrackMin) { - continue; - } - - // ==============================soft pion removal================================ - // method used: indexMother = -1 by default if the mother doesn't match with given PID of the mother. We find mother of pion if it is D* and mother of D0 if it is D*. If they are both positive and they both match each other, then it is detected as a soft pion - - auto indexMotherPi = RecoDecay::getMother(mcParticles, t2, Pdg::kDStar, true, nullptr, 1); // last arguement 1 is written to consider immediate decay mother only - auto indexMotherD0 = RecoDecay::getMother(mcParticles, t1, Pdg::kDStar, true, nullptr, 1); - if (std::abs(t2.pdgCode()) == kPiPlus && indexMotherPi >= 0 && indexMotherD0 >= 0 && indexMotherPi == indexMotherD0) { - continue; - } - int poolBin = corrBinningMcGen.getBin(std::make_tuple(c2.posZ(), getTracksSize(c2))); - entryD0HadronPair(getDeltaPhi(t2.phi(), t1.phi()), t2.eta() - t1.eta(), t1.pt(), t2.pt(), poolBin); - entryD0HadronRecoInfo(massD0, massD0, 0); // dummy info - } - } - } - PROCESS_SWITCH(HfCorrelatorD0Hadrons, processMcGenMixedEvent, "Process Mixed Event MCGen", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; -} From 663ee120783be946ec0df6a6e31164d38782ba86 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 16 May 2024 20:47:41 +0800 Subject: [PATCH 06/17] Add files via upload --- PWGHF/HFC/TableProducer/CorrelationTables.h | 307 ++++++++++++++++++++ 1 file changed, 307 insertions(+) create mode 100644 PWGHF/HFC/TableProducer/CorrelationTables.h diff --git a/PWGHF/HFC/TableProducer/CorrelationTables.h b/PWGHF/HFC/TableProducer/CorrelationTables.h new file mode 100644 index 00000000000..7a5097fb12b --- /dev/null +++ b/PWGHF/HFC/TableProducer/CorrelationTables.h @@ -0,0 +1,307 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file CorrelationTables.h +/// \brief Correlation table definitions. +/// \author Vít Kučera , Inha University + +#ifndef PWGHF_HFC_DATAMODEL_CORRELATIONTABLES_H_ +#define PWGHF_HFC_DATAMODEL_CORRELATIONTABLES_H_ + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisDataModel.h" + +#include "Common/Core/RecoDecay.h" + +#include "PWGHF/DataModel/CandidateReconstructionTables.h" + +namespace o2::aod +{ +// definition of columns and tables for D-Dbar correlation pairs +namespace hf_correlation_d_dbar +{ +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); +DECLARE_SOA_COLUMN(PtD, ptD, float); +DECLARE_SOA_COLUMN(PtDbar, ptDbar, float); +DECLARE_SOA_COLUMN(MD, mD, float); +DECLARE_SOA_COLUMN(MDbar, mDbar, float); +DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); +} // namespace hf_correlation_d_dbar + +DECLARE_SOA_TABLE(DDbarPair, "AOD", "DDBARPAIR", + aod::hf_correlation_d_dbar::DeltaPhi, + aod::hf_correlation_d_dbar::DeltaEta, + aod::hf_correlation_d_dbar::PtD, + aod::hf_correlation_d_dbar::PtDbar); + +DECLARE_SOA_TABLE(DDbarRecoInfo, "AOD", "DDBARRECOINFO", + aod::hf_correlation_d_dbar::MD, + aod::hf_correlation_d_dbar::MDbar, + aod::hf_correlation_d_dbar::SignalStatus); + +// definition of columns and tables for D0-Hadron correlation pairs +namespace hf_correlation_d0_hadron +{ +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between D0 and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between D0 and Hadrons +DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D0 +DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron +DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D0 +DECLARE_SOA_COLUMN(MDbar, mDbar, float); //! Invariant mass of D0bar +DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for D0,D0bar +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(CorrelationStatus, correlationStatus, bool); //!Correlation Status + +enum ParticleTypeData { + D0Only = 1, // Identified as D0 + D0barOnly, // Identified as D0bar + D0D0barBoth, // Identified as both D0 and D0bar + D0OnlySoftPi = 11, // Identified as D0 with soft pion + D0barOnlySoftPi, // Identified as D0bar with soft pion + D0D0barBothSoftPi // Identified as both D0 and D0bar with soft pion +}; + +enum ParticleTypeMcRec { + D0Sig = 0, // D0 signal + D0Ref, // D0 reflection + D0Bg, // D0 background + D0barSig, // D0bar signal + D0barRef, // D0bar reflection + D0barBg, // D0bar background + SoftPi // pairs including soft pion +}; +} // namespace hf_correlation_d0_hadron + +DECLARE_SOA_TABLE(DHadronPair, "AOD", "DHADRONPAIR", //! D0-Hadrons pairs Informations + aod::hf_correlation_d0_hadron::DeltaPhi, + aod::hf_correlation_d0_hadron::DeltaEta, + aod::hf_correlation_d0_hadron::PtD, + aod::hf_correlation_d0_hadron::PtHadron, + aod::hf_correlation_d0_hadron::PoolBin, + aod::hf_correlation_d0_hadron::CorrelationStatus); + +DECLARE_SOA_TABLE(DHadronRecoInfo, "AOD", "DHADRONRECOINFO", //! D0-Hadrons pairs Reconstructed Informations + aod::hf_correlation_d0_hadron::MD, + aod::hf_correlation_d0_hadron::MDbar, + aod::hf_correlation_d0_hadron::SignalStatus); + +// Note: definition of columns and tables for Lc-Hadron correlation pairs +namespace hf_correlation_lc_hadron +{ +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Lc and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Lc and Hadrons +DECLARE_SOA_COLUMN(PtLc, ptLc, float); //! Transverse momentum of Lc +DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron +DECLARE_SOA_COLUMN(MLc, mLc, float); //! Invariant mass of Lc +DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for LcToPKPi/LcToPiKP +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +} // namespace hf_correlation_lc_hadron + +DECLARE_SOA_TABLE(LcHadronPair, "AOD", "LCHPAIR", //! Lc-Hadrons pairs Informations + aod::hf_correlation_lc_hadron::DeltaPhi, + aod::hf_correlation_lc_hadron::DeltaEta, + aod::hf_correlation_lc_hadron::PtLc, + aod::hf_correlation_lc_hadron::PtHadron, + aod::hf_correlation_lc_hadron::PoolBin); + +DECLARE_SOA_TABLE(LcHadronRecoInfo, "AOD", "LCHRECOINFO", //! Lc-Hadrons pairs Reconstructed Informations + aod::hf_correlation_lc_hadron::MLc, + aod::hf_correlation_lc_hadron::SignalStatus); + +// definition of columns and tables for Ds-Hadron correlation pairs +namespace hf_correlation_ds_hadron +{ +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Ds and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Ds and Hadrons +DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of Ds +DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron +DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of Ds +DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML background score for Ds selection +DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML prompt score for Ds selection +DECLARE_SOA_COLUMN(TrackDcaXY, trackDcaXY, float); //! DCA xy of the track +DECLARE_SOA_COLUMN(TrackDcaZ, trackDcaZ, float); //! DCA z of the track +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(TrackTPCNClsCrossedRows, trackTPCNClsCrossedRows, int); //! Number of crossed TPC Rows +DECLARE_SOA_COLUMN(TrackOrigin, trackOrigin, int); //! Number of crossed TPC Rows +DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! Used in MC-Rec, Ds Signal +DECLARE_SOA_COLUMN(IsDecayChan, isDecayChan, bool); //! Used in MC-Rec, Ds decay channel check +DECLARE_SOA_COLUMN(IsPrompt, isPrompt, bool); //! Used in MC-Rec, Ds Prompt or Non-Prompt +DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); //! Used in MC-Rec, primary associated particles +} // namespace hf_correlation_ds_hadron + +DECLARE_SOA_TABLE(DsHadronPair, "AOD", "DSHPAIR", //! Ds-Hadrons pairs Information + aod::hf_correlation_ds_hadron::DeltaPhi, + aod::hf_correlation_ds_hadron::DeltaEta, + aod::hf_correlation_ds_hadron::PtD, + aod::hf_correlation_ds_hadron::PtHadron, + aod::hf_correlation_ds_hadron::PoolBin); + +DECLARE_SOA_TABLE(DsHadronRecoInfo, "AOD", "DSHRECOINFO", //! Ds-Hadrons pairs Reconstructed Information + aod::hf_correlation_ds_hadron::MD, + aod::hf_correlation_ds_hadron::IsSignal, + aod::hf_correlation_ds_hadron::IsDecayChan); + +DECLARE_SOA_TABLE(DsHadronGenInfo, "AOD", "DSHGENINFO", //! Ds-Hadrons pairs Generated Information + aod::hf_correlation_ds_hadron::IsPrompt, + aod::hf_correlation_ds_hadron::IsPhysicalPrimary, + aod::hf_correlation_ds_hadron::TrackOrigin); + +DECLARE_SOA_TABLE(DsHadronMlInfo, "AOD", "DSHMLINFO", //! Ds-Hadrons pairs Machine Learning Information + aod::hf_correlation_ds_hadron::MlScorePrompt, + aod::hf_correlation_ds_hadron::MlScoreBkg); + +DECLARE_SOA_TABLE(DsCandRecoInfo, "AOD", "DSCANDRECOINFO", //! Ds candidates Reconstructed Information + aod::hf_correlation_ds_hadron::MD, + aod::hf_correlation_ds_hadron::PtD, + aod::hf_correlation_ds_hadron::MlScorePrompt, + aod::hf_correlation_ds_hadron::MlScoreBkg); + +DECLARE_SOA_TABLE(DsCandGenInfo, "AOD", "DSCANDGENOINFO", //! Ds candidates Generated Information + aod::hf_correlation_ds_hadron::IsPrompt); + +DECLARE_SOA_TABLE(TrackRecoInfo, "AOD", "TRACKRECOINFO", //! Tracks Reconstructed Information + aod::hf_correlation_ds_hadron::TrackDcaXY, + aod::hf_correlation_ds_hadron::TrackDcaZ, + aod::hf_correlation_ds_hadron::TrackTPCNClsCrossedRows); + +// definition of columns and tables for Dplus properties +namespace hf_dplus_meson +{ +DECLARE_SOA_COLUMN(Phi, phi, float); //! Phi of D+ +DECLARE_SOA_COLUMN(Eta, eta, float); //! Eta of D+ +DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D+ +DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D+ +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin of event defined using zvtx and multiplicity +DECLARE_SOA_COLUMN(GIndexCol, gIndexCol, int); //! Global index for the collision +DECLARE_SOA_COLUMN(TimeStamp, timeStamp, int64_t); //! Timestamp for the collision +} // namespace hf_dplus_meson + +DECLARE_SOA_TABLE(Dplus, "AOD", "DPLUS", //! D+-meson properties + aod::hf_dplus_meson::Phi, + aod::hf_dplus_meson::Eta, + aod::hf_dplus_meson::PtD, + aod::hf_dplus_meson::MD, + aod::hf_dplus_meson::PoolBin, + aod::hf_dplus_meson::GIndexCol, + aod::hf_dplus_meson::TimeStamp); + +// definition of columns and tables for associated hadron properties +namespace hf_assoc_tracks +{ +DECLARE_SOA_COLUMN(Phi, phi, float); //! Phi of hadron +DECLARE_SOA_COLUMN(Eta, eta, float); //! Eta of hadron +DECLARE_SOA_COLUMN(PtH, ptH, float); //! Transverse momentum of hadron +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin of event defined using zvtx and multiplicity +DECLARE_SOA_COLUMN(GIndexCol, gIndexCol, int); //! Global index for the collision +DECLARE_SOA_COLUMN(TimeStamp, timeStamp, int64_t); //! Timestamp for the collision +} // namespace hf_assoc_tracks + +DECLARE_SOA_TABLE(Hadron, "AOD", "HADRON", //! Associated hadron properties + aod::hf_assoc_tracks::Phi, + aod::hf_assoc_tracks::Eta, + aod::hf_assoc_tracks::PtH, + aod::hf_assoc_tracks::PoolBin, + aod::hf_assoc_tracks::GIndexCol, + aod::hf_assoc_tracks::TimeStamp); + +// definition of columns and tables for Dplus-Hadron correlation pairs +namespace hf_correlation_dplus_hadron +{ +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between D+ and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between D+ and Hadrons +DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D+ +DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron +DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D+ +DECLARE_SOA_COLUMN(SignalStatus, signalStatus, bool); //! Used in MC-Rec, D+ Signal +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin of event defined using zvtx and multiplicity +} // namespace hf_correlation_dplus_hadron + +DECLARE_SOA_TABLE(DplusHadronPair, "AOD", "DPLUSHPAIR", //! D+-Hadrons pairs Informations + aod::hf_correlation_dplus_hadron::DeltaPhi, + aod::hf_correlation_dplus_hadron::DeltaEta, + aod::hf_correlation_dplus_hadron::PtD, + aod::hf_correlation_dplus_hadron::PtHadron, + aod::hf_correlation_dplus_hadron::PoolBin); + +DECLARE_SOA_TABLE(DplusHadronRecoInfo, "AOD", "DPLUSHRECOINFO", //! D+-Hadrons pairs Reconstructed Informations + aod::hf_correlation_dplus_hadron::MD, + aod::hf_correlation_dplus_hadron::SignalStatus); + +// definition of columns and tables for Dstar-Hadron correlation pair +namespace hf_correlation_dstar_hadron +{ +DECLARE_SOA_INDEX_COLUMN(Collision, collision); +// Dstar candidate properties +DECLARE_SOA_INDEX_COLUMN(HfCandDstar, hfCandDstar); +DECLARE_SOA_COLUMN(PhiDstar, phiDstar, float); +DECLARE_SOA_COLUMN(EtaDstar, etaDstar, float); +DECLARE_SOA_COLUMN(PtDstar, ptDstar, float); +DECLARE_SOA_COLUMN(MDstar, mDstar, float); +DECLARE_SOA_COLUMN(MD0, mD0, float); +// DECLARE_SOA_COLUMN(IsPrompt,isPrompt,bool); // although this also defined in (HfCandDstarMcRec HfCandDstarMcRec) tables +// DECLARE_SOA_COLUMN(MatchingStatus, matchingStatus, bool); // although this also defined in (HfCandDstarMcRec HfCandDstarMcRec) tables +// Track properties +DECLARE_SOA_INDEX_COLUMN(Track, track); +DECLARE_SOA_COLUMN(PhiTrack, phiTrack, float); +DECLARE_SOA_COLUMN(EtaTrack, etaTrack, float); +DECLARE_SOA_COLUMN(PtTrack, ptTrack, float); +// common +DECLARE_SOA_COLUMN(TimeStamp, timeStamp, int64_t); +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); +// Dynamic columns +DECLARE_SOA_DYNAMIC_COLUMN(DeltaEta, deltaEta, [](float etaTrack, float etaCandidate) -> float { return (etaTrack - etaCandidate); }); +DECLARE_SOA_DYNAMIC_COLUMN(DeltaPhi, deltaPhi, [](float phiCandidate, float phiTrack) -> float { return RecoDecay::constrainAngle(phiTrack - phiCandidate, -o2::constants::math::PIHalf); }); +DECLARE_SOA_DYNAMIC_COLUMN(DeltaM, deltaM, [](float massDstar, float massD0) -> float { return (massDstar - massD0); }); +} // namespace hf_correlation_dstar_hadron + +DECLARE_SOA_TABLE(DstarHadronPair, "AOD", "DSTRHPAIR", // D* Hadrons pairs Informations + hf_correlation_dstar_hadron::CollisionId, + // D* only properties + hf_correlation_dstar_hadron::HfCandDstarId, + hf_correlation_dstar_hadron::PhiDstar, + hf_correlation_dstar_hadron::EtaDstar, + hf_correlation_dstar_hadron::PtDstar, + hf_correlation_dstar_hadron::MDstar, + hf_correlation_dstar_hadron::MD0, + // Track only properties + hf_correlation_dstar_hadron::TrackId, + hf_correlation_dstar_hadron::PhiTrack, + hf_correlation_dstar_hadron::EtaTrack, + hf_correlation_dstar_hadron::PtTrack, + // common + hf_correlation_dstar_hadron::TimeStamp, + hf_correlation_dstar_hadron::PoolBin, + // common Dynamic + hf_correlation_dstar_hadron::DeltaPhi, + hf_correlation_dstar_hadron::DeltaEta, + hf_correlation_dstar_hadron::DeltaM); + +// Note: Table for selection of Lc in a collision +namespace hf_selection_lc_collision +{ +DECLARE_SOA_COLUMN(LcSel, lcSel, bool); //! Selection flag for Lc in a collision +} // namespace hf_selection_lc_collision + +DECLARE_SOA_TABLE(LcSelection, "AOD", "LCINCOLL", // Selection of Lc in collisions + aod::hf_selection_lc_collision::LcSel); + +// Table for selection of Dmeson in a collision +namespace hf_selection_dmeson_collision +{ +DECLARE_SOA_COLUMN(DmesonSel, dmesonSel, bool); //! Selection flag for D meson in a collision +} // namespace hf_selection_dmeson_collision + +DECLARE_SOA_TABLE(DmesonSelection, "AOD", "DINCOLL", // Selection of D meson in collisions + aod::hf_selection_dmeson_collision::DmesonSel); +} // namespace o2::aod + +#endif // PWGHF_HFC_DATAMODEL_CORRELATIONTABLES_H_ From 2be1b09b5dff86160fc0cd7b23bc5f6901f6d502 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 16 May 2024 20:48:51 +0800 Subject: [PATCH 07/17] Delete PWGHF/HFC/TableProducer/CorrelationTables.h --- PWGHF/HFC/TableProducer/CorrelationTables.h | 307 -------------------- 1 file changed, 307 deletions(-) delete mode 100644 PWGHF/HFC/TableProducer/CorrelationTables.h diff --git a/PWGHF/HFC/TableProducer/CorrelationTables.h b/PWGHF/HFC/TableProducer/CorrelationTables.h deleted file mode 100644 index 7a5097fb12b..00000000000 --- a/PWGHF/HFC/TableProducer/CorrelationTables.h +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file CorrelationTables.h -/// \brief Correlation table definitions. -/// \author Vít Kučera , Inha University - -#ifndef PWGHF_HFC_DATAMODEL_CORRELATIONTABLES_H_ -#define PWGHF_HFC_DATAMODEL_CORRELATIONTABLES_H_ - -#include "CommonConstants/PhysicsConstants.h" -#include "Framework/AnalysisDataModel.h" - -#include "Common/Core/RecoDecay.h" - -#include "PWGHF/DataModel/CandidateReconstructionTables.h" - -namespace o2::aod -{ -// definition of columns and tables for D-Dbar correlation pairs -namespace hf_correlation_d_dbar -{ -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); -DECLARE_SOA_COLUMN(PtD, ptD, float); -DECLARE_SOA_COLUMN(PtDbar, ptDbar, float); -DECLARE_SOA_COLUMN(MD, mD, float); -DECLARE_SOA_COLUMN(MDbar, mDbar, float); -DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); -} // namespace hf_correlation_d_dbar - -DECLARE_SOA_TABLE(DDbarPair, "AOD", "DDBARPAIR", - aod::hf_correlation_d_dbar::DeltaPhi, - aod::hf_correlation_d_dbar::DeltaEta, - aod::hf_correlation_d_dbar::PtD, - aod::hf_correlation_d_dbar::PtDbar); - -DECLARE_SOA_TABLE(DDbarRecoInfo, "AOD", "DDBARRECOINFO", - aod::hf_correlation_d_dbar::MD, - aod::hf_correlation_d_dbar::MDbar, - aod::hf_correlation_d_dbar::SignalStatus); - -// definition of columns and tables for D0-Hadron correlation pairs -namespace hf_correlation_d0_hadron -{ -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between D0 and Hadrons -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between D0 and Hadrons -DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D0 -DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron -DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D0 -DECLARE_SOA_COLUMN(MDbar, mDbar, float); //! Invariant mass of D0bar -DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for D0,D0bar -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent -DECLARE_SOA_COLUMN(CorrelationStatus, correlationStatus, bool); //!Correlation Status - -enum ParticleTypeData { - D0Only = 1, // Identified as D0 - D0barOnly, // Identified as D0bar - D0D0barBoth, // Identified as both D0 and D0bar - D0OnlySoftPi = 11, // Identified as D0 with soft pion - D0barOnlySoftPi, // Identified as D0bar with soft pion - D0D0barBothSoftPi // Identified as both D0 and D0bar with soft pion -}; - -enum ParticleTypeMcRec { - D0Sig = 0, // D0 signal - D0Ref, // D0 reflection - D0Bg, // D0 background - D0barSig, // D0bar signal - D0barRef, // D0bar reflection - D0barBg, // D0bar background - SoftPi // pairs including soft pion -}; -} // namespace hf_correlation_d0_hadron - -DECLARE_SOA_TABLE(DHadronPair, "AOD", "DHADRONPAIR", //! D0-Hadrons pairs Informations - aod::hf_correlation_d0_hadron::DeltaPhi, - aod::hf_correlation_d0_hadron::DeltaEta, - aod::hf_correlation_d0_hadron::PtD, - aod::hf_correlation_d0_hadron::PtHadron, - aod::hf_correlation_d0_hadron::PoolBin, - aod::hf_correlation_d0_hadron::CorrelationStatus); - -DECLARE_SOA_TABLE(DHadronRecoInfo, "AOD", "DHADRONRECOINFO", //! D0-Hadrons pairs Reconstructed Informations - aod::hf_correlation_d0_hadron::MD, - aod::hf_correlation_d0_hadron::MDbar, - aod::hf_correlation_d0_hadron::SignalStatus); - -// Note: definition of columns and tables for Lc-Hadron correlation pairs -namespace hf_correlation_lc_hadron -{ -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Lc and Hadrons -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Lc and Hadrons -DECLARE_SOA_COLUMN(PtLc, ptLc, float); //! Transverse momentum of Lc -DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron -DECLARE_SOA_COLUMN(MLc, mLc, float); //! Invariant mass of Lc -DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for LcToPKPi/LcToPiKP -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent -} // namespace hf_correlation_lc_hadron - -DECLARE_SOA_TABLE(LcHadronPair, "AOD", "LCHPAIR", //! Lc-Hadrons pairs Informations - aod::hf_correlation_lc_hadron::DeltaPhi, - aod::hf_correlation_lc_hadron::DeltaEta, - aod::hf_correlation_lc_hadron::PtLc, - aod::hf_correlation_lc_hadron::PtHadron, - aod::hf_correlation_lc_hadron::PoolBin); - -DECLARE_SOA_TABLE(LcHadronRecoInfo, "AOD", "LCHRECOINFO", //! Lc-Hadrons pairs Reconstructed Informations - aod::hf_correlation_lc_hadron::MLc, - aod::hf_correlation_lc_hadron::SignalStatus); - -// definition of columns and tables for Ds-Hadron correlation pairs -namespace hf_correlation_ds_hadron -{ -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Ds and Hadrons -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Ds and Hadrons -DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of Ds -DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron -DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of Ds -DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML background score for Ds selection -DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML prompt score for Ds selection -DECLARE_SOA_COLUMN(TrackDcaXY, trackDcaXY, float); //! DCA xy of the track -DECLARE_SOA_COLUMN(TrackDcaZ, trackDcaZ, float); //! DCA z of the track -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent -DECLARE_SOA_COLUMN(TrackTPCNClsCrossedRows, trackTPCNClsCrossedRows, int); //! Number of crossed TPC Rows -DECLARE_SOA_COLUMN(TrackOrigin, trackOrigin, int); //! Number of crossed TPC Rows -DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! Used in MC-Rec, Ds Signal -DECLARE_SOA_COLUMN(IsDecayChan, isDecayChan, bool); //! Used in MC-Rec, Ds decay channel check -DECLARE_SOA_COLUMN(IsPrompt, isPrompt, bool); //! Used in MC-Rec, Ds Prompt or Non-Prompt -DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); //! Used in MC-Rec, primary associated particles -} // namespace hf_correlation_ds_hadron - -DECLARE_SOA_TABLE(DsHadronPair, "AOD", "DSHPAIR", //! Ds-Hadrons pairs Information - aod::hf_correlation_ds_hadron::DeltaPhi, - aod::hf_correlation_ds_hadron::DeltaEta, - aod::hf_correlation_ds_hadron::PtD, - aod::hf_correlation_ds_hadron::PtHadron, - aod::hf_correlation_ds_hadron::PoolBin); - -DECLARE_SOA_TABLE(DsHadronRecoInfo, "AOD", "DSHRECOINFO", //! Ds-Hadrons pairs Reconstructed Information - aod::hf_correlation_ds_hadron::MD, - aod::hf_correlation_ds_hadron::IsSignal, - aod::hf_correlation_ds_hadron::IsDecayChan); - -DECLARE_SOA_TABLE(DsHadronGenInfo, "AOD", "DSHGENINFO", //! Ds-Hadrons pairs Generated Information - aod::hf_correlation_ds_hadron::IsPrompt, - aod::hf_correlation_ds_hadron::IsPhysicalPrimary, - aod::hf_correlation_ds_hadron::TrackOrigin); - -DECLARE_SOA_TABLE(DsHadronMlInfo, "AOD", "DSHMLINFO", //! Ds-Hadrons pairs Machine Learning Information - aod::hf_correlation_ds_hadron::MlScorePrompt, - aod::hf_correlation_ds_hadron::MlScoreBkg); - -DECLARE_SOA_TABLE(DsCandRecoInfo, "AOD", "DSCANDRECOINFO", //! Ds candidates Reconstructed Information - aod::hf_correlation_ds_hadron::MD, - aod::hf_correlation_ds_hadron::PtD, - aod::hf_correlation_ds_hadron::MlScorePrompt, - aod::hf_correlation_ds_hadron::MlScoreBkg); - -DECLARE_SOA_TABLE(DsCandGenInfo, "AOD", "DSCANDGENOINFO", //! Ds candidates Generated Information - aod::hf_correlation_ds_hadron::IsPrompt); - -DECLARE_SOA_TABLE(TrackRecoInfo, "AOD", "TRACKRECOINFO", //! Tracks Reconstructed Information - aod::hf_correlation_ds_hadron::TrackDcaXY, - aod::hf_correlation_ds_hadron::TrackDcaZ, - aod::hf_correlation_ds_hadron::TrackTPCNClsCrossedRows); - -// definition of columns and tables for Dplus properties -namespace hf_dplus_meson -{ -DECLARE_SOA_COLUMN(Phi, phi, float); //! Phi of D+ -DECLARE_SOA_COLUMN(Eta, eta, float); //! Eta of D+ -DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D+ -DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D+ -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin of event defined using zvtx and multiplicity -DECLARE_SOA_COLUMN(GIndexCol, gIndexCol, int); //! Global index for the collision -DECLARE_SOA_COLUMN(TimeStamp, timeStamp, int64_t); //! Timestamp for the collision -} // namespace hf_dplus_meson - -DECLARE_SOA_TABLE(Dplus, "AOD", "DPLUS", //! D+-meson properties - aod::hf_dplus_meson::Phi, - aod::hf_dplus_meson::Eta, - aod::hf_dplus_meson::PtD, - aod::hf_dplus_meson::MD, - aod::hf_dplus_meson::PoolBin, - aod::hf_dplus_meson::GIndexCol, - aod::hf_dplus_meson::TimeStamp); - -// definition of columns and tables for associated hadron properties -namespace hf_assoc_tracks -{ -DECLARE_SOA_COLUMN(Phi, phi, float); //! Phi of hadron -DECLARE_SOA_COLUMN(Eta, eta, float); //! Eta of hadron -DECLARE_SOA_COLUMN(PtH, ptH, float); //! Transverse momentum of hadron -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin of event defined using zvtx and multiplicity -DECLARE_SOA_COLUMN(GIndexCol, gIndexCol, int); //! Global index for the collision -DECLARE_SOA_COLUMN(TimeStamp, timeStamp, int64_t); //! Timestamp for the collision -} // namespace hf_assoc_tracks - -DECLARE_SOA_TABLE(Hadron, "AOD", "HADRON", //! Associated hadron properties - aod::hf_assoc_tracks::Phi, - aod::hf_assoc_tracks::Eta, - aod::hf_assoc_tracks::PtH, - aod::hf_assoc_tracks::PoolBin, - aod::hf_assoc_tracks::GIndexCol, - aod::hf_assoc_tracks::TimeStamp); - -// definition of columns and tables for Dplus-Hadron correlation pairs -namespace hf_correlation_dplus_hadron -{ -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between D+ and Hadrons -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between D+ and Hadrons -DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D+ -DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron -DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D+ -DECLARE_SOA_COLUMN(SignalStatus, signalStatus, bool); //! Used in MC-Rec, D+ Signal -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin of event defined using zvtx and multiplicity -} // namespace hf_correlation_dplus_hadron - -DECLARE_SOA_TABLE(DplusHadronPair, "AOD", "DPLUSHPAIR", //! D+-Hadrons pairs Informations - aod::hf_correlation_dplus_hadron::DeltaPhi, - aod::hf_correlation_dplus_hadron::DeltaEta, - aod::hf_correlation_dplus_hadron::PtD, - aod::hf_correlation_dplus_hadron::PtHadron, - aod::hf_correlation_dplus_hadron::PoolBin); - -DECLARE_SOA_TABLE(DplusHadronRecoInfo, "AOD", "DPLUSHRECOINFO", //! D+-Hadrons pairs Reconstructed Informations - aod::hf_correlation_dplus_hadron::MD, - aod::hf_correlation_dplus_hadron::SignalStatus); - -// definition of columns and tables for Dstar-Hadron correlation pair -namespace hf_correlation_dstar_hadron -{ -DECLARE_SOA_INDEX_COLUMN(Collision, collision); -// Dstar candidate properties -DECLARE_SOA_INDEX_COLUMN(HfCandDstar, hfCandDstar); -DECLARE_SOA_COLUMN(PhiDstar, phiDstar, float); -DECLARE_SOA_COLUMN(EtaDstar, etaDstar, float); -DECLARE_SOA_COLUMN(PtDstar, ptDstar, float); -DECLARE_SOA_COLUMN(MDstar, mDstar, float); -DECLARE_SOA_COLUMN(MD0, mD0, float); -// DECLARE_SOA_COLUMN(IsPrompt,isPrompt,bool); // although this also defined in (HfCandDstarMcRec HfCandDstarMcRec) tables -// DECLARE_SOA_COLUMN(MatchingStatus, matchingStatus, bool); // although this also defined in (HfCandDstarMcRec HfCandDstarMcRec) tables -// Track properties -DECLARE_SOA_INDEX_COLUMN(Track, track); -DECLARE_SOA_COLUMN(PhiTrack, phiTrack, float); -DECLARE_SOA_COLUMN(EtaTrack, etaTrack, float); -DECLARE_SOA_COLUMN(PtTrack, ptTrack, float); -// common -DECLARE_SOA_COLUMN(TimeStamp, timeStamp, int64_t); -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); -// Dynamic columns -DECLARE_SOA_DYNAMIC_COLUMN(DeltaEta, deltaEta, [](float etaTrack, float etaCandidate) -> float { return (etaTrack - etaCandidate); }); -DECLARE_SOA_DYNAMIC_COLUMN(DeltaPhi, deltaPhi, [](float phiCandidate, float phiTrack) -> float { return RecoDecay::constrainAngle(phiTrack - phiCandidate, -o2::constants::math::PIHalf); }); -DECLARE_SOA_DYNAMIC_COLUMN(DeltaM, deltaM, [](float massDstar, float massD0) -> float { return (massDstar - massD0); }); -} // namespace hf_correlation_dstar_hadron - -DECLARE_SOA_TABLE(DstarHadronPair, "AOD", "DSTRHPAIR", // D* Hadrons pairs Informations - hf_correlation_dstar_hadron::CollisionId, - // D* only properties - hf_correlation_dstar_hadron::HfCandDstarId, - hf_correlation_dstar_hadron::PhiDstar, - hf_correlation_dstar_hadron::EtaDstar, - hf_correlation_dstar_hadron::PtDstar, - hf_correlation_dstar_hadron::MDstar, - hf_correlation_dstar_hadron::MD0, - // Track only properties - hf_correlation_dstar_hadron::TrackId, - hf_correlation_dstar_hadron::PhiTrack, - hf_correlation_dstar_hadron::EtaTrack, - hf_correlation_dstar_hadron::PtTrack, - // common - hf_correlation_dstar_hadron::TimeStamp, - hf_correlation_dstar_hadron::PoolBin, - // common Dynamic - hf_correlation_dstar_hadron::DeltaPhi, - hf_correlation_dstar_hadron::DeltaEta, - hf_correlation_dstar_hadron::DeltaM); - -// Note: Table for selection of Lc in a collision -namespace hf_selection_lc_collision -{ -DECLARE_SOA_COLUMN(LcSel, lcSel, bool); //! Selection flag for Lc in a collision -} // namespace hf_selection_lc_collision - -DECLARE_SOA_TABLE(LcSelection, "AOD", "LCINCOLL", // Selection of Lc in collisions - aod::hf_selection_lc_collision::LcSel); - -// Table for selection of Dmeson in a collision -namespace hf_selection_dmeson_collision -{ -DECLARE_SOA_COLUMN(DmesonSel, dmesonSel, bool); //! Selection flag for D meson in a collision -} // namespace hf_selection_dmeson_collision - -DECLARE_SOA_TABLE(DmesonSelection, "AOD", "DINCOLL", // Selection of D meson in collisions - aod::hf_selection_dmeson_collision::DmesonSel); -} // namespace o2::aod - -#endif // PWGHF_HFC_DATAMODEL_CORRELATIONTABLES_H_ From cf604a45b4509675ac3e5d476d7bc1f019578b5b Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 16 May 2024 20:49:28 +0800 Subject: [PATCH 08/17] Add files via upload --- PWGHF/HFC/DataModel/CorrelationTables.h | 41 +++++++++++++++++-------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/PWGHF/HFC/DataModel/CorrelationTables.h b/PWGHF/HFC/DataModel/CorrelationTables.h index 2156e9e8553..7a5097fb12b 100644 --- a/PWGHF/HFC/DataModel/CorrelationTables.h +++ b/PWGHF/HFC/DataModel/CorrelationTables.h @@ -120,17 +120,22 @@ DECLARE_SOA_TABLE(LcHadronRecoInfo, "AOD", "LCHRECOINFO", //! Lc-Hadrons pairs R // definition of columns and tables for Ds-Hadron correlation pairs namespace hf_correlation_ds_hadron { -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Ds and Hadrons -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Ds and Hadrons -DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of Ds -DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron -DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of Ds -DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML background score for Ds selection -DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML prompt score for Ds selection -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent -DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! Used in MC-Rec, Ds Signal -DECLARE_SOA_COLUMN(IsPrompt, isPrompt, bool); //! Used in MC-Rec, Ds Prompt or Non-Prompt -DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); //! Used in MC-Rec, primary associated particles +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between Ds and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between Ds and Hadrons +DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of Ds +DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron +DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of Ds +DECLARE_SOA_COLUMN(MlScoreBkg, mlScoreBkg, float); //! ML background score for Ds selection +DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML prompt score for Ds selection +DECLARE_SOA_COLUMN(TrackDcaXY, trackDcaXY, float); //! DCA xy of the track +DECLARE_SOA_COLUMN(TrackDcaZ, trackDcaZ, float); //! DCA z of the track +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(TrackTPCNClsCrossedRows, trackTPCNClsCrossedRows, int); //! Number of crossed TPC Rows +DECLARE_SOA_COLUMN(TrackOrigin, trackOrigin, int); //! Number of crossed TPC Rows +DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! Used in MC-Rec, Ds Signal +DECLARE_SOA_COLUMN(IsDecayChan, isDecayChan, bool); //! Used in MC-Rec, Ds decay channel check +DECLARE_SOA_COLUMN(IsPrompt, isPrompt, bool); //! Used in MC-Rec, Ds Prompt or Non-Prompt +DECLARE_SOA_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, bool); //! Used in MC-Rec, primary associated particles } // namespace hf_correlation_ds_hadron DECLARE_SOA_TABLE(DsHadronPair, "AOD", "DSHPAIR", //! Ds-Hadrons pairs Information @@ -142,11 +147,13 @@ DECLARE_SOA_TABLE(DsHadronPair, "AOD", "DSHPAIR", //! Ds-Hadrons pairs Informati DECLARE_SOA_TABLE(DsHadronRecoInfo, "AOD", "DSHRECOINFO", //! Ds-Hadrons pairs Reconstructed Information aod::hf_correlation_ds_hadron::MD, - aod::hf_correlation_ds_hadron::IsSignal); + aod::hf_correlation_ds_hadron::IsSignal, + aod::hf_correlation_ds_hadron::IsDecayChan); DECLARE_SOA_TABLE(DsHadronGenInfo, "AOD", "DSHGENINFO", //! Ds-Hadrons pairs Generated Information aod::hf_correlation_ds_hadron::IsPrompt, - aod::hf_correlation_ds_hadron::IsPhysicalPrimary); + aod::hf_correlation_ds_hadron::IsPhysicalPrimary, + aod::hf_correlation_ds_hadron::TrackOrigin); DECLARE_SOA_TABLE(DsHadronMlInfo, "AOD", "DSHMLINFO", //! Ds-Hadrons pairs Machine Learning Information aod::hf_correlation_ds_hadron::MlScorePrompt, @@ -158,6 +165,14 @@ DECLARE_SOA_TABLE(DsCandRecoInfo, "AOD", "DSCANDRECOINFO", //! Ds candidates Rec aod::hf_correlation_ds_hadron::MlScorePrompt, aod::hf_correlation_ds_hadron::MlScoreBkg); +DECLARE_SOA_TABLE(DsCandGenInfo, "AOD", "DSCANDGENOINFO", //! Ds candidates Generated Information + aod::hf_correlation_ds_hadron::IsPrompt); + +DECLARE_SOA_TABLE(TrackRecoInfo, "AOD", "TRACKRECOINFO", //! Tracks Reconstructed Information + aod::hf_correlation_ds_hadron::TrackDcaXY, + aod::hf_correlation_ds_hadron::TrackDcaZ, + aod::hf_correlation_ds_hadron::TrackTPCNClsCrossedRows); + // definition of columns and tables for Dplus properties namespace hf_dplus_meson { From ca28c99d487244cf4341d4b2f6d870e00bf2c87a Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 16 May 2024 20:52:24 +0800 Subject: [PATCH 09/17] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index bb91fc4d21a..919f4e3a3f0 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -368,12 +368,12 @@ struct HfCorrelatorD0Hadrons { for (const auto& track : tracks) { registry.fill(HIST("hTrackCounter"), 1); // fill total no. of tracks // Remove D0 daughters by checking track indices - int correlationState = 0; + bool correlationState = false; if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { if (!setCorrelationState) { continue; } - correlationState = 1; + correlationState = true; } if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) continue; // Remove secondary tracks From 410a6d54d4cf5e77122285c5df65fc48b2f3d8cc Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Tue, 21 May 2024 12:55:48 +0800 Subject: [PATCH 10/17] Add files via upload --- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 919f4e3a3f0..c061f0ec4fa 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -368,12 +368,12 @@ struct HfCorrelatorD0Hadrons { for (const auto& track : tracks) { registry.fill(HIST("hTrackCounter"), 1); // fill total no. of tracks // Remove D0 daughters by checking track indices - bool correlationState = false; + bool correlationStatus = false; if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { if (!setCorrelationState) { continue; } - correlationState = true; + correlationStatus = true; } if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) continue; // Remove secondary tracks @@ -422,7 +422,7 @@ struct HfCorrelatorD0Hadrons { candidate1.pt(), track.pt(), poolBin, - correlationState); + correlationStatus); entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), signalStatus); } // end inner loop (tracks) @@ -441,6 +441,10 @@ struct HfCorrelatorD0Hadrons { if (selectedD0candidatesMc.size() == 0) { return; } + // find leading particle + if (correlateD0WithLeadingParticle) { + leadingIndex = findLeadingParticle(tracks); + } int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); int nTracks = 0; if (collision.numContrib() > 1) { @@ -532,8 +536,12 @@ struct HfCorrelatorD0Hadrons { continue; } // Removing D0 daughters by checking track indices + bool correlationStatus = false; if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { - continue; + if (!setCorrelationState) { + continue; + } + correlationStatus = true; } if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) { continue; // Remove secondary tracks @@ -563,6 +571,13 @@ struct HfCorrelatorD0Hadrons { } registry.fill(HIST("hTrackCounterRec"), 3); // fill no. of tracks after soft pion removal + + if (correlateD0WithLeadingParticle) { + if (track.globalIndex() != leadingIndex) { + continue; + } + registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle + } int signalStatus = 0; if (flagD0 && (candidate1.isSelD0() >= selectionFlagD0) && !isSoftPiD0) { @@ -589,7 +604,8 @@ struct HfCorrelatorD0Hadrons { track.eta() - candidate1.eta(), candidate1.pt(), track.pt(), - poolBin); + poolBin, + correlationStatus); entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), signalStatus); } // end inner loop (Tracks) } // end of outer loop (D0) @@ -665,12 +681,14 @@ struct HfCorrelatorD0Hadrons { using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zBins, multBinsMcGen}, true}; int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), getTracksSize(mcCollision))); - + + bool correlationStatus = false; entryD0HadronPair(getDeltaPhi(particle2.phi(), particle1.phi()), particle2.eta() - particle1.eta(), particle1.pt(), particle2.pt(), - poolBin); + poolBin, + correlationStatus); entryD0HadronRecoInfo(massD0, massD0, 0); // dummy info } // end inner loop (Tracks) } // end outer loop (D0) @@ -733,8 +751,8 @@ struct HfCorrelatorD0Hadrons { signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnlySoftPi; } } - - entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin); + bool correlationStatus = false; + entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin,correlationStatus); entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(t1), hfHelper.invMassD0barToKPi(t1), signalStatus); } } @@ -833,9 +851,9 @@ struct HfCorrelatorD0Hadrons { SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); } } // background case D0bar - + bool correlationStatus = false; registry.fill(HIST("hSignalStatusMERec"), signalStatus); - entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin); + entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin,correlationStatus); entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(t1), hfHelper.invMassD0barToKPi(t1), signalStatus); } } @@ -897,7 +915,8 @@ struct HfCorrelatorD0Hadrons { continue; } int poolBin = corrBinningMcGen.getBin(std::make_tuple(c2.posZ(), getTracksSize(c2))); - entryD0HadronPair(getDeltaPhi(t2.phi(), t1.phi()), t2.eta() - t1.eta(), t1.pt(), t2.pt(), poolBin); + bool correlationStatus = false; + entryD0HadronPair(getDeltaPhi(t2.phi(), t1.phi()), t2.eta() - t1.eta(), t1.pt(), t2.pt(), poolBin, correlationStatus); entryD0HadronRecoInfo(massD0, massD0, 0); // dummy info } } From d6f7fda8b4c0936b9a62c0ef89cd013e20bfd15e Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Fri, 24 May 2024 21:00:46 +0800 Subject: [PATCH 11/17] Add files via upload --- PWGHF/HFC/DataModel/CorrelationTables.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/PWGHF/HFC/DataModel/CorrelationTables.h b/PWGHF/HFC/DataModel/CorrelationTables.h index 7a5097fb12b..bc98d53d00e 100644 --- a/PWGHF/HFC/DataModel/CorrelationTables.h +++ b/PWGHF/HFC/DataModel/CorrelationTables.h @@ -51,15 +51,15 @@ DECLARE_SOA_TABLE(DDbarRecoInfo, "AOD", "DDBARRECOINFO", // definition of columns and tables for D0-Hadron correlation pairs namespace hf_correlation_d0_hadron { -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between D0 and Hadrons -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between D0 and Hadrons -DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D0 -DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron -DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D0 -DECLARE_SOA_COLUMN(MDbar, mDbar, float); //! Invariant mass of D0bar -DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for D0,D0bar -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent -DECLARE_SOA_COLUMN(CorrelationStatus, correlationStatus, bool); //!Correlation Status +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between D0 and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between D0 and Hadrons +DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D0 +DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron +DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D0 +DECLARE_SOA_COLUMN(MDbar, mDbar, float); //! Invariant mass of D0bar +DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for D0,D0bar +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(CorrelationStatus, correlationStatus, bool); //! Correlation Status enum ParticleTypeData { D0Only = 1, // Identified as D0 From c403b841b905874590489ec57501ba380a7fa70a Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Fri, 24 May 2024 21:01:38 +0800 Subject: [PATCH 12/17] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index c061f0ec4fa..d513e931047 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -571,7 +571,7 @@ struct HfCorrelatorD0Hadrons { } registry.fill(HIST("hTrackCounterRec"), 3); // fill no. of tracks after soft pion removal - + if (correlateD0WithLeadingParticle) { if (track.globalIndex() != leadingIndex) { continue; @@ -681,7 +681,7 @@ struct HfCorrelatorD0Hadrons { using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zBins, multBinsMcGen}, true}; int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), getTracksSize(mcCollision))); - + bool correlationStatus = false; entryD0HadronPair(getDeltaPhi(particle2.phi(), particle1.phi()), particle2.eta() - particle1.eta(), @@ -752,7 +752,7 @@ struct HfCorrelatorD0Hadrons { } } bool correlationStatus = false; - entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin,correlationStatus); + entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin, correlationStatus); entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(t1), hfHelper.invMassD0barToKPi(t1), signalStatus); } } @@ -851,9 +851,9 @@ struct HfCorrelatorD0Hadrons { SETBIT(signalStatus, aod::hf_correlation_d0_hadron::ParticleTypeMcRec::SoftPi); } } // background case D0bar - bool correlationStatus = false; registry.fill(HIST("hSignalStatusMERec"), signalStatus); - entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin,correlationStatus); + bool correlationStatus = false; + entryD0HadronPair(getDeltaPhi(t1.phi(), t2.phi()), t1.eta() - t2.eta(), t1.pt(), t2.pt(), poolBin, correlationStatus); entryD0HadronRecoInfo(hfHelper.invMassD0ToPiK(t1), hfHelper.invMassD0barToKPi(t1), signalStatus); } } From acc1e7885427bab6e2be9b05ddbda3d7fb1fee91 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Fri, 24 May 2024 21:02:42 +0800 Subject: [PATCH 13/17] Add files via upload --- PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx | 21 +++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx index c6f732c2d62..e96a285a2be 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx @@ -52,6 +52,8 @@ AxisSpec axisDeltaPhi = {64, -o2::constants::math::PIHalf, 3. * o2::constants::m AxisSpec axisPtD = {10, 0., 10., ""}; AxisSpec axisPtHadron = {11, 0., 11., ""}; AxisSpec axisPoolBin = {9, 0., 9., ""}; +AxisSpec axisInvmass = {200, 1.3848, 2.3848, ""}; +AxisSpec axisCorrelationState = {2, 0., 1., ""}; // definition of vectors for standard ptbin and invariant mass configurables const int nPtBinsCorrelations = 12; @@ -165,8 +167,9 @@ struct HfTaskCorrelationD0Hadrons { {"hCorrel2DVsPtGen", stringMcParticles + stringDeltaPhi + stringDeltaEta + stringPtD + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtD}, {axisPtHadron}, {axisPoolBin}}}}, // note: axes 3 and 4 (the pT) are updated in the init(), {"hCorrel2DPtIntGen", stringMcParticles + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{axisDeltaPhi}, {axisDeltaEta}}}}, {"hDeltaEtaPtIntGen", stringMcParticles + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}}, - {"hDeltaPhiPtIntGen", stringMcParticles + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}}}}; - + {"hDeltaPhiPtIntGen", stringMcParticles + stringDeltaPhi + "entries", {HistType::kTH1F, {axisDeltaPhi}}}, + // Toward Transverse Away + {"hCorInfoWithCorrelationState", stringDHadron + stringDeltaPhi + stringDeltaEta + stringPtD + stringPtHadron + "entries", {HistType::kTHnSparseD, {{axisDeltaPhi}, {axisDeltaEta}, {axisPtD}, {axisPtHadron}, {axisPoolBin}, {axisInvmass}, {axisCorrelationState}}}}}}; void init(InitContext&) { int nBinsPtAxis = binsCorrelations->size() - 1; @@ -227,6 +230,7 @@ struct HfTaskCorrelationD0Hadrons { int effBinD = o2::analysis::findBin(binsEfficiency, ptD); int ptBinD = o2::analysis::findBin(binsCorrelations, ptD); int poolBin = pairEntry.poolBin(); + bool correlationStatus = pairEntry.correlationStatus(); // reject entries outside pT ranges of interest if (ptBinD < 0 || effBinD < 0) { @@ -240,16 +244,23 @@ struct HfTaskCorrelationD0Hadrons { if (applyEfficiency) { efficiencyWeight = 1. / (efficiencyDmeson->at(o2::analysis::findBin(binsEfficiency, ptD))); // ***** track efficiency to be implemented ***** } - // reject entries outside pT ranges of interest if (ptBinD == -1) { // at least one particle outside accepted pT range continue; } + //============================================================================================================== + + if (signalStatus == ParticleTypeData::D0Only || (signalStatus == ParticleTypeData::D0D0barBoth)) { + registry.fill(HIST("hCorInfoCorrelationState"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, massD, correlationStatus); + } + if (signalStatus == ParticleTypeData::D0barOnly || (signalStatus == ParticleTypeData::D0D0barBoth)) { + registry.fill(HIST("hCorInfoCorrelationState"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, massDbar, correlationStatus); + } // check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots if ((massD > signalRegionLeft->at(ptBinD) && massD < signalRegionRight->at(ptBinD)) && ((signalStatus == ParticleTypeData::D0Only) || (signalStatus == ParticleTypeData::D0D0barBoth))) { // in signal region - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); - registry.fill(HIST("hCorrel2DPtIntSignalRegion"), deltaPhi, deltaEta, efficiencyWeight); + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); + registry.fill(HIST("hCorrel2DPtIntSignalRegion"), deltaPhi, deltaEta); registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); } From 191bacd84750783e948bbf07ed858613d9f9d19e Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Fri, 24 May 2024 21:06:57 +0800 Subject: [PATCH 14/17] Add files via upload --- PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx index e96a285a2be..9578a2d22de 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx @@ -251,16 +251,16 @@ struct HfTaskCorrelationD0Hadrons { //============================================================================================================== if (signalStatus == ParticleTypeData::D0Only || (signalStatus == ParticleTypeData::D0D0barBoth)) { - registry.fill(HIST("hCorInfoCorrelationState"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, massD, correlationStatus); + registry.fill(HIST("hCorInfoCorrelationState"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, massD, correlationStatus, efficiencyWeight); } if (signalStatus == ParticleTypeData::D0barOnly || (signalStatus == ParticleTypeData::D0D0barBoth)) { - registry.fill(HIST("hCorInfoCorrelationState"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, massDbar, correlationStatus); + registry.fill(HIST("hCorInfoCorrelationState"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, massDbar, correlationStatus, efficiencyWeight); } // check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots if ((massD > signalRegionLeft->at(ptBinD) && massD < signalRegionRight->at(ptBinD)) && ((signalStatus == ParticleTypeData::D0Only) || (signalStatus == ParticleTypeData::D0D0barBoth))) { // in signal region - registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); - registry.fill(HIST("hCorrel2DPtIntSignalRegion"), deltaPhi, deltaEta); + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, efficiencyWeight); + registry.fill(HIST("hCorrel2DPtIntSignalRegion"), deltaPhi, deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta, efficiencyWeight); registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi, efficiencyWeight); } From 9ff925ef8a38a7fd727b2384278ba2751babd26f Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 30 May 2024 16:50:50 +0800 Subject: [PATCH 15/17] Add files via upload --- PWGHF/HFC/DataModel/CorrelationTables.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PWGHF/HFC/DataModel/CorrelationTables.h b/PWGHF/HFC/DataModel/CorrelationTables.h index bc98d53d00e..1b27b45f24e 100644 --- a/PWGHF/HFC/DataModel/CorrelationTables.h +++ b/PWGHF/HFC/DataModel/CorrelationTables.h @@ -51,15 +51,15 @@ DECLARE_SOA_TABLE(DDbarRecoInfo, "AOD", "DDBARRECOINFO", // definition of columns and tables for D0-Hadron correlation pairs namespace hf_correlation_d0_hadron { -DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between D0 and Hadrons -DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between D0 and Hadrons -DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D0 -DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron -DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D0 -DECLARE_SOA_COLUMN(MDbar, mDbar, float); //! Invariant mass of D0bar -DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for D0,D0bar -DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent -DECLARE_SOA_COLUMN(CorrelationStatus, correlationStatus, bool); //! Correlation Status +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DeltaPhi between D0 and Hadrons +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); //! DeltaEta between D0 and Hadrons +DECLARE_SOA_COLUMN(PtD, ptD, float); //! Transverse momentum of D0 +DECLARE_SOA_COLUMN(PtHadron, ptHadron, float); //! Transverse momentum of Hadron +DECLARE_SOA_COLUMN(MD, mD, float); //! Invariant mass of D0 +DECLARE_SOA_COLUMN(MDbar, mDbar, float); //! Invariant mass of D0bar +DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); //! Tag for D0,D0bar +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(IsAutoCorrelated, isAutoCorrelated, bool); //! Correlation Status enum ParticleTypeData { D0Only = 1, // Identified as D0 @@ -87,7 +87,7 @@ DECLARE_SOA_TABLE(DHadronPair, "AOD", "DHADRONPAIR", //! D0-Hadrons pairs Inform aod::hf_correlation_d0_hadron::PtD, aod::hf_correlation_d0_hadron::PtHadron, aod::hf_correlation_d0_hadron::PoolBin, - aod::hf_correlation_d0_hadron::CorrelationStatus); + aod::hf_correlation_d0_hadron::IsAutoCorrelated); DECLARE_SOA_TABLE(DHadronRecoInfo, "AOD", "DHADRONRECOINFO", //! D0-Hadrons pairs Reconstructed Informations aod::hf_correlation_d0_hadron::MD, From aaac14eacf1f138afa943e5ad9d06e23a6c7d841 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 30 May 2024 16:52:51 +0800 Subject: [PATCH 16/17] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index d513e931047..881f01f24b4 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -185,7 +185,7 @@ struct HfCorrelatorD0Hadrons { Configurable multMax{"multMax", 10000., "maximum multiplicity accepted"}; Configurable ptSoftPionMax{"ptSoftPionMax", 3 * 800. * pow(10., -6.), "max. pT cut for soft pion identification"}; Configurable correlateD0WithLeadingParticle{"correlateD0WithLeadingParticle", false, "Switch for correlation of D0 mesons with leading particle only"}; - Configurable setCorrelationState{"setCorrelationState", false, "Set correlation state"}; + Configurable storeAutoCorrelationFlag{"storeAutoCorrelationFlag", false, "Store flag that indicates if the track is paired to its D-meson mother instead of skipping it"}; HfHelper hfHelper; @@ -370,7 +370,7 @@ struct HfCorrelatorD0Hadrons { // Remove D0 daughters by checking track indices bool correlationStatus = false; if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { - if (!setCorrelationState) { + if (!storeAutoCorrelationFlag) { continue; } correlationStatus = true; @@ -538,7 +538,7 @@ struct HfCorrelatorD0Hadrons { // Removing D0 daughters by checking track indices bool correlationStatus = false; if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { - if (!setCorrelationState) { + if (!storeAutoCorrelationFlag) { continue; } correlationStatus = true; From 321a528aeebb990b46fd982d326418f2c4701ccb Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 30 May 2024 16:53:54 +0800 Subject: [PATCH 17/17] Add files via upload --- PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx index 9578a2d22de..353328e4a88 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx @@ -230,7 +230,7 @@ struct HfTaskCorrelationD0Hadrons { int effBinD = o2::analysis::findBin(binsEfficiency, ptD); int ptBinD = o2::analysis::findBin(binsCorrelations, ptD); int poolBin = pairEntry.poolBin(); - bool correlationStatus = pairEntry.correlationStatus(); + bool isAutoCorrelated = pairEntry.isAutoCorrelated(); // reject entries outside pT ranges of interest if (ptBinD < 0 || effBinD < 0) { @@ -249,12 +249,11 @@ struct HfTaskCorrelationD0Hadrons { continue; } //============================================================================================================== - if (signalStatus == ParticleTypeData::D0Only || (signalStatus == ParticleTypeData::D0D0barBoth)) { - registry.fill(HIST("hCorInfoCorrelationState"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, massD, correlationStatus, efficiencyWeight); + registry.fill(HIST("hCorInfoWithCorrelationState"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, massD, isAutoCorrelated, efficiencyWeight); } if (signalStatus == ParticleTypeData::D0barOnly || (signalStatus == ParticleTypeData::D0D0barBoth)) { - registry.fill(HIST("hCorInfoCorrelationState"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, massDbar, correlationStatus, efficiencyWeight); + registry.fill(HIST("hCorInfoWithCorrelationState"), deltaPhi, deltaEta, ptD, ptHadron, poolBin, massDbar, isAutoCorrelated, efficiencyWeight); } // check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots if ((massD > signalRegionLeft->at(ptBinD) && massD < signalRegionRight->at(ptBinD)) && ((signalStatus == ParticleTypeData::D0Only) || (signalStatus == ParticleTypeData::D0D0barBoth))) {