From 89262f701d8d8b9754c51625859be724b6691dd4 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Tue, 12 Mar 2024 21:13:14 +0800 Subject: [PATCH 01/26] Add files via upload --- .../HFC/TableProducer/correlatorHadronsD0.cxx | 185 ++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 PWGHF/HFC/TableProducer/correlatorHadronsD0.cxx diff --git a/PWGHF/HFC/TableProducer/correlatorHadronsD0.cxx b/PWGHF/HFC/TableProducer/correlatorHadronsD0.cxx new file mode 100644 index 00000000000..a6375ad1c69 --- /dev/null +++ b/PWGHF/HFC/TableProducer/correlatorHadronsD0.cxx @@ -0,0 +1,185 @@ +// 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. + +/// \author Xu wang . +#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::aod; +using namespace o2::analysis; +using namespace o2::aod::hf_cand_2prong; +using namespace o2::constants::physics; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2::aod +{ +/// _________________________________________ +/// Table for storing trigger track indices +namespace triggerTracks +{ +DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! +DECLARE_SOA_INDEX_COLUMN_FULL(Track, track, int, Tracks, "_Trigger"); //! +} // namespace triggerTracks +DECLARE_SOA_TABLE(TriggerTracks, "AOD", "TRIGGERTRACKS", o2::soa::Index<>, triggerTracks::CollisionId, triggerTracks::TrackId); +} // namespace o2::aod +/// _________________________________________ +/// Table for storing assoc track indices + +// histogram binning definition +const int massAxisNBins = 200; +const double massAxisMin = 1.3848; +const double massAxisMax = 2.3848; +AxisSpec axisDeltaEta = {100, -2., 2., ""}; +AxisSpec axisDeltaPhi = {64, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf, ""}; +AxisSpec axisPtD = {10, 0., 10., ""}; +AxisSpec axisPtHadron = {11, 0., 11., ""}; +AxisSpec axisPoolBin = {9, 0., 9., ""}; +std::vector axes = {axisDeltaPhi, axisDeltaEta, axisPtD, axisPtHadron, axisPoolBin}; + +// 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}; + +double getDeltaPhi(double phiHadron, double phiD) +{ + return RecoDecay::constrainAngle(phiD - phiHadron, -o2::constants::math::PIHalf); +} + +struct HfCorrelatorHadronsD0Selection { + Produces d0Sel; + Produces triggerTrack; + + 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"}; + Configurable triggerEtaMin{"triggerEtaCutMin", -0.8, "triggeretamin"}; + Configurable triggerEtaMax{"triggerEtaCutMax", 0.8, "triggeretamax"}; + Configurable triggerPtCutMin{"triggerPtCutMin", 3, "triggerptmin"}; + Configurable triggerPtCutMax{"triggerPtCutMax", 20, "triggerptmax"}; + + HfHelper hfHelper; + SliceCache cache; + + Preslice perCol = aod::hf_cand::collisionId; + Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + + void init(InitContext&) + { + } + + void processD0SelectionData(aod::Collision const& collision, soa::Join const& candidates) + { + 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(HfCorrelatorHadronsD0Selection, processD0SelectionData, "Process D0 Selection Data", false); + + void processTriggerHardons(aod::Collision const& collision, aod::TracksWDca const& tracks) + { + for (auto const& track : tracks) { + if (track.eta() > triggerEtaMax || track.eta() < triggerEtaMin) { + continue; + } + if (track.pt() > triggerPtCutMax || track.pt() < triggerPtCutMin) { + continue; + } + triggerTrack(track.collisionId(), track.globalIndex()); + } + } + PROCESS_SWITCH(HfCorrelatorHadronsD0Selection, processTriggerHardons, "Process Hadrons Trigger Selection Data", false); +}; + +struct HfCorrelatorHadronsD0 { + + SliceCache cache; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; + Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; + + Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + Filter collisionFilter = aod::hf_selection_dmeson_collision::dmesonSel == true; + Filter d0Filter = (aod::hf_sel_candidate_d0::isSelD0 >= 1) || (aod::hf_sel_candidate_d0::isSelD0bar >= 1); + + void init(InitContext&) + { + histos.add("CorrelatorHadronsD0", "", kTHnF, axes); + histos.add("hMass1D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); + histos.add("hMassD01D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); + histos.add("hMassD0bar1D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); + }; + + void processCorrelatorHadronD0(soa::Join::iterator const& collision, + aod::TracksWDca const& tracks, + soa::Join const& candidates, + aod::TriggerTracks const& triggers) + { + int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); + for (auto& triggerTrack : triggers) { + auto trigg = triggerTrack.track_as(); + auto selectedD0CandidatesGrouped = selectedD0Candidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + for (const auto& candidate1 : selectedD0CandidatesGrouped) { + // Remove D0 daughters by checking track indices + if ((candidate1.prong0Id() == trigg.globalIndex()) || (candidate1.prong1Id() == trigg.globalIndex())) { + continue; + } + float deltaPhi = getDeltaPhi(trigg.phi(), candidate1.phi()); + float deltaEta = trigg.eta() - candidate1.eta(); + float ptCandidate = candidate1.pt(); + float ptTrigger = trigg.pt(); + histos.fill(HIST("CorrelatorHadronsD0"), deltaPhi, deltaEta, ptCandidate, ptTrigger, poolBin); + } + } + } + PROCESS_SWITCH(HfCorrelatorHadronsD0, processCorrelatorHadronD0, "HfCorrelatorHadronsD0", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; +} From 93d66f3b94fed332e8695ad5ce5318842360b9d0 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Wed, 10 Apr 2024 07:39:13 +0800 Subject: [PATCH 02/26] Add files via upload --- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index da890154128..34f0d4b2382 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -184,9 +184,11 @@ struct HfCorrelatorD0Hadrons { 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 findLeadingParticleSwitch{"FindLeadingParticleSwitch", 0, "Find Leading Particle Switch"}; + Configurable correlationD0LeadingParticle{"CorrelationD0LeadingParticle", 0, "Correlation D0 Leading Particle witch"}; HfHelper hfHelper; - + + int leadingIndex = 0; double massD0{0.}; double massPi{0.}; double massK{0.}; @@ -262,8 +264,24 @@ struct HfCorrelatorD0Hadrons { // 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})"}}}); + // leading partical information + registry.add("hLeadingParticalD0","deltaPhi deltaEta leadingPt D0Pt poolbin",{HistType::kTHnF,{{32,0.,o2::constants::math::TwoPI},{100,-2.,2.},{180,0.,18.},{180,0.,18.},{1000,0,1000}}}); } - + //Find Leading Particle + int findLeadingParticle(soa::Join::iterator const& collision, + aod::TracksWDca 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) @@ -275,6 +293,11 @@ struct HfCorrelatorD0Hadrons { if (selectedD0Candidates.size() == 0) { return; } + //find leading particle + if(findLeadingParticleSwitch){ + leadingIndex = findLeadingParticle( collision , tracks); + } + int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); int nTracks = 0; if (collision.numContrib() > 1) { @@ -337,7 +360,14 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hY"), hfHelper.yD0(candidate1)); registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); registry.fill(HIST("hD0Bin"), poolBin); - + //====================correlation D0 leading particle=============================== + if(correlationD0LeadingParticle){ + for (auto const& track : tracks){ + if(track.globalIndex() == leadingIndex ){ + registry.fill(HIST("hLeadingParticalD0"), getDeltaPhi(track.phi(), candidate1.phi()),track.eta() - candidate1.eta(),track.pt(),candidate1.pt(),poolBin); + } + } + } // ============ D-h correlation dedicated section ================================== // ========================== track loop starts here ================================ From e2c184321aebd63bbc928760c3f77e7d1cbde5b2 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Wed, 10 Apr 2024 07:51:37 +0800 Subject: [PATCH 03/26] Delete PWGHF/HFC/TableProducer/correlatorHadronsD0.cxx --- .../HFC/TableProducer/correlatorHadronsD0.cxx | 185 ------------------ 1 file changed, 185 deletions(-) delete mode 100644 PWGHF/HFC/TableProducer/correlatorHadronsD0.cxx diff --git a/PWGHF/HFC/TableProducer/correlatorHadronsD0.cxx b/PWGHF/HFC/TableProducer/correlatorHadronsD0.cxx deleted file mode 100644 index a6375ad1c69..00000000000 --- a/PWGHF/HFC/TableProducer/correlatorHadronsD0.cxx +++ /dev/null @@ -1,185 +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. - -/// \author Xu wang . -#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::aod; -using namespace o2::analysis; -using namespace o2::aod::hf_cand_2prong; -using namespace o2::constants::physics; -using namespace o2::framework; -using namespace o2::framework::expressions; - -namespace o2::aod -{ -/// _________________________________________ -/// Table for storing trigger track indices -namespace triggerTracks -{ -DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! -DECLARE_SOA_INDEX_COLUMN_FULL(Track, track, int, Tracks, "_Trigger"); //! -} // namespace triggerTracks -DECLARE_SOA_TABLE(TriggerTracks, "AOD", "TRIGGERTRACKS", o2::soa::Index<>, triggerTracks::CollisionId, triggerTracks::TrackId); -} // namespace o2::aod -/// _________________________________________ -/// Table for storing assoc track indices - -// histogram binning definition -const int massAxisNBins = 200; -const double massAxisMin = 1.3848; -const double massAxisMax = 2.3848; -AxisSpec axisDeltaEta = {100, -2., 2., ""}; -AxisSpec axisDeltaPhi = {64, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf, ""}; -AxisSpec axisPtD = {10, 0., 10., ""}; -AxisSpec axisPtHadron = {11, 0., 11., ""}; -AxisSpec axisPoolBin = {9, 0., 9., ""}; -std::vector axes = {axisDeltaPhi, axisDeltaEta, axisPtD, axisPtHadron, axisPoolBin}; - -// 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}; - -double getDeltaPhi(double phiHadron, double phiD) -{ - return RecoDecay::constrainAngle(phiD - phiHadron, -o2::constants::math::PIHalf); -} - -struct HfCorrelatorHadronsD0Selection { - Produces d0Sel; - Produces triggerTrack; - - 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"}; - Configurable triggerEtaMin{"triggerEtaCutMin", -0.8, "triggeretamin"}; - Configurable triggerEtaMax{"triggerEtaCutMax", 0.8, "triggeretamax"}; - Configurable triggerPtCutMin{"triggerPtCutMin", 3, "triggerptmin"}; - Configurable triggerPtCutMax{"triggerPtCutMax", 20, "triggerptmax"}; - - HfHelper hfHelper; - SliceCache cache; - - Preslice perCol = aod::hf_cand::collisionId; - Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - - void init(InitContext&) - { - } - - void processD0SelectionData(aod::Collision const& collision, soa::Join const& candidates) - { - 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(HfCorrelatorHadronsD0Selection, processD0SelectionData, "Process D0 Selection Data", false); - - void processTriggerHardons(aod::Collision const& collision, aod::TracksWDca const& tracks) - { - for (auto const& track : tracks) { - if (track.eta() > triggerEtaMax || track.eta() < triggerEtaMin) { - continue; - } - if (track.pt() > triggerPtCutMax || track.pt() < triggerPtCutMin) { - continue; - } - triggerTrack(track.collisionId(), track.globalIndex()); - } - } - PROCESS_SWITCH(HfCorrelatorHadronsD0Selection, processTriggerHardons, "Process Hadrons Trigger Selection Data", false); -}; - -struct HfCorrelatorHadronsD0 { - - SliceCache cache; - HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - - Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; - Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; - - Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - Filter collisionFilter = aod::hf_selection_dmeson_collision::dmesonSel == true; - Filter d0Filter = (aod::hf_sel_candidate_d0::isSelD0 >= 1) || (aod::hf_sel_candidate_d0::isSelD0bar >= 1); - - void init(InitContext&) - { - histos.add("CorrelatorHadronsD0", "", kTHnF, axes); - histos.add("hMass1D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); - histos.add("hMassD01D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); - histos.add("hMassD0bar1D", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{massAxisNBins, massAxisMin, massAxisMax}}}); - }; - - void processCorrelatorHadronD0(soa::Join::iterator const& collision, - aod::TracksWDca const& tracks, - soa::Join const& candidates, - aod::TriggerTracks const& triggers) - { - int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); - for (auto& triggerTrack : triggers) { - auto trigg = triggerTrack.track_as(); - auto selectedD0CandidatesGrouped = selectedD0Candidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); - for (const auto& candidate1 : selectedD0CandidatesGrouped) { - // Remove D0 daughters by checking track indices - if ((candidate1.prong0Id() == trigg.globalIndex()) || (candidate1.prong1Id() == trigg.globalIndex())) { - continue; - } - float deltaPhi = getDeltaPhi(trigg.phi(), candidate1.phi()); - float deltaEta = trigg.eta() - candidate1.eta(); - float ptCandidate = candidate1.pt(); - float ptTrigger = trigg.pt(); - histos.fill(HIST("CorrelatorHadronsD0"), deltaPhi, deltaEta, ptCandidate, ptTrigger, poolBin); - } - } - } - PROCESS_SWITCH(HfCorrelatorHadronsD0, processCorrelatorHadronD0, "HfCorrelatorHadronsD0", true); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; -} From 3abc3d2cdfb57304188e3b1a37e27a0281049ec1 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Wed, 10 Apr 2024 07:57:04 +0800 Subject: [PATCH 04/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 34f0d4b2382..8108065b2a6 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -187,7 +187,7 @@ struct HfCorrelatorD0Hadrons { Configurable findLeadingParticleSwitch{"FindLeadingParticleSwitch", 0, "Find Leading Particle Switch"}; Configurable correlationD0LeadingParticle{"CorrelationD0LeadingParticle", 0, "Correlation D0 Leading Particle witch"}; HfHelper hfHelper; - + int leadingIndex = 0; double massD0{0.}; double massPi{0.}; @@ -264,11 +264,11 @@ struct HfCorrelatorD0Hadrons { // 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})"}}}); - // leading partical information + // leading partical information registry.add("hLeadingParticalD0","deltaPhi deltaEta leadingPt D0Pt poolbin",{HistType::kTHnF,{{32,0.,o2::constants::math::TwoPI},{100,-2.,2.},{180,0.,18.},{180,0.,18.},{1000,0,1000}}}); } //Find Leading Particle - int findLeadingParticle(soa::Join::iterator const& collision, + int findLeadingParticle(soa::Join::iterator const& collision, aod::TracksWDca const& tracks) { auto leadingParticle = tracks.begin(); @@ -294,7 +294,7 @@ struct HfCorrelatorD0Hadrons { return; } //find leading particle - if(findLeadingParticleSwitch){ + if(findLeadingParticleSwitch){ leadingIndex = findLeadingParticle( collision , tracks); } From 310b2cf27b034ed12877a2485a787c6d4af43220 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:07:54 +0800 Subject: [PATCH 05/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 8108065b2a6..33e9436406b 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -281,7 +281,7 @@ struct HfCorrelatorD0Hadrons { } 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) From 54b797af95c317f3e4766c6f678c85eebcc81d49 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:12:37 +0800 Subject: [PATCH 06/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 33e9436406b..5b1319f8f8e 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -265,7 +265,7 @@ struct HfCorrelatorD0Hadrons { 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})"}}}); // leading partical information - registry.add("hLeadingParticalD0","deltaPhi deltaEta leadingPt D0Pt poolbin",{HistType::kTHnF,{{32,0.,o2::constants::math::TwoPI},{100,-2.,2.},{180,0.,18.},{180,0.,18.},{1000,0,1000}}}); + registry.add("hLeadingParticalD0","deltaPhi deltaEta leadingPt D0Pt poolbin",{HistType::kTHnF,{{32,0.,o2::constants::math::TwoPI},{100,-2.,2.},{180,0.,18.},{180,0.,18.},{10,0,10}}}); } //Find Leading Particle int findLeadingParticle(soa::Join::iterator const& collision, From c76a7b21e1172b736c9dd633cc63aa988eada0b7 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:28:51 +0800 Subject: [PATCH 07/26] Add files via upload --- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 5b1319f8f8e..705bc4d2753 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -265,22 +265,22 @@ struct HfCorrelatorD0Hadrons { 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})"}}}); // leading partical information - registry.add("hLeadingParticalD0","deltaPhi deltaEta leadingPt D0Pt poolbin",{HistType::kTHnF,{{32,0.,o2::constants::math::TwoPI},{100,-2.,2.},{180,0.,18.},{180,0.,18.},{10,0,10}}}); + registry.add("hLeadingParticalD0", "deltaPhi deltaEta leadingPt D0Pt poolbin", {HistType::kTHnF, {{32, 0., o2::constants::math::TwoPI}, {100, -2., 2.}, {180, 0., 18.}, {180, 0., 18.}, {10, 0, 10}}}); } - //Find Leading Particle + // Find Leading Particle int findLeadingParticle(soa::Join::iterator const& collision, - aod::TracksWDca const& tracks) + aod::TracksWDca const& tracks) { - auto leadingParticle = tracks.begin(); - for (auto const& track : tracks) { + auto leadingParticle = tracks.begin(); + for (auto const& track : tracks) { if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) - continue; + continue; if (track.pt() > leadingParticle.pt()) { leadingParticle = track; } - } - int leadingIndex = leadingParticle.globalIndex(); - return leadingIndex; + } + int leadingIndex = leadingParticle.globalIndex(); + return leadingIndex; } // ======= Process starts for Data, Same event ============ @@ -293,9 +293,9 @@ struct HfCorrelatorD0Hadrons { if (selectedD0Candidates.size() == 0) { return; } - //find leading particle - if(findLeadingParticleSwitch){ - leadingIndex = findLeadingParticle( collision , tracks); + // find leading particle + if (findLeadingParticleSwitch) { + leadingIndex = findLeadingParticle(collision, tracks); } int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); @@ -361,10 +361,10 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); registry.fill(HIST("hD0Bin"), poolBin); //====================correlation D0 leading particle=============================== - if(correlationD0LeadingParticle){ - for (auto const& track : tracks){ - if(track.globalIndex() == leadingIndex ){ - registry.fill(HIST("hLeadingParticalD0"), getDeltaPhi(track.phi(), candidate1.phi()),track.eta() - candidate1.eta(),track.pt(),candidate1.pt(),poolBin); + if (correlationD0LeadingParticle) { + for (auto const& track : tracks) { + if (track.globalIndex() == leadingIndex) { + registry.fill(HIST("hLeadingParticalD0"), getDeltaPhi(track.phi(), candidate1.phi()), track.eta() - candidate1.eta(), track.pt(), candidate1.pt(), poolBin); } } } From ded828d1ee4313990d3b3b8ff0334b3df840b90f Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Wed, 10 Apr 2024 10:52:28 +0800 Subject: [PATCH 08/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 705bc4d2753..cbd019e206c 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -265,7 +265,7 @@ struct HfCorrelatorD0Hadrons { 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})"}}}); // leading partical information - registry.add("hLeadingParticalD0", "deltaPhi deltaEta leadingPt D0Pt poolbin", {HistType::kTHnF, {{32, 0., o2::constants::math::TwoPI}, {100, -2., 2.}, {180, 0., 18.}, {180, 0., 18.}, {10, 0, 10}}}); + registry.add("hLeadingParticalD0", "deltaPhi deltaEta leadingPt D0Pt poolbin", {HistType::kTHnSparseD, {{32, 0., o2::constants::math::TwoPI}, {100, -2., 2.}, {180, 0., 18.}, {180, 0., 18.}, {10, 0, 10}}}); } // Find Leading Particle int findLeadingParticle(soa::Join::iterator const& collision, From f1f692e36159375cba50ff10a515bfb8a67af67d Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Thu, 11 Apr 2024 11:39:23 +0800 Subject: [PATCH 09/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index cbd019e206c..7465e4cf842 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -265,7 +265,7 @@ struct HfCorrelatorD0Hadrons { 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})"}}}); // leading partical information - registry.add("hLeadingParticalD0", "deltaPhi deltaEta leadingPt D0Pt poolbin", {HistType::kTHnSparseD, {{32, 0., o2::constants::math::TwoPI}, {100, -2., 2.}, {180, 0., 18.}, {180, 0., 18.}, {10, 0, 10}}}); + registry.add("hLeadingParticalD0", "deltaPhi deltaEta leadingPt D0Pt poolbin", {HistType::kTHnSparseD, {{64, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}, {100, -2., 2.}, {180, 0., 18.}, {180, 0., 18.}, {10, 0, 10}}}); } // Find Leading Particle int findLeadingParticle(soa::Join::iterator const& collision, From 3a50027226b910fb4d34575e4dfc34cf12534e1e Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Mon, 15 Apr 2024 10:05:09 +0800 Subject: [PATCH 10/26] Add files via upload --- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 7465e4cf842..2e3d436bdb3 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -184,8 +184,8 @@ struct HfCorrelatorD0Hadrons { 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 findLeadingParticleSwitch{"FindLeadingParticleSwitch", 0, "Find Leading Particle Switch"}; - Configurable correlationD0LeadingParticle{"CorrelationD0LeadingParticle", 0, "Correlation D0 Leading Particle witch"}; + Configurable correlateD0WithLeadingParticle{"correlateD0WithLeadingParticle", false, "Switch for correlation of D0 mesons with leading particle only"}; + HfHelper hfHelper; int leadingIndex = 0; @@ -268,8 +268,8 @@ struct HfCorrelatorD0Hadrons { registry.add("hLeadingParticalD0", "deltaPhi deltaEta leadingPt D0Pt poolbin", {HistType::kTHnSparseD, {{64, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}, {100, -2., 2.}, {180, 0., 18.}, {180, 0., 18.}, {10, 0, 10}}}); } // Find Leading Particle - int findLeadingParticle(soa::Join::iterator const& collision, - aod::TracksWDca const& tracks) + template + int findLeadingParticle(TTracks const& tracks) { auto leadingParticle = tracks.begin(); for (auto const& track : tracks) { @@ -294,8 +294,8 @@ struct HfCorrelatorD0Hadrons { return; } // find leading particle - if (findLeadingParticleSwitch) { - leadingIndex = findLeadingParticle(collision, tracks); + if (correlateD0WithLeadingParticle) { + leadingIndex = findLeadingParticle(tracks); } int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFV0M())); @@ -361,11 +361,11 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); registry.fill(HIST("hD0Bin"), poolBin); //====================correlation D0 leading particle=============================== - if (correlationD0LeadingParticle) { + if (correlateD0WithLeadingParticle) { for (auto const& track : tracks) { - if (track.globalIndex() == leadingIndex) { - registry.fill(HIST("hLeadingParticalD0"), getDeltaPhi(track.phi(), candidate1.phi()), track.eta() - candidate1.eta(), track.pt(), candidate1.pt(), poolBin); - } + if (track.globalIndex() != leadingIndex) + continue; + registry.fill(HIST("hLeadingParticalD0"), getDeltaPhi(track.phi(), candidate1.phi()), track.eta() - candidate1.eta(), track.pt(), candidate1.pt(), poolBin); } } // ============ D-h correlation dedicated section ================================== From 636ff8d196a9d8547edf2fadbce7ab81a9889613 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:14:08 +0800 Subject: [PATCH 11/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 2e3d436bdb3..b3bda95771c 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -264,8 +264,6 @@ struct HfCorrelatorD0Hadrons { // 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})"}}}); - // leading partical information - registry.add("hLeadingParticalD0", "deltaPhi deltaEta leadingPt D0Pt poolbin", {HistType::kTHnSparseD, {{64, -o2::constants::math::PIHalf, 3. * o2::constants::math::PIHalf}, {100, -2., 2.}, {180, 0., 18.}, {180, 0., 18.}, {10, 0, 10}}}); } // Find Leading Particle template @@ -361,18 +359,13 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); registry.fill(HIST("hD0Bin"), poolBin); //====================correlation D0 leading particle=============================== - if (correlateD0WithLeadingParticle) { - for (auto const& track : tracks) { - if (track.globalIndex() != leadingIndex) - continue; - registry.fill(HIST("hLeadingParticalD0"), getDeltaPhi(track.phi(), candidate1.phi()), track.eta() - candidate1.eta(), track.pt(), candidate1.pt(), 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 if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { continue; @@ -413,6 +406,11 @@ struct HfCorrelatorD0Hadrons { signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnly; } + if (correlateD0WithLeadingParticle) { + if (track.globalIndex() != leadingIndex) + continue; + } + entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), track.eta() - candidate1.eta(), candidate1.pt(), From 73900346cc53189d14c6f9699b8d38123be659e7 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:16:42 +0800 Subject: [PATCH 12/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index b3bda95771c..23ae391b20e 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -407,8 +407,7 @@ struct HfCorrelatorD0Hadrons { } if (correlateD0WithLeadingParticle) { - if (track.globalIndex() != leadingIndex) - continue; + if (track.globalIndex() != leadingIndex) continue; } entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), From dfca24e6ab009aaa2d4f703a0a6ea44986fb9011 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:18:55 +0800 Subject: [PATCH 13/26] 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 23ae391b20e..d8575be25a7 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -358,7 +358,6 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hY"), hfHelper.yD0(candidate1)); registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); registry.fill(HIST("hD0Bin"), poolBin); - //====================correlation D0 leading particle=============================== // ============ D-h correlation dedicated section ================================== @@ -407,7 +406,8 @@ struct HfCorrelatorD0Hadrons { } if (correlateD0WithLeadingParticle) { - if (track.globalIndex() != leadingIndex) continue; + if (track.globalIndex() != leadingIndex) + continue; } entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), From 830a84639f72b0bbe396cf58783a6be09221272b Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:21:14 +0800 Subject: [PATCH 14/26] Add files via upload --- PWGHF/HFC/correlatorD0Hadrons.cxx | 904 ++++++++++++++++++++++++++++++ 1 file changed, 904 insertions(+) create mode 100644 PWGHF/HFC/correlatorD0Hadrons.cxx diff --git a/PWGHF/HFC/correlatorD0Hadrons.cxx b/PWGHF/HFC/correlatorD0Hadrons.cxx new file mode 100644 index 00000000000..d151f5b977c --- /dev/null +++ b/PWGHF/HFC/correlatorD0Hadrons.cxx @@ -0,0 +1,904 @@ +// 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& candidates) + { + 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& candidates) + { + 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& mcCollision, + aod::McParticles const& mcParticles) + { + bool isD0Found = 0; + for (const auto& particle1 : mcParticles) { + if (std::abs(particle1.pdgCode()) != Pdg::kD0) { + continue; + } + double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, 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"}; + + 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& candidates) + { + // 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 + 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("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.px() + track.px(), candidate1.py() + track.py(), candidate1.pz() + track.pz()); + 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; + } + + 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 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& candidates) + { + // 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.px() + track.px(), candidate1.py() + track.py(), candidate1.pz() + track.pz()); + 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(std::array{particle1.px(), particle1.py(), particle1.pz()}, 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.px() + t2.px(), t1.py() + t2.py(), t1.pz() + t2.pz()); + 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.px() + t2.px(), t1.py() + t2.py(), t1.pz() + t2.pz()); + 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(std::array{t1.px(), t1.py(), t1.pz()}, 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 484fd772ec271285ab0c6128b4547cba5b061bb6 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:25:54 +0800 Subject: [PATCH 15/26] Add files via upload --- PWGHF/HFC/correlatorD0Hadrons.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGHF/HFC/correlatorD0Hadrons.cxx b/PWGHF/HFC/correlatorD0Hadrons.cxx index d151f5b977c..d8575be25a7 100644 --- a/PWGHF/HFC/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/correlatorD0Hadrons.cxx @@ -406,7 +406,8 @@ struct HfCorrelatorD0Hadrons { } if (correlateD0WithLeadingParticle) { - if (track.globalIndex() != leadingIndex) continue; + if (track.globalIndex() != leadingIndex) + continue; } entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), From 7402b24f14f25254ee635aaadcd7baafcea09e90 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Sun, 21 Apr 2024 17:09:25 +0800 Subject: [PATCH 16/26] Add files via upload From c40a73e2a7bea61d774a06103a90087e4e8255c3 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Sun, 21 Apr 2024 17:10:40 +0800 Subject: [PATCH 17/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index d8575be25a7..5038ee42781 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -409,6 +409,7 @@ struct HfCorrelatorD0Hadrons { 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(), From 07dcf58b053402593a668e52b9f8a145390689fb Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Sun, 21 Apr 2024 17:13:45 +0800 Subject: [PATCH 18/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 5038ee42781..cd80e4c6e0e 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -406,10 +406,11 @@ struct HfCorrelatorD0Hadrons { } if (correlateD0WithLeadingParticle) { - if (track.globalIndex() != leadingIndex) + if (track.globalIndex() != leadingIndex) { + registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle continue; + } } - registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), track.eta() - candidate1.eta(), From 8c1984085af1d02e714c1001a866af436bc81b59 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Sun, 21 Apr 2024 18:21:50 +0800 Subject: [PATCH 19/26] Delete PWGHF/HFC/correlatorD0Hadrons.cxx --- PWGHF/HFC/correlatorD0Hadrons.cxx | 905 ------------------------------ 1 file changed, 905 deletions(-) delete mode 100644 PWGHF/HFC/correlatorD0Hadrons.cxx diff --git a/PWGHF/HFC/correlatorD0Hadrons.cxx b/PWGHF/HFC/correlatorD0Hadrons.cxx deleted file mode 100644 index d8575be25a7..00000000000 --- a/PWGHF/HFC/correlatorD0Hadrons.cxx +++ /dev/null @@ -1,905 +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& candidates) - { - 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& candidates) - { - 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& mcCollision, - aod::McParticles const& mcParticles) - { - bool isD0Found = 0; - for (const auto& particle1 : mcParticles) { - if (std::abs(particle1.pdgCode()) != Pdg::kD0) { - continue; - } - double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, 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"}; - - 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& candidates) - { - // 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 - 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("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.px() + track.px(), candidate1.py() + track.py(), candidate1.pz() + track.pz()); - 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; - } - - 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 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& candidates) - { - // 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.px() + track.px(), candidate1.py() + track.py(), candidate1.pz() + track.pz()); - 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(std::array{particle1.px(), particle1.py(), particle1.pz()}, 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.px() + t2.px(), t1.py() + t2.py(), t1.pz() + t2.pz()); - 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.px() + t2.px(), t1.py() + t2.py(), t1.pz() + t2.pz()); - 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(std::array{t1.px(), t1.py(), t1.pz()}, 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 caf562f1df105b4805fc6e909a4f2a174df98442 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Mon, 22 Apr 2024 07:53:10 +0800 Subject: [PATCH 20/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index cd80e4c6e0e..ef028ca73ec 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -366,9 +366,9 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hTrackCounter"), 1); // fill total no. of tracks // Remove D0 daughters by checking track indices - if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { - continue; - } + /* 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 @@ -407,9 +407,9 @@ struct HfCorrelatorD0Hadrons { if (correlateD0WithLeadingParticle) { if (track.globalIndex() != leadingIndex) { - registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle continue; } + registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle } entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), From b0467f547301ceaa373abd107eb3eea366132308 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Mon, 22 Apr 2024 07:55:47 +0800 Subject: [PATCH 21/26] 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 ef028ca73ec..6389717b6f8 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -366,9 +366,9 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hTrackCounter"), 1); // fill total no. of tracks // Remove D0 daughters by checking track indices - /* if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { - continue; - }*/ + 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 From e6d7ac55e7ae97523059e13f0501a81667ffd213 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Tue, 23 Apr 2024 08:35:57 +0800 Subject: [PATCH 22/26] Add files via upload --- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 1db9f651a34..6389717b6f8 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -94,7 +94,7 @@ struct HfCorrelatorD0HadronsSelection { 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&) + soa::Join const& candidates) { bool isD0Found = 0; if (selectedD0Candidates.size() > 0) { @@ -119,7 +119,7 @@ struct HfCorrelatorD0HadronsSelection { PROCESS_SWITCH(HfCorrelatorD0HadronsSelection, processD0SelectionData, "Process D0 Selection Data", false); void processD0SelectionMcRec(aod::Collision const& collision, - soa::Join const&) + soa::Join const& candidates) { bool isD0Found = 0; if (selectedD0candidatesMc.size() > 0) { @@ -142,7 +142,7 @@ struct HfCorrelatorD0HadronsSelection { } PROCESS_SWITCH(HfCorrelatorD0HadronsSelection, processD0SelectionMcRec, "Process D0 Selection MCRec", true); - void processD0SelectionMcGen(aod::McCollision const&, + void processD0SelectionMcGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) { bool isD0Found = 0; @@ -150,7 +150,7 @@ struct HfCorrelatorD0HadronsSelection { if (std::abs(particle1.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(particle1.pVector(), MassD0); + double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -285,7 +285,7 @@ struct HfCorrelatorD0Hadrons { /// 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&) + soa::Join const& candidates) { // protection against empty tables to be sliced if (selectedD0Candidates.size() == 0) { @@ -377,7 +377,7 @@ struct HfCorrelatorD0Hadrons { // ========== soft pion removal =================================================== double invMassDstar1 = 0., invMassDstar2 = 0.; bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(candidate1.pVector(), track.pVector()); + auto pSum2 = RecoDecay::p2(candidate1.px() + track.px(), candidate1.py() + track.py(), candidate1.pz() + track.pz()); auto ePion = track.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); @@ -429,7 +429,7 @@ struct HfCorrelatorD0Hadrons { void processMcRec(soa::Join::iterator const& collision, aod::TracksWDca const& tracks, - soa::Join const&) + soa::Join const& candidates) { // protection against empty tables to be sliced if (selectedD0candidatesMc.size() == 0) { @@ -537,7 +537,7 @@ struct HfCorrelatorD0Hadrons { // ===== soft pion removal =================================================== double invMassDstar1 = 0, invMassDstar2 = 0; bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(candidate1.pVector(), track.pVector()); + auto pSum2 = RecoDecay::p2(candidate1.px() + track.px(), candidate1.py() + track.py(), candidate1.pz() + track.pz()); auto ePion = track.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); @@ -605,7 +605,7 @@ struct HfCorrelatorD0Hadrons { if (std::abs(particle1.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(particle1.pVector(), MassD0); + double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -647,7 +647,7 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hTrackCounterGen"), 3); // fill after soft pion removal - auto getTracksSize = [&mcParticles](aod::McCollision const& /*collision*/) { + auto getTracksSize = [&mcParticles](aod::McCollision const& collision) { int nTracks = 0; for (const auto& track : mcParticles) { if (track.isPhysicalPrimary() && std::abs(track.eta()) < 1.0) { @@ -695,7 +695,7 @@ struct HfCorrelatorD0Hadrons { 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 pSum2 = RecoDecay::p2(t1.px() + t2.px(), t1.py() + t2.py(), t1.pz() + t2.pz()); auto ePion = t2.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); @@ -759,7 +759,7 @@ struct HfCorrelatorD0Hadrons { 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 pSum2 = RecoDecay::p2(t1.px() + t2.px(), t1.py() + t2.py(), t1.pz() + t2.pz()); auto ePion = t2.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); @@ -867,7 +867,7 @@ struct HfCorrelatorD0Hadrons { continue; } - double yD = RecoDecay::y(t1.pVector(), MassD0); + double yD = RecoDecay::y(std::array{t1.px(), t1.py(), t1.pz()}, MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } From 9e4560a89426074cc3387931d61b915a808fa336 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Tue, 23 Apr 2024 20:58:46 +0800 Subject: [PATCH 23/26] Add files via upload --- .../HFC/TableProducer/correlatorD0Hadrons.cxx | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 6389717b6f8..296a4d75723 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -94,7 +94,7 @@ struct HfCorrelatorD0HadronsSelection { 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& candidates) + soa::Join const&) { bool isD0Found = 0; if (selectedD0Candidates.size() > 0) { @@ -119,7 +119,7 @@ struct HfCorrelatorD0HadronsSelection { PROCESS_SWITCH(HfCorrelatorD0HadronsSelection, processD0SelectionData, "Process D0 Selection Data", false); void processD0SelectionMcRec(aod::Collision const& collision, - soa::Join const& candidates) + soa::Join const&) { bool isD0Found = 0; if (selectedD0candidatesMc.size() > 0) { @@ -142,7 +142,7 @@ struct HfCorrelatorD0HadronsSelection { } PROCESS_SWITCH(HfCorrelatorD0HadronsSelection, processD0SelectionMcRec, "Process D0 Selection MCRec", true); - void processD0SelectionMcGen(aod::McCollision const& mcCollision, + void processD0SelectionMcGen(aod::McCollision const&, aod::McParticles const& mcParticles) { bool isD0Found = 0; @@ -150,7 +150,7 @@ struct HfCorrelatorD0HadronsSelection { if (std::abs(particle1.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassD0); + double yD = RecoDecay::y(particle1.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -265,6 +265,7 @@ struct HfCorrelatorD0Hadrons { 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) @@ -285,7 +286,7 @@ struct HfCorrelatorD0Hadrons { /// 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& candidates) + soa::Join const&) { // protection against empty tables to be sliced if (selectedD0Candidates.size() == 0) { @@ -364,7 +365,6 @@ struct HfCorrelatorD0Hadrons { // ========================== 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 if ((candidate1.prong0Id() == track.globalIndex()) || (candidate1.prong1Id() == track.globalIndex())) { continue; @@ -377,7 +377,7 @@ struct HfCorrelatorD0Hadrons { // ========== soft pion removal =================================================== double invMassDstar1 = 0., invMassDstar2 = 0.; bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(candidate1.px() + track.px(), candidate1.py() + track.py(), candidate1.pz() + track.pz()); + 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); @@ -409,9 +409,9 @@ struct HfCorrelatorD0Hadrons { if (track.globalIndex() != leadingIndex) { continue; } + std::cout << " hello word" << std::endl; registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle } - entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), track.eta() - candidate1.eta(), candidate1.pt(), @@ -429,7 +429,7 @@ struct HfCorrelatorD0Hadrons { void processMcRec(soa::Join::iterator const& collision, aod::TracksWDca const& tracks, - soa::Join const& candidates) + soa::Join const&) { // protection against empty tables to be sliced if (selectedD0candidatesMc.size() == 0) { @@ -537,7 +537,7 @@ struct HfCorrelatorD0Hadrons { // ===== soft pion removal =================================================== double invMassDstar1 = 0, invMassDstar2 = 0; bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(candidate1.px() + track.px(), candidate1.py() + track.py(), candidate1.pz() + track.pz()); + 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); @@ -605,7 +605,7 @@ struct HfCorrelatorD0Hadrons { if (std::abs(particle1.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassD0); + double yD = RecoDecay::y(particle1.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -647,7 +647,7 @@ struct HfCorrelatorD0Hadrons { registry.fill(HIST("hTrackCounterGen"), 3); // fill after soft pion removal - auto getTracksSize = [&mcParticles](aod::McCollision const& collision) { + auto getTracksSize = [&mcParticles](aod::McCollision const& /*collision*/) { int nTracks = 0; for (const auto& track : mcParticles) { if (track.isPhysicalPrimary() && std::abs(track.eta()) < 1.0) { @@ -695,7 +695,7 @@ struct HfCorrelatorD0Hadrons { 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.px() + t2.px(), t1.py() + t2.py(), t1.pz() + t2.pz()); + 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); @@ -759,7 +759,7 @@ struct HfCorrelatorD0Hadrons { 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.px() + t2.px(), t1.py() + t2.py(), t1.pz() + t2.pz()); + 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); @@ -867,7 +867,7 @@ struct HfCorrelatorD0Hadrons { continue; } - double yD = RecoDecay::y(std::array{t1.px(), t1.py(), t1.pz()}, MassD0); + double yD = RecoDecay::y(t1.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } From 09958d04f0e953bbeeb698bcabc736314583b624 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Tue, 23 Apr 2024 21:00:10 +0800 Subject: [PATCH 24/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 296a4d75723..3371fd5d865 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -409,7 +409,6 @@ struct HfCorrelatorD0Hadrons { if (track.globalIndex() != leadingIndex) { continue; } - std::cout << " hello word" << std::endl; registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle } entryD0HadronPair(getDeltaPhi(track.phi(), candidate1.phi()), From 30e94d38a43b2feaef9de8e023e150b9731029c1 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Wed, 24 Apr 2024 09:35:02 +0800 Subject: [PATCH 25/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 3371fd5d865..893218c7d5f 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -272,8 +272,9 @@ struct HfCorrelatorD0Hadrons { { auto leadingParticle = tracks.begin(); for (auto const& track : tracks) { - if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) + if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.){ continue; + } if (track.pt() > leadingParticle.pt()) { leadingParticle = track; } From c280f504de8b8c35cbb0378a11f0f38573267178 Mon Sep 17 00:00:00 2001 From: Xu wang <113404602+1481014945@users.noreply.github.com> Date: Wed, 24 Apr 2024 09:39:06 +0800 Subject: [PATCH 26/26] Add files via upload --- PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 893218c7d5f..5c9bf60277a 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -272,7 +272,7 @@ struct HfCorrelatorD0Hadrons { { auto leadingParticle = tracks.begin(); for (auto const& track : tracks) { - if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.){ + if (std::abs(track.dcaXY()) >= 1. || std::abs(track.dcaZ()) >= 1.) { continue; } if (track.pt() > leadingParticle.pt()) {