From e79cbd46d846687e832d9680ee8dcca8037f8d33 Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Wed, 5 May 2021 14:47:43 +0200 Subject: [PATCH 01/14] Separating D0D0bar and DplusDminus skimmers --- .../AnalysisDataModel/HFSecondaryVertex.h | 20 + Analysis/Tasks/PWGHF/CMakeLists.txt | 15 + Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx | 848 +++++++++++++++++ .../Tasks/PWGHF/DplusDminusCorrelator.cxx | 864 ++++++++++++++++++ .../PWGHF/HFDplusToPiKPiCandidateSelector.cxx | 22 +- Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx | 481 ++++++++++ 6 files changed, 2239 insertions(+), 11 deletions(-) create mode 100644 Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx create mode 100644 Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx create mode 100644 Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h index 8c62fd41b43ba..8b5864f8d679d 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h @@ -487,6 +487,26 @@ DECLARE_SOA_TABLE(HfCandProng3MCGen, "AOD", "HFCANDP3MCGEN", hf_cand_prong3::OriginMCGen, hf_cand_prong3::FlagMCDecayChanGen); +// definition of columns and tables for D-Dbar correlation pairs +namespace hf_ddbar_correlation +{ +DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); +DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); +DECLARE_SOA_COLUMN(PtD, ptD, float); +DECLARE_SOA_COLUMN(PtDbar, ptDbar, float); +DECLARE_SOA_COLUMN(MD, mD, float); +DECLARE_SOA_COLUMN(MDbar, mDbar, float); +DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); +} // namespace hf_d0d0bar_correlation +DECLARE_SOA_TABLE(DDbarPair, "AOD", "DDBARPAIR", + aod::hf_ddbar_correlation::DeltaPhi, + aod::hf_ddbar_correlation::DeltaEta, + aod::hf_ddbar_correlation::PtD, + aod::hf_ddbar_correlation::PtDbar); +DECLARE_SOA_TABLE(DDbarRecoInfo, "AOD", "DDBARRECOINFO", + aod::hf_ddbar_correlation::MD, + aod::hf_ddbar_correlation::MDbar, + aod::hf_ddbar_correlation::SignalStatus); } // namespace o2::aod #endif // O2_ANALYSIS_HFSECONDARYVERTEX_H_ diff --git a/Analysis/Tasks/PWGHF/CMakeLists.txt b/Analysis/Tasks/PWGHF/CMakeLists.txt index 6fb285562c45d..b274f2db50efe 100644 --- a/Analysis/Tasks/PWGHF/CMakeLists.txt +++ b/Analysis/Tasks/PWGHF/CMakeLists.txt @@ -108,6 +108,21 @@ o2_add_dpl_workflow(hf-task-x PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing COMPONENT_NAME Analysis) +o2_add_dpl_workflow(hf-d0d0bar-correlator + SOURCES D0D0barCorrelator.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing + COMPONENT_NAME Analysis) + +o2_add_dpl_workflow(hf-dplusdminus-correlator + SOURCES DplusDminusCorrelator.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing + COMPONENT_NAME Analysis) + +o2_add_dpl_workflow(hf-task-ddbar-correlation + SOURCES taskDDbarCorrelation.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing + COMPONENT_NAME Analysis) + o2_add_dpl_workflow(hf-mc-validation SOURCES HFMCValidation.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing diff --git a/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx b/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx new file mode 100644 index 0000000000000..ca6c67bb7f6c2 --- /dev/null +++ b/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx @@ -0,0 +1,848 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// 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 D0D0barCorrelator.cxx +/// \brief D0-D0bar correlator task - data-like, MC-reco and MC-kine analyses. For ULS and LS pairs +/// +/// \author Fabio Colamaria , INFN Bari + +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "AnalysisCore/HFSelectorCuts.h" +#include "AnalysisDataModel/HFSecondaryVertex.h" +#include "AnalysisDataModel/HFCandidateSelectionTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod::hf_cand_prong2; +using namespace o2::analysis::hf_cuts_d0_topik; +using namespace o2::framework::expressions; +using namespace o2::constants::math; +using namespace o2::aod::hf_ddbar_correlation; + +void customize(std::vector& workflowOptions) +{ + ConfigParamSpec optionDoLikeSign{"doLikeSign", VariantType::Bool, false, {"Run Like-Sign analysis."}}; + ConfigParamSpec optionDoMCccbar{"doMCccbar", VariantType::Bool, false, {"Run MC-Gen dedicated tasks."}}; + ConfigParamSpec optionDoMCGen{"doMCGen", VariantType::Bool, false, {"Run MC-Gen dedicated tasks."}}; + ConfigParamSpec optionDoMCRec{"doMCRec", VariantType::Bool, false, {"Run MC-Rec dedicated tasks."}}; + workflowOptions.push_back(optionDoLikeSign); + workflowOptions.push_back(optionDoMCccbar); + workflowOptions.push_back(optionDoMCGen); + workflowOptions.push_back(optionDoMCRec); +} + +#include "Framework/runDataProcessing.h" + +/// +/// Returns deltaPhi value in range [-pi/2., 3.*pi/2], typically used for correlation studies +/// +double getDeltaPhi(double phiD, double phiDbar) +{ + return RecoDecay::constrainAngle(phiDbar - phiD, -o2::constants::math::PI / 2.); +} + +/// definition of variables for D0D0bar pairs vs eta acceptance studies (hDDbarVsEtaCut, in data-like, MC-reco and MC-kine tasks) +const double maxEtaCut = 5.; +const double ptThresholdForMaxEtaCut = 10.; +const double incrementEtaCut = 0.1; +const double incrementPtThreshold = 0.5; +const double epsilon = 1E-5; + +/// D0-D0bar correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) +struct D0D0barCorrelator { + Produces entryD0D0barPair; + Produces entryD0D0barRecoInfo; + + 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, {{180, 0., 36.}}}}, + {"hPtProng0", "D0,D0bar candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng1", "D0,D0bar candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hSelectionStatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hEta", "D0,D0bar candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhi", "D0,D0bar candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hY", "D0,D0bar candidates;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hDDbarVsEtaCut", "D0,D0bar pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; + + Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; + Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; + + void init(o2::framework::InitContext&) + { + registry.add("hMass", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassD0", "D0,D0bar candidates;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassD0bar", "D0,D0bar candidates;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + + void process(aod::Collision const& collision, soa::Filtered> const& candidates) + { + for (auto& candidate1 : candidates) { + if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + continue; + } + //check decay channel flag for candidate1 + if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + continue; + } + //fill invariant mass plots and generic info from all D0/D0bar candidates + if (candidate1.isSelD0() >= dSelectionFlagD0) { + registry.fill(HIST("hMass"), InvMassD0(candidate1), candidate1.pt()); + registry.fill(HIST("hMassD0"), InvMassD0(candidate1), candidate1.pt()); + } + if (candidate1.isSelD0bar() >= dSelectionFlagD0bar) { + registry.fill(HIST("hMass"), InvMassD0bar(candidate1), candidate1.pt()); + registry.fill(HIST("hMassD0bar"), InvMassD0bar(candidate1), candidate1.pt()); + } + 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"), YD0(candidate1)); + registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); + + //D-Dbar correlation dedicated section + //if the candidate is a D0, search for D0bar and evaluate correlations + if (candidate1.isSelD0() >= dSelectionFlagD0) { + for (auto& candidate2 : candidates) { + //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << D0ToPiK)) { + continue; + } + if (candidate2.isSelD0bar() >= dSelectionFlagD0bar) { + if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + continue; + } + //Excluding trigger self-correlations (possible in case of both mass hypotheses accepted) + if (candidate1.mRowIndex == candidate2.mRowIndex) { + continue; + } + entryD0D0barPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryD0D0barRecoInfo(InvMassD0(candidate1), + InvMassD0bar(candidate2), + 0); + double etaCut = 0.; + double ptCut = 0.; + do { //fill pairs vs etaCut plot + ptCut = 0.; + etaCut += incrementEtaCut; + do { //fill pairs vs etaCut plot + if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) + registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + ptCut += incrementPtThreshold; + } while (ptCut < ptThresholdForMaxEtaCut - epsilon); + } while (etaCut < maxEtaCut - epsilon); + } + //note: candidates selected as both D0 and D0bar are used, and considered in both situation (but not auto-correlated): reflections could play a relevant role. + //another, more restrictive, option, could be to consider only candidates selected with a single option (D0 xor D0bar) + + } // end inner loop (Dbars) + } + + } //end outer loop + } +}; + +/// D0-D0bar correlation pair builder - for MC reco-level analysis (candidates matched to true signal only, but also the various bkg sources are studied) +struct D0D0barCorrelatorMCRec { + + Produces entryD0D0barPair; + Produces entryD0D0barRecoInfo; + + HistogramRegistry registry{ + "registry", + //NOTE: use hMassD0 for trigger normalisation (S*0.955), and hMass2DCorrelationPairs (in final task) for 2D-sideband-subtraction purposes + {{"hPtCandMCRec", "D0,D0bar candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng0MCRec", "D0,D0bar candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng1MCRec", "D0,D0bar candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hSelectionStatusMCRec", "D0,D0bar candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hEtaMCRec", "D0,D0bar candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCRec", "D0,D0bar candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hYMCRec", "D0,D0bar candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hDDbarVsEtaCut", "D0,D0bar pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; + + Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; + Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; + + void init(o2::framework::InitContext&) + { + registry.add("hMassD0MCRec", "D0,D0bar candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassD0barMCRec", "D0,D0bar candidates - MC reco;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + + void process(aod::Collision const& collision, soa::Filtered> const& candidates) + { + //MC reco level + bool flagD0Signal = kFALSE; + bool flagD0barSignal = kFALSE; + for (auto& candidate1 : candidates) { + //check decay channel flag for candidate1 + if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + continue; + } + if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + continue; + } + if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { + //fill invariant mass plots and generic info from all D0/D0bar candidates + if (candidate1.isSelD0() >= dSelectionFlagD0 && candidate1.flagMCMatchRec() == 1 << D0ToPiK) { //only reco and matched as D0 + registry.fill(HIST("hMassD0MCRec"), InvMassD0(candidate1), candidate1.pt()); + } + if (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << D0ToPiK) { //only reco and matched as D0bar + registry.fill(HIST("hMassD0barMCRec"), InvMassD0bar(candidate1), candidate1.pt()); + } + registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); + registry.fill(HIST("hPtProng0MCRec"), candidate1.ptProng0()); + registry.fill(HIST("hPtProng1MCRec"), candidate1.ptProng1()); + registry.fill(HIST("hEtaMCRec"), candidate1.eta()); + registry.fill(HIST("hPhiMCRec"), candidate1.phi()); + registry.fill(HIST("hYMCRec"), YD0(candidate1)); + registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); + } + + //D-Dbar correlation dedicated section + //if the candidate is selected ad D0, search for D0bar and evaluate correlations + if (candidate1.isSelD0() < dSelectionFlagD0) { //discard candidates not selected as D0 in outer loop + continue; + } + if (candidate1.flagMCMatchRec() == 1 << D0ToPiK) { //candidate matched to D0 (particle) + flagD0Signal = kTRUE; + } else { //candidate of bkg, wrongly selected as D0 + flagD0Signal = kFALSE; + } + for (auto& candidate2 : candidates) { + if (!(candidate2.hfflag() & 1 << D0ToPiK)) { //check decay channel flag for candidate2 + continue; + } + if (candidate2.isSelD0bar() < dSelectionFlagD0bar) { //discard candidates not selected as D0bar in inner loop + continue; + } + if (candidate2.flagMCMatchRec() == -1 << D0ToPiK) { //candidate matched to D0bar (antiparticle) + flagD0barSignal = kTRUE; + } else { //candidate of bkg, wrongly selected as D0bar + flagD0barSignal = kFALSE; + } + if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + continue; + } + //Excluding trigger self-correlations (possible in case of both mass hypotheses accepted) + if (candidate1.mRowIndex == candidate2.mRowIndex) { + continue; + } + //choice of options (D0/D0bar signal/bkg) + int pairSignalStatus = 0; //0 = bkg/bkg, 1 = bkg/sig, 2 = sig/bkg, 3 = sig/sig + if (flagD0Signal) { + pairSignalStatus += 2; + } + if (flagD0barSignal) { + pairSignalStatus += 1; + } + entryD0D0barPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryD0D0barRecoInfo(InvMassD0(candidate1), + InvMassD0bar(candidate2), + pairSignalStatus); + double etaCut = 0.; + double ptCut = 0.; + do { //fill pairs vs etaCut plot + ptCut = 0.; + etaCut += incrementEtaCut; + do { //fill pairs vs etaCut plot + if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) + registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + ptCut += incrementPtThreshold; + } while (ptCut < ptThresholdForMaxEtaCut - epsilon); + } while (etaCut < maxEtaCut - epsilon); + } // end inner loop (Dbars) + + } //end outer loop + } +}; + +/// D0-D0bar correlation pair builder - for MC gen-level analysis (no filter/selection, only true signal) +struct D0D0barCorrelatorMCGen { + + Produces entryD0D0barPair; + + HistogramRegistry registry{ + "registry", + {{"hMCEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, + {"hPtCandMCGen", "D0,D0bar particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hEtaMCGen", "D0,D0bar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCGen", "D0,D0bar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hYMCGen", "D0,D0bar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hcountD0D0barPerEvent", "D0,D0bar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}, + {"hDDbarVsEtaCut", "D0,D0bar pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; + + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for trigger counters"}; + + void init(o2::framework::InitContext&) + { + registry.add("hcountD0triggersMCGen", "D0 trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) + { + int counterD0D0bar = 0; + registry.fill(HIST("hMCEvtCount"), 0); + //MC gen level + for (auto& particle1 : particlesMC) { + //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()) != 421) { + continue; + } + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + continue; + } + registry.fill(HIST("hPtCandMCGen"), particle1.pt()); + registry.fill(HIST("hEtaMCGen"), particle1.eta()); + registry.fill(HIST("hPhiMCGen"), particle1.phi()); + registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + counterD0D0bar++; + + //D-Dbar correlation dedicated section + //if it's a D0 particle, search for D0bar and evaluate correlations + if (particle1.pdgCode() == 421) { //just checking the particle PDG, not the decay channel (differently from Reco: you have a BR factor btw such levels!) + registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger D0 (for normalisation) + for (auto& particle2 : particlesMC) { + if (particle2.pdgCode() == -421) { + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + continue; + } + entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + double etaCut = 0.; + double ptCut = 0.; + do { //fill pairs vs etaCut plot + ptCut = 0.; + etaCut += incrementEtaCut; + do { //fill pairs vs etaCut plot + if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) + registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + ptCut += incrementPtThreshold; + } while (ptCut < ptThresholdForMaxEtaCut - epsilon); + } while (etaCut < maxEtaCut - epsilon); + } // end D0bar check + } //end inner loop + } //end D0 check + + } //end outer loop + registry.fill(HIST("hcountD0D0barPerEvent"), counterD0D0bar); + } +}; + +/// D0-D0bar correlation pair builder - LIKE SIGN - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) +struct D0D0barCorrelatorLS { + + Produces entryD0D0barPair; + Produces entryD0D0barRecoInfo; + + 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, {{180, 0., 36.}}}}, + {"hPtProng0", "D0,D0bar candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng1", "D0,D0bar candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hSelectionStatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hEta", "D0,D0bar candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhi", "D0,D0bar candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hY", "D0,D0bar candidates;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; + + Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; + Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; + + void init(o2::framework::InitContext&) + { + registry.add("hMass", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassD0", "D0,D0bar candidates;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassD0bar", "D0,D0bar candidates;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + + void process(aod::Collision const& collision, soa::Filtered> const& candidates) + { + for (auto& candidate1 : candidates) { + //check decay channel flag for candidate1 + if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + continue; + } + if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + continue; + } + //fill invariant mass plots and generic info from all D0/D0bar candidates + if (candidate1.isSelD0() >= dSelectionFlagD0) { + registry.fill(HIST("hMass"), InvMassD0(candidate1), candidate1.pt()); + registry.fill(HIST("hMassD0"), InvMassD0(candidate1), candidate1.pt()); + } + if (candidate1.isSelD0bar() >= dSelectionFlagD0bar) { + registry.fill(HIST("hMass"), InvMassD0bar(candidate1), candidate1.pt()); + registry.fill(HIST("hMassD0bar"), InvMassD0bar(candidate1), candidate1.pt()); + } + 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"), YD0(candidate1)); + registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); + + double ptParticle1 = candidate1.pt(); //trigger particle is the largest-pT one + + //D-Dbar correlation dedicated section + //For like-sign, first loop on both D0 and D0bars. First candidate is for sure a D0 and D0bars (checked before, so don't re-check anything on it) + for (auto& candidate2 : candidates) { + //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << D0ToPiK)) { + continue; + } + //for the associated, has to have smaller pT, and pass D0sel if trigger passes D0sel, or D0barsel if trigger passes D0barsel + if (candidate2.pt() < ptParticle1 && ((candidate1.isSelD0() >= dSelectionFlagD0 && candidate2.isSelD0() >= dSelectionFlagD0) || (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate2.isSelD0bar() >= dSelectionFlagD0bar))) { + if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + continue; + } + //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + if (candidate1.mRowIndex == candidate2.mRowIndex) { + continue; + } + entryD0D0barPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryD0D0barRecoInfo(InvMassD0(candidate1), + InvMassD0bar(candidate2), + 0); + } + //note: candidates selected as both D0 and D0bar are used, and considered in both situation (but not auto-correlated): reflections could play a relevant role. + //another, more restrictive, option, could be to consider only candidates selected with a single option (D0 xor D0bar) + + } // end inner loop (Dbars) + + } //end outer loop + } +}; + +/// D0-D0bar correlation pair builder - LIKE SIGN - for MC reco analysis (data-like but matching to true DO and D0bar) +struct D0D0barCorrelatorMCRecLS { + + Produces entryD0D0barPair; + Produces entryD0D0barRecoInfo; + + HistogramRegistry registry{ + "registry", + //NOTE: use hMassD0 for trigger normalisation (S*0.955), and hMass2DCorrelationPairs (in final task) for 2D-sideband-subtraction purposes + {{"hPtCandMCRec", "D0,D0bar candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng0MCRec", "D0,D0bar candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng1MCRec", "D0,D0bar candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hSelectionStatusMCRec", "D0,D0bar candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hEtaMCRec", "D0,D0bar candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCRec", "D0,D0bar candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hYMCRec", "D0,D0bar candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; + + Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; + Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; + + void init(o2::framework::InitContext&) + { + registry.add("hMassD0MCRec", "D0,D0bar candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassD0barMCRec", "D0,D0bar candidates - MC reco;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + + void process(aod::Collision const& collision, soa::Filtered> const& candidates) + { + //MC reco level + for (auto& candidate1 : candidates) { + //check decay channel flag for candidate1 + if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + continue; + } + if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + continue; + } + if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { + //fill invariant mass plots and generic info from all D0/D0bar candidates + if (candidate1.isSelD0() >= dSelectionFlagD0 && candidate1.flagMCMatchRec() == D0ToPiK) { //only reco and matched as D0 + registry.fill(HIST("hMassD0MCRec"), InvMassD0(candidate1)); + } + if (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == D0ToPiK) { //only reco and matched as D0bar + registry.fill(HIST("hMassD0barMCRec"), InvMassD0bar(candidate1)); + } + registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); + registry.fill(HIST("hPtprong0MCRec"), candidate1.ptProng0()); + registry.fill(HIST("hPtprong1MCRec"), candidate1.ptProng1()); + registry.fill(HIST("hEtaMCRec"), candidate1.eta()); + registry.fill(HIST("hPhiMCRec"), candidate1.phi()); + registry.fill(HIST("hYMCRec"), YD0(candidate1)); + + double ptParticle1 = candidate1.pt(); //trigger particle is the largest pT one + + //D-Dbar correlation dedicated section + //For like-sign, first loop on both D0 and D0bars. First candidate is for sure a D0 and D0bars (looping on filtered) and was already matched, so don't re-check anything on it) + for (auto& candidate2 : candidates) { + //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << D0ToPiK)) { + continue; + } + bool conditionLSForD0 = (candidate1.isSelD0() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == 1 << D0ToPiK) && (candidate2.isSelD0() >= dSelectionFlagD0bar && candidate2.flagMCMatchRec() == 1 << D0ToPiK); + bool conditionLSForD0bar = (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << D0ToPiK) && (candidate2.isSelD0bar() >= dSelectionFlagD0bar && candidate2.flagMCMatchRec() == -1 << D0ToPiK); + if (candidate2.pt() < ptParticle1 && (conditionLSForD0 || conditionLSForD0bar)) { //LS pair (of D0 or of D0bar) + pt2= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + continue; + } + //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + if (candidate1.mRowIndex == candidate2.mRowIndex) { + continue; + } + entryD0D0barPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryD0D0barRecoInfo(InvMassD0(candidate1), + InvMassD0bar(candidate2), + 0); //for LS studies we set a dummy 0 for pairSignalStatus (there are no more the usual 4 possible combinations) + + } //end inner if (MC match) + + } // end inner loop (Dbars) + } //end outer if (MC match) + } //end outer loop + } +}; + +/// D0-D0bar correlation pair builder - for MC gen-level analysis, like sign particles +struct D0D0barCorrelatorMCGenLS { + + Produces entryD0D0barPair; + + HistogramRegistry registry{ + "registry", + {{"hMCEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, + {"hPtCandMCGen", "D0,D0bar particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hEtaMCGen", "D0,D0bar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCGen", "D0,D0bar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hYMCGen", "D0,D0bar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hcountD0D0barPerEvent", "D0,D0bar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for trigger counters"}; + + void init(o2::framework::InitContext&) + { + registry.add("hcountD0triggersMCGen", "D0 trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) + { + int counterD0D0bar = 0; + registry.fill(HIST("hMCEvtCount"), 0); + //MC gen level + for (auto& particle1 : particlesMC) { + //check if the particle is D0 or D0bar (both can be trigger) - NOTE: decay channel is not probed! + if (std::abs(particle1.pdgCode()) != 421) { + continue; + } + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + continue; + } + + double ptParticle1 = particle1.pt(); //trigger particle is the largest pT one + + registry.fill(HIST("hPtCandMCGen"), particle1.pt()); + registry.fill(HIST("hEtaMCGen"), particle1.eta()); + registry.fill(HIST("hPhiMCGen"), particle1.phi()); + registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + counterD0D0bar++; + //D-Dbar correlation dedicated section + //if it's D0, search for D0bar and evaluate correlations. + registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger D0 (normalisation) + for (auto& particle2 : particlesMC) { + if (std::abs(particle2.pdgCode()) != 421) { //check that associated is a D0/D0bar (both are fine) + continue; + } + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + continue; + } + if (particle2.pt() < ptParticle1 && particle2.pdgCode() == particle1.pdgCode()) { //like-sign condition (both 421 or both -421) and pT_Trig>pT_assoc + //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + if (particle1.mRowIndex == particle2.mRowIndex) { + continue; + } + entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + } + } // end inner loop (Dbars) + } //end outer loop + registry.fill(HIST("hcountD0D0barPerEvent"), counterD0D0bar); + } +}; + +/// c-cbar correlator table builder - for MC gen-level analysis +struct CCbarCorrelatorMCGen { + + Produces entryD0D0barPair; + + HistogramRegistry registry{ + "registry", + {{"hMCEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, + {"hPtCandMCGen", "c,cbar particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hEtaMCGen", "c,cbar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hYMCGen", "c,cbar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCGen", "c,cbar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hcountD0D0barPerEvent", "D0,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for trigger counters"}; + + void init(o2::framework::InitContext&) + { + registry.add("hcountD0triggersMCGen", "c trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) + { + registry.fill(HIST("hMCEvtCount"), 0); + int counterccbar = 0, counterccbarPreEtasel = 0; + + //loop over particles at MC gen level + for (auto& particle1 : particlesMC) { + if (std::abs(particle1.pdgCode()) != 4) { //search c or cbar particles + continue; + } + int partMothPDG = particlesMC.iteratorAt(particle1.mother0()).pdgCode(); + //check whether mothers of quark c/cbar are still '4'/'-4' particles - in that case the c/cbar quark comes from its own fragmentation, skip it + if (partMothPDG == particle1.pdgCode()) { + continue; + } + counterccbarPreEtasel++; //count c or cbar (before kinematic selection) + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + continue; + } + registry.fill(HIST("hPtcandMCGen"), particle1.pt()); + registry.fill(HIST("hEtaMCGen"), particle1.eta()); + registry.fill(HIST("hPhiMCGen"), particle1.phi()); + registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + counterccbar++; //count if c or cbar don't come from themselves during fragmentation (after kinematic selection) + + //c-cbar correlation dedicated section + //if it's c, search for cbar and evaluate correlations. + if (particle1.pdgCode() == 4) { + + registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) + + for (auto& particle2 : particlesMC) { + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + continue; + } + if (particle2.pdgCode() == -4) { + //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it + if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == -4) { + continue; + } + entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + } // end outer if (check cbar) + } // end inner loop + } //end outer if (check c) + } //end outer loop + registry.fill(HIST("hcountCCbarPerEvent"), counterccbar); + registry.fill(HIST("hcountCCbarPerEventPreEtaCut"), counterccbarPreEtasel); + } +}; + +/// c-cbar correlator table builder - for MC gen-level analysis - Like Sign +struct CCbarCorrelatorMCGenLS { + + Produces entryD0D0barPair; + + HistogramRegistry registry{ + "registry", + {{"hMCEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, + {"hPtCandMCGen", "c,cbar particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hEtaMCGen", "c,cbar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hYMCGen", "c,cbar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCGen", "c,cbar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hcountD0D0barPerEvent", "D0,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for trigger counters"}; + + void init(o2::framework::InitContext&) + { + registry.add("hcountD0triggersMCGen", "c trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) + { + registry.fill(HIST("hMCEvtCount"), 0); + int counterccbar = 0, counterccbarPreEtasel = 0; + + //loop over particles at MC gen level + for (auto& particle1 : particlesMC) { + if (std::abs(particle1.pdgCode()) != 4) { //search c or cbar particles + continue; + } + int partMothPDG = particlesMC.iteratorAt(particle1.mother0()).pdgCode(); + //check whether mothers of quark c/cbar are still '4'/'-4' particles - in that case the c/cbar quark comes from its own fragmentation, skip it + if (partMothPDG == particle1.pdgCode()) { + continue; + } + counterccbarPreEtasel++; //count c or cbar (before kinematic selection) + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + continue; + } + registry.fill(HIST("hPtcandMCGen"), particle1.pt()); + registry.fill(HIST("hEtaMCGen"), particle1.eta()); + registry.fill(HIST("hPhiMCGen"), particle1.phi()); + registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + counterccbar++; //count if c or cbar don't come from themselves during fragmentation (after kinematic selection) + + //c-cbar correlation dedicated section + double ptParticle1 = particle1.pt(); //trigger particle is the largest pT one + registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) + + for (auto& particle2 : particlesMC) { + if (std::abs(particle2.pdgCode()) != 4) { //search c or cbar for associated particles + continue; + } + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + continue; + } + if (particle2.pt() < ptParticle1 && particle2.pdgCode() == particle1.pdgCode()) { + //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it + if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == particle2.pdgCode()) { + continue; + } + entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + } // end outer if (check PDG associate) + } // end inner loop + } //end outer loop + registry.fill(HIST("hcountCCbarPerEvent"), counterccbar); + registry.fill(HIST("hcountCCbarPerEventPreEtaCut"), counterccbarPreEtasel); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{}; + const bool doMCccbar = cfgc.options().get("doMCccbar"); + const bool doMCGen = cfgc.options().get("doMCGen"); + const bool doMCRec = cfgc.options().get("doMCRec"); + const bool doLikeSign = cfgc.options().get("doLikeSign"); + if (!doLikeSign) { //unlike-sign analyses + if (doMCGen) { //MC-Gen analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-gen"})); + } else if (doMCRec) { //MC-Reco analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-rec"})); + } else if (doMCccbar) { //MC-Reco analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"ccbar-correlator-mc-gen"})); + } else { //data analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator"})); + } + } else { //ike-sign analyses + if (doMCGen) { //MC-Gen analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-gen-ls"})); + } else if (doMCRec) { //MC-Reco analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-rec-ls"})); + } else if (doMCccbar) { //MC-Reco analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"ccbar-correlator-mc-gen-ls"})); + } else { //data analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-ls"})); + } + } + + return workflow; +} diff --git a/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx b/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx new file mode 100644 index 0000000000000..96431e56ea3f5 --- /dev/null +++ b/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx @@ -0,0 +1,864 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// 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 DplusDminusCorrelator.cxx +/// \brief Dplus-Dminus correlator task - data-like, MC-reco and MC-kine analyses. For ULS and LS pairs +/// +/// \author Fabio Colamaria , INFN Bari + +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "AnalysisCore/HFSelectorCuts.h" +#include "AnalysisDataModel/HFSecondaryVertex.h" +#include "AnalysisDataModel/HFCandidateSelectionTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod::hf_cand_prong3; +using namespace o2::analysis::hf_cuts_dplus_topikpi; +using namespace o2::framework::expressions; +using namespace o2::constants::math; +using namespace o2::aod::hf_ddbar_correlation; + +void customize(std::vector& workflowOptions) +{ +// ConfigParamSpec optionDoLikeSign{"doLikeSign", VariantType::Bool, false, {"Run Like-Sign analysis."}}; //TOLTO PER ORA + ConfigParamSpec optionDoMCccbar{"doMCccbar", VariantType::Bool, false, {"Run MC-Gen dedicated tasks."}}; + ConfigParamSpec optionDoMCGen{"doMCGen", VariantType::Bool, false, {"Run MC-Gen dedicated tasks."}}; + ConfigParamSpec optionDoMCRec{"doMCRec", VariantType::Bool, false, {"Run MC-Rec dedicated tasks."}}; +// workflowOptions.push_back(optionDoLikeSign); //TOLTO PER ORA + workflowOptions.push_back(optionDoMCccbar); + workflowOptions.push_back(optionDoMCGen); + workflowOptions.push_back(optionDoMCRec); +} + +#include "Framework/runDataProcessing.h" + +/// +/// Returns deltaPhi value in range [-pi/2., 3.*pi/2], typically used for correlation studies +/// +double getDeltaPhi(double phiD, double phiDbar) +{ + return RecoDecay::constrainAngle(phiDbar - phiD, -o2::constants::math::PI / 2.); +} + +/// definition of variables for DplusDminus pairs vs eta acceptance studies (hDDbarVsEtaCut, in data-like, MC-reco and MC-kine tasks) +const double maxEtaCut = 5.; +const double ptThresholdForMaxEtaCut = 10.; +const double incrementEtaCut = 0.1; +const double incrementPtThreshold = 0.5; +const double epsilon = 1E-5; + +/// Dplus-Dminus correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) +struct DplusDminusCorrelator { + Produces entryDplusDminusPair; + Produces entryDplusDminusRecoInfo; + + HistogramRegistry registry{ + "registry", + //NOTE: use hMassDplus for trigger normalisation (S*0.955), and hMass2DCorrelationPairs (in final task) for 2D-sideband-subtraction purposes + {{"hPtCand", "Dplus,Dminus candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng0", "Dplus,Dminus candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng1", "Dplus,Dminus candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hSelectionStatus", "Dplus,Dminus candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hEta", "Dplus,Dminus candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhi", "Dplus,Dminus candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hY", "Dplus,Dminus candidates;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hDDbarVsEtaCut", "Dplus,Dminus pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; + + Configurable dSelectionFlagDplus{"dSelectionFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_dplus_topikpi::pTBins_v}, "pT bin limits for candidate mass plots"}; + + void init(o2::framework::InitContext&) + { + registry.add("hMass", "Dplus,Dminus candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDplus", "Dplus,Dminus candidates;inv. mass Dplus only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDminus", "Dplus,Dminus candidates;inv. mass Dminus only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= dSelectionFlagDplus); + + void process(aod::Collision const& collision, soa::Filtered> const& candidates, aod::BigTracks const& tracks) + { + for (auto& candidate1 : candidates) { + if (cutYCandMax >= 0. && std::abs(YDPlus(candidate1)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + continue; + } + //check decay channel flag for candidate1 + if (!(candidate1.hfflag() & 1 << DPlusToPiKPi)) { //probably dummy since already selected? not sure... + continue; + } + int outerParticleSign = 1; //Dplus + auto outerSecondTrack = candidate1.index1_as(); + if (outerSecondTrack.sign()==1) { + outerParticleSign = -1; //Dminus (second daughter track is positive) + } + + //fill invariant mass plots and generic info from all Dplus/Dminus candidates + if (outerParticleSign==1) { + registry.fill(HIST("hMass"), InvMassDPlus(candidate1), candidate1.pt()); + registry.fill(HIST("hMassDplus"), InvMassDPlus(candidate1), candidate1.pt()); + } + else { + registry.fill(HIST("hMass"), InvMassDPlus(candidate1), candidate1.pt()); + registry.fill(HIST("hMassDminus"), InvMassDPlus(candidate1), candidate1.pt()); + } + 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"), YDPlus(candidate1)); + registry.fill(HIST("hSelectionStatus"), candidate1.isSelDplusToPiKPi()); + + //D-Dbar correlation dedicated section + //if the candidate is a Dplus, search for Dminus and evaluate correlations + if (outerParticleSign==1) { + for (auto& candidate2 : candidates) { + //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << DPlusToPiKPi)) { //probably dummy since already selected? not sure... + continue; + } + int innerParticleSign = 1; //Dplus + auto innerSecondTrack = candidate2.index1_as(); + if (innerSecondTrack.sign()==1) { + innerParticleSign = -1; //Dminus (second daughter track is positive) + } + if (innerParticleSign==-1) { + if (cutYCandMax >= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + continue; + } + //Excluding trigger self-correlations (possible in case of both mass hypotheses accepted) -> Dummy for D+D- + if (candidate1.mRowIndex == candidate2.mRowIndex) { + continue; + } + entryDplusDminusPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryDplusDminusRecoInfo(InvMassDPlus(candidate1), + InvMassDPlus(candidate2), + 0); + double etaCut = 0.; + double ptCut = 0.; + do { //fill pairs vs etaCut plot + ptCut = 0.; + etaCut += incrementEtaCut; + do { //fill pairs vs etaCut plot + if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) + registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + ptCut += incrementPtThreshold; + } while (ptCut < ptThresholdForMaxEtaCut - epsilon); + } while (etaCut < maxEtaCut - epsilon); + } + } // end inner loop (Dbars) + } + + } //end outer loop + } +}; + +/// Dplus-Dminus correlation pair builder - for MC reco-level analysis (candidates matched to true signal only, but also the various bkg sources are studied) +struct DplusDminusCorrelatorMCRec { + Produces entryDplusDminusPair; + Produces entryDplusDminusRecoInfo; + + HistogramRegistry registry{ + "registry", + //NOTE: use hMassDplus for trigger normalisation (S*0.955), and hMass2DCorrelationPairs (in final task) for 2D-sideband-subtraction purposes + {{"hPtCandMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng0MCRec", "Dplus,Dminus candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng1MCRec", "Dplus,Dminus candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hSelectionStatusMCRec", "Dplus,Dminus candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hEtaMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hYMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hDDbarVsEtaCut", "Dplus,Dminus pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; + + Configurable dSelectionFlagDplus{"dSelectionFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_dplus_topikpi::pTBins_v}, "pT bin limits for candidate mass plots"}; + + void init(o2::framework::InitContext&) + { + registry.add("hMassDplusMCRec", "Dplus,Dminus candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDminusMCRec", "Dplus,Dminus candidates - MC reco;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= dSelectionFlagDplus); + + void process(aod::Collision const& collision, soa::Filtered> const& candidates, aod::BigTracks const& tracks) + { + //MC reco level + bool flagDplusSignal = kFALSE; + bool flagDminusSignal = kFALSE; + for (auto& candidate1 : candidates) { + //check decay channel flag for candidate1 + if (!(candidate1.hfflag() & 1 << DPlusToPiKPi)) { + continue; + } + if (cutYCandMax >= 0. && std::abs(YDPlus(candidate1)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + continue; + } + int outerParticleSign = 1; //Dplus + auto outerSecondTrack = candidate1.index1_as(); + if (outerSecondTrack.sign()==1) { + outerParticleSign = -1; //Dminus (second daughter track is positive) + } + if (std::abs(candidate1.flagMCMatchRec()) == 1 << DPlusToPiKPi) { + //fill invariant mass plots and generic info from all Dplus/Dminus candidates + if (outerParticleSign==1) { //matched as Dplus + registry.fill(HIST("hMassDplusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); + } + else { //matched as Dminus + registry.fill(HIST("hMassDminusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); + } + registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); + registry.fill(HIST("hPtProng0MCRec"), candidate1.ptProng0()); + registry.fill(HIST("hPtProng1MCRec"), candidate1.ptProng1()); + registry.fill(HIST("hEtaMCRec"), candidate1.eta()); + registry.fill(HIST("hPhiMCRec"), candidate1.phi()); + registry.fill(HIST("hYMCRec"), YDPlus(candidate1)); + registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelDplusToPiKPi()); + } + + //D-Dbar correlation dedicated section + if (outerParticleSign==-1) { + continue; //reject Dminus in outer loop + } + if (std::abs(candidate1.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //candidate matched to Dplus (particle) + flagDplusSignal = kTRUE; + } else { //candidate of bkg, wrongly selected as Dplus + flagDplusSignal = kFALSE; + } + for (auto& candidate2 : candidates) { + if (!(candidate2.hfflag() & 1 << DPlusToPiKPi)) { //check decay channel flag for candidate2 + continue; + } + int innerParticleSign = 1; //Dplus + auto innerSecondTrack = candidate2.index1_as(); + if (innerSecondTrack.sign()==1) { + innerParticleSign = -1; //Dminus (second daughter track is positive) + } + + if (innerParticleSign==1) { + continue; //reject Dplus in outer loop + } + if (std::abs(candidate2.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //candidate matched to Dminus (antiparticle) + flagDminusSignal = kTRUE; + } else { //candidate of bkg, wrongly selected as Dminus + flagDminusSignal = kFALSE; + } + if (cutYCandMax >= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + continue; + } + //Excluding trigger self-correlations (possible in case of both mass hypotheses accepted) - Seems dummy for D+D- + if (candidate1.mRowIndex == candidate2.mRowIndex) { + continue; + } + //choice of options (Dplus/Dminus signal/bkg) + int pairSignalStatus = 0; //0 = bkg/bkg, 1 = bkg/sig, 2 = sig/bkg, 3 = sig/sig + if (flagDplusSignal) { + pairSignalStatus += 2; + } + if (flagDminusSignal) { + pairSignalStatus += 1; + } + entryDplusDminusPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryDplusDminusRecoInfo(InvMassDPlus(candidate1), + InvMassDPlus(candidate2), + pairSignalStatus); + double etaCut = 0.; + double ptCut = 0.; + do { //fill pairs vs etaCut plot + ptCut = 0.; + etaCut += incrementEtaCut; + do { //fill pairs vs etaCut plot + if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) + registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + ptCut += incrementPtThreshold; + } while (ptCut < ptThresholdForMaxEtaCut - epsilon); + } while (etaCut < maxEtaCut - epsilon); + } // end inner loop (Dbars) + + } //end outer loop + } +}; + +/// Dplus-Dminus correlation pair builder - for MC gen-level analysis (no filter/selection, only true signal) +struct DplusDminusCorrelatorMCGen { + + Produces entryDplusDminusPair; + + HistogramRegistry registry{ + "registry", + {{"hMCEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, + {"hPtCandMCGen", "Dplus,Dminus particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hEtaMCGen", "Dplus,Dminus particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCGen", "Dplus,Dminus particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hYMCGen", "Dplus,Dminus candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hcountDplusDminusPerEvent", "Dplus,Dminus particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}, + {"hDDbarVsEtaCut", "Dplus,Dminus pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; + + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_dplus_topikpi::pTBins_v}, "pT bin limits for candidate mass plots"}; + + void init(o2::framework::InitContext&) + { + registry.add("hcountDplustriggersMCGen", "Dplus trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) + { + int counterDplusDminus = 0; + registry.fill(HIST("hMCEvtCount"), 0); + //MC gen level + for (auto& particle1 : particlesMC) { + //check if the particle is Dplus or Dminus (for general plot filling and selection, so both cases are fine) - NOTE: decay channel is not probed! + if (std::abs(particle1.pdgCode()) != 411) { + continue; + } + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + continue; + } + registry.fill(HIST("hPtCandMCGen"), particle1.pt()); + registry.fill(HIST("hEtaMCGen"), particle1.eta()); + registry.fill(HIST("hPhiMCGen"), particle1.phi()); + registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + counterDplusDminus++; + + //D-Dbar correlation dedicated section + //if it's a Dplus particle, search for Dminus and evaluate correlations + if (particle1.pdgCode() == 411) { //just checking the particle PDG, not the decay channel (differently from Reco: you have a BR factor btw such levels!) + registry.fill(HIST("hcountDplustriggersMCGen"), 0, particle1.pt()); //to count trigger Dplus (for normalisation) + for (auto& particle2 : particlesMC) { + if (particle2.pdgCode() == -411) { + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + continue; + } + entryDplusDminusPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + double etaCut = 0.; + double ptCut = 0.; + do { //fill pairs vs etaCut plot + ptCut = 0.; + etaCut += incrementEtaCut; + do { //fill pairs vs etaCut plot + if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) + registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + ptCut += incrementPtThreshold; + } while (ptCut < ptThresholdForMaxEtaCut - epsilon); + } while (etaCut < maxEtaCut - epsilon); + } // end Dminus check + } //end inner loop + } //end Dplus check + + } //end outer loop + registry.fill(HIST("hcountDplusDminusPerEvent"), counterDplusDminus); + } +}; +/* +/// D0-D0bar correlation pair builder - LIKE SIGN - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) +struct DDbarCorrelatorLS { + + Produces entryD0D0barPair; + Produces entryD0D0barRecoInfo; + + 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, {{180, 0., 36.}}}}, + {"hPtProng0", "D0,D0bar candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng1", "D0,D0bar candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hSelectionStatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hEta", "D0,D0bar candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhi", "D0,D0bar candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hY", "D0,D0bar candidates;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; + + Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; + Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; + + void init(o2::framework::InitContext&) + { + registry.add("hMass", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassD0", "D0,D0bar candidates;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassD0bar", "D0,D0bar candidates;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + + void process(aod::Collision const& collision, soa::Filtered> const& candidates) + { + for (auto& candidate1 : candidates) { + //check decay channel flag for candidate1 + if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + continue; + } + if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + continue; + } + //fill invariant mass plots and generic info from all D0/D0bar candidates + if (candidate1.isSelD0() >= dSelectionFlagD0) { + registry.fill(HIST("hMass"), InvMassD0(candidate1), candidate1.pt()); + registry.fill(HIST("hMassD0"), InvMassD0(candidate1), candidate1.pt()); + } + if (candidate1.isSelD0bar() >= dSelectionFlagD0bar) { + registry.fill(HIST("hMass"), InvMassD0bar(candidate1), candidate1.pt()); + registry.fill(HIST("hMassD0bar"), InvMassD0bar(candidate1), candidate1.pt()); + } + 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"), YD0(candidate1)); + registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); + + double ptParticle1 = candidate1.pt(); //trigger particle is the largest-pT one + + //D-Dbar correlation dedicated section + //For like-sign, first loop on both D0 and D0bars. First candidate is for sure a D0 and D0bars (checked before, so don't re-check anything on it) + for (auto& candidate2 : candidates) { + //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << D0ToPiK)) { + continue; + } + //for the associated, has to have smaller pT, and pass D0sel if trigger passes D0sel, or D0barsel if trigger passes D0barsel + if (candidate2.pt() < ptParticle1 && ((candidate1.isSelD0() >= dSelectionFlagD0 && candidate2.isSelD0() >= dSelectionFlagD0) || (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate2.isSelD0bar() >= dSelectionFlagD0bar))) { + if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + continue; + } + //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + if (candidate1.mRowIndex == candidate2.mRowIndex) { + continue; + } + entryD0D0barPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryD0D0barRecoInfo(InvMassD0(candidate1), + InvMassD0bar(candidate2), + 0); + } + //note: candidates selected as both D0 and D0bar are used, and considered in both situation (but not auto-correlated): reflections could play a relevant role. + //another, more restrictive, option, could be to consider only candidates selected with a single option (D0 xor D0bar) + + } // end inner loop (Dbars) + + } //end outer loop + } +}; + +/// D0-D0bar correlation pair builder - LIKE SIGN - for MC reco analysis (data-like but matching to true DO and D0bar) +struct D0D0barCorrelatorMCRecLS { + + Produces entryD0D0barPair; + Produces entryD0D0barRecoInfo; + + HistogramRegistry registry{ + "registry", + //NOTE: use hMassD0 for trigger normalisation (S*0.955), and hMass2DCorrelationPairs (in final task) for 2D-sideband-subtraction purposes + {{"hPtCandMCRec", "D0,D0bar candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng0MCRec", "D0,D0bar candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng1MCRec", "D0,D0bar candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hSelectionStatusMCRec", "D0,D0bar candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hEtaMCRec", "D0,D0bar candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCRec", "D0,D0bar candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hYMCRec", "D0,D0bar candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; + + Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; + Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; + + void init(o2::framework::InitContext&) + { + registry.add("hMassD0MCRec", "D0,D0bar candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassD0barMCRec", "D0,D0bar candidates - MC reco;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + + void process(aod::Collision const& collision, soa::Filtered> const& candidates) + { + //MC reco level + for (auto& candidate1 : candidates) { + //check decay channel flag for candidate1 + if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + continue; + } + if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + continue; + } + if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { + //fill invariant mass plots and generic info from all D0/D0bar candidates + if (candidate1.isSelD0() >= dSelectionFlagD0 && candidate1.flagMCMatchRec() == D0ToPiK) { //only reco and matched as D0 + registry.fill(HIST("hMassD0MCRec"), InvMassD0(candidate1)); + } + if (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == D0ToPiK) { //only reco and matched as D0bar + registry.fill(HIST("hMassD0barMCRec"), InvMassD0bar(candidate1)); + } + registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); + registry.fill(HIST("hPtprong0MCRec"), candidate1.ptProng0()); + registry.fill(HIST("hPtprong1MCRec"), candidate1.ptProng1()); + registry.fill(HIST("hEtaMCRec"), candidate1.eta()); + registry.fill(HIST("hPhiMCRec"), candidate1.phi()); + registry.fill(HIST("hYMCRec"), YD0(candidate1)); + + double ptParticle1 = candidate1.pt(); //trigger particle is the largest pT one + + //D-Dbar correlation dedicated section + //For like-sign, first loop on both D0 and D0bars. First candidate is for sure a D0 and D0bars (looping on filtered) and was already matched, so don't re-check anything on it) + for (auto& candidate2 : candidates) { + //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << D0ToPiK)) { + continue; + } + bool conditionLSForD0 = (candidate1.isSelD0() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == 1 << D0ToPiK) && (candidate2.isSelD0() >= dSelectionFlagD0bar && candidate2.flagMCMatchRec() == 1 << D0ToPiK); + bool conditionLSForD0bar = (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << D0ToPiK) && (candidate2.isSelD0bar() >= dSelectionFlagD0bar && candidate2.flagMCMatchRec() == -1 << D0ToPiK); + if (candidate2.pt() < ptParticle1 && (conditionLSForD0 || conditionLSForD0bar)) { //LS pair (of D0 or of D0bar) + pt2= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + continue; + } + //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + if (candidate1.mRowIndex == candidate2.mRowIndex) { + continue; + } + entryD0D0barPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryD0D0barRecoInfo(InvMassD0(candidate1), + InvMassD0bar(candidate2), + 0); //for LS studies we set a dummy 0 for pairSignalStatus (there are no more the usual 4 possible combinations) + + } //end inner if (MC match) + + } // end inner loop (Dbars) + } //end outer if (MC match) + } //end outer loop + } +}; + +/// D0-D0bar correlation pair builder - for MC gen-level analysis, like sign particles +struct D0D0barCorrelatorMCGenLS { + + Produces entryD0D0barPair; + + HistogramRegistry registry{ + "registry", + {{"hMCEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, + {"hPtCandMCGen", "D0,D0bar particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hEtaMCGen", "D0,D0bar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCGen", "D0,D0bar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hYMCGen", "D0,D0bar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hcountD0D0barPerEvent", "D0,D0bar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for trigger counters"}; + + void init(o2::framework::InitContext&) + { + registry.add("hcountD0triggersMCGen", "D0 trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) + { + int counterD0D0bar = 0; + registry.fill(HIST("hMCEvtCount"), 0); + //MC gen level + for (auto& particle1 : particlesMC) { + //check if the particle is D0 or D0bar (both can be trigger) - NOTE: decay channel is not probed! + if (std::abs(particle1.pdgCode()) != 421) { + continue; + } + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + continue; + } + + double ptParticle1 = particle1.pt(); //trigger particle is the largest pT one + + registry.fill(HIST("hPtCandMCGen"), particle1.pt()); + registry.fill(HIST("hEtaMCGen"), particle1.eta()); + registry.fill(HIST("hPhiMCGen"), particle1.phi()); + registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + counterD0D0bar++; + //D-Dbar correlation dedicated section + //if it's D0, search for D0bar and evaluate correlations. + registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger D0 (normalisation) + for (auto& particle2 : particlesMC) { + if (std::abs(particle2.pdgCode()) != 421) { //check that associated is a D0/D0bar (both are fine) + continue; + } + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + continue; + } + if (particle2.pt() < ptParticle1 && particle2.pdgCode() == particle1.pdgCode()) { //like-sign condition (both 421 or both -421) and pT_Trig>pT_assoc + //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + if (particle1.mRowIndex == particle2.mRowIndex) { + continue; + } + entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + } + } // end inner loop (Dbars) + } //end outer loop + registry.fill(HIST("hcountD0D0barPerEvent"), counterD0D0bar); + } +}; +*/ +/// c-cbar correlator table builder - for MC gen-level analysis +struct CCbarCorrelatorMCGen { + + Produces entryD0D0barPair; + + HistogramRegistry registry{ + "registry", + {{"hMCEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, + {"hPtCandMCGen", "c,cbar particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hEtaMCGen", "c,cbar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hYMCGen", "c,cbar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCGen", "c,cbar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hcountD0D0barPerEvent", "D0,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for trigger counters"}; + + void init(o2::framework::InitContext&) + { + registry.add("hcountD0triggersMCGen", "c trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) + { + registry.fill(HIST("hMCEvtCount"), 0); + int counterccbar = 0, counterccbarPreEtasel = 0; + + //loop over particles at MC gen level + for (auto& particle1 : particlesMC) { + if (std::abs(particle1.pdgCode()) != 4) { //search c or cbar particles + continue; + } + int partMothPDG = particlesMC.iteratorAt(particle1.mother0()).pdgCode(); + //check whether mothers of quark c/cbar are still '4'/'-4' particles - in that case the c/cbar quark comes from its own fragmentation, skip it + if (partMothPDG == particle1.pdgCode()) { + continue; + } + counterccbarPreEtasel++; //count c or cbar (before kinematic selection) + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + continue; + } + registry.fill(HIST("hPtcandMCGen"), particle1.pt()); + registry.fill(HIST("hEtaMCGen"), particle1.eta()); + registry.fill(HIST("hPhiMCGen"), particle1.phi()); + registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + counterccbar++; //count if c or cbar don't come from themselves during fragmentation (after kinematic selection) + + //c-cbar correlation dedicated section + //if it's c, search for cbar and evaluate correlations. + if (particle1.pdgCode() == 4) { + + registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) + + for (auto& particle2 : particlesMC) { + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + continue; + } + if (particle2.pdgCode() == -4) { + //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it + if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == -4) { + continue; + } + entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + } // end outer if (check cbar) + } // end inner loop + } //end outer if (check c) + } //end outer loop + registry.fill(HIST("hcountCCbarPerEvent"), counterccbar); + registry.fill(HIST("hcountCCbarPerEventPreEtaCut"), counterccbarPreEtasel); + } +}; +/* +/// c-cbar correlator table builder - for MC gen-level analysis - Like Sign +struct CCbarCorrelatorMCGenLS { + + Produces entryD0D0barPair; + + HistogramRegistry registry{ + "registry", + {{"hMCEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, + {"hPtCandMCGen", "c,cbar particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hEtaMCGen", "c,cbar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hYMCGen", "c,cbar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCGen", "c,cbar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hcountD0D0barPerEvent", "D0,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for trigger counters"}; + + void init(o2::framework::InitContext&) + { + registry.add("hcountD0triggersMCGen", "c trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) + { + registry.fill(HIST("hMCEvtCount"), 0); + int counterccbar = 0, counterccbarPreEtasel = 0; + + //loop over particles at MC gen level + for (auto& particle1 : particlesMC) { + if (std::abs(particle1.pdgCode()) != 4) { //search c or cbar particles + continue; + } + int partMothPDG = particlesMC.iteratorAt(particle1.mother0()).pdgCode(); + //check whether mothers of quark c/cbar are still '4'/'-4' particles - in that case the c/cbar quark comes from its own fragmentation, skip it + if (partMothPDG == particle1.pdgCode()) { + continue; + } + counterccbarPreEtasel++; //count c or cbar (before kinematic selection) + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + continue; + } + registry.fill(HIST("hPtcandMCGen"), particle1.pt()); + registry.fill(HIST("hEtaMCGen"), particle1.eta()); + registry.fill(HIST("hPhiMCGen"), particle1.phi()); + registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + counterccbar++; //count if c or cbar don't come from themselves during fragmentation (after kinematic selection) + + //c-cbar correlation dedicated section + double ptParticle1 = particle1.pt(); //trigger particle is the largest pT one + registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) + + for (auto& particle2 : particlesMC) { + if (std::abs(particle2.pdgCode()) != 4) { //search c or cbar for associated particles + continue; + } + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + continue; + } + if (particle2.pt() < ptParticle1 && particle2.pdgCode() == particle1.pdgCode()) { + //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it + if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == particle2.pdgCode()) { + continue; + } + entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + } // end outer if (check PDG associate) + } // end inner loop + } //end outer loop + registry.fill(HIST("hcountCCbarPerEvent"), counterccbar); + registry.fill(HIST("hcountCCbarPerEventPreEtaCut"), counterccbarPreEtasel); + } +}; +*/ +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{}; + const bool doMCccbar = cfgc.options().get("doMCccbar"); + const bool doMCGen = cfgc.options().get("doMCGen"); + const bool doMCRec = cfgc.options().get("doMCRec"); +// const bool doLikeSign = cfgc.options().get("doLikeSign"); +// if (!doLikeSign) { //unlike-sign analyses + if (doMCGen) { //MC-Gen analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-mc-gen"})); + } else if (doMCRec) { //MC-Reco analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-mc-rec"})); + } else if (doMCccbar) { //MC-Reco analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"ccbar-correlator-mc-gen"})); + } else { //data analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator"})); + } +//} + /* else { //like-sign analyses //FABIO -> QUESTE NON MODIFICATE! + if (doMCGen) { //MC-Gen analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-gen-ls"})); + } else if (doMCRec) { //MC-Reco analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-rec-ls"})); + } else if (doMCccbar) { //MC-Reco analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"ccbar-correlator-mc-gen-ls"})); + } else { //data analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-ls"})); + } + } +*/ + return workflow; +} diff --git a/Analysis/Tasks/PWGHF/HFDplusToPiKPiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFDplusToPiKPiCandidateSelector.cxx index 247a1f9f9a675..6b65fb4ced105 100644 --- a/Analysis/Tasks/PWGHF/HFDplusToPiKPiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFDplusToPiKPiCandidateSelector.cxx @@ -225,10 +225,10 @@ struct HFDplusToPiKPiCandidateSelector { auto trackPos2 = hfCandProng3.index2_as(); //positive daughter (negative for the antiparticles) // daughter track validity selection - if (!daughterSelection(trackPos1) || !daughterSelection(trackNeg1) || !daughterSelection(trackPos2)) { - hfSelDplusToPiKPiCandidate(statusDplusToPiKPi); - continue; - } +// if (!daughterSelection(trackPos1) || !daughterSelection(trackNeg1) || !daughterSelection(trackPos2)) { +// hfSelDplusToPiKPiCandidate(statusDplusToPiKPi); +// continue; +// } // topological selection if (!selection(hfCandProng3, trackPos1, trackNeg1, trackPos2)) { @@ -237,14 +237,14 @@ struct HFDplusToPiKPiCandidateSelector { } // pid selection - auto pionPlus1 = selectionPID(trackPos1, kPiPlus); - auto kaonMinus = selectionPID(trackNeg1, kKPlus); - auto pionPlus2 = selectionPID(trackPos2, kPiPlus); +// auto pionPlus1 = selectionPID(trackPos1, kPiPlus); +// auto kaonMinus = selectionPID(trackNeg1, kKPlus); +// auto pionPlus2 = selectionPID(trackPos2, kPiPlus); - if (pionPlus1 == 0 || kaonMinus == 0 || pionPlus2 == 0) { //exclude Dplus for PID - hfSelDplusToPiKPiCandidate(statusDplusToPiKPi); - continue; - } +// if (pionPlus1 == 0 || kaonMinus == 0 || pionPlus2 == 0) { //exclude Dplus for PID +// hfSelDplusToPiKPiCandidate(statusDplusToPiKPi); +// continue; +// } statusDplusToPiKPi = 1; hfSelDplusToPiKPiCandidate(statusDplusToPiKPi); diff --git a/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx b/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx new file mode 100644 index 0000000000000..b1437703d332e --- /dev/null +++ b/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx @@ -0,0 +1,481 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// 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 taskDDbarCorrelation.cxx +/// \brief D-Dbar analysis task - data-like, MC-reco and MC-kine analyses. For ULS and LS pairs +/// +/// \author Fabio Colamaria , INFN Bari + +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "AnalysisCore/HFSelectorCuts.h" +#include "AnalysisDataModel/HFSecondaryVertex.h" +#include "AnalysisDataModel/HFCandidateSelectionTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod::hf_cand_prong2; +using namespace o2::analysis::hf_cuts_d0_topik; +using namespace o2::framework::expressions; +using namespace o2::constants::math; +using namespace o2::aod::hf_ddbar_correlation; + +namespace o2::aod +{ +using DDbarPairFull = soa::Join; +} // namespace o2::aod + +void customize(std::vector& workflowOptions) +{ + ConfigParamSpec optionDoMCGen{"doMCGen", VariantType::Bool, false, {"Run MC-Gen dedicated tasks."}}; + ConfigParamSpec optionDoMCRec{"doMCRec", VariantType::Bool, false, {"Run MC-Rec dedicated tasks."}}; + workflowOptions.push_back(optionDoMCGen); + workflowOptions.push_back(optionDoMCRec); +} + +#include "Framework/runDataProcessing.h" + +/// +/// Returns deltaPhi value in range [-pi/2., 3.*pi/2], typically used for correlation studies +/// +double getDeltaPhi(double phiD, double phiDbar) +{ + return RecoDecay::constrainAngle(phiDbar - phiD, -o2::constants::math::PI / 2.); +} + +/// +/// Returns deltaPhi value in range [-pi, pi], for resolution distributions +/// +double getDeltaPhiForResolution(double phiD, double phiDbar) +{ + return RecoDecay::constrainAngle(phiDbar - phiD, -o2::constants::math::PI); +} + +/// +/// Returns phi of candidate/particle evaluated from x and y components of segment connecting primary and secondary vertices +/// +double evaluatePhiByVertex(double xVertex1, double xVertex2, double yVertex1, double yVertex2) +{ + return RecoDecay::Phi(xVertex2 - xVertex1, yVertex2 - yVertex1); +} +/* +/// definition of axes for THnSparse (dPhi,dEta,pTD,pTDbar) - note: last two axis are dummy, will be replaced later +const int nBinsSparse[4] = {32,120,10,10}; +const double binMinSparse[4] = {-o2::constants::math::PI / 2.,-6.,0.,0.; //is the minimum for all the bins +const double binMaxSparse[4] = {3. * o2::constants::math::PI / 2.,6.,10.,10.}; //is the maximum for all the bins +*/ + +/// D-Dbar correlation pair filling task, from pair tables - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) +/// Works on both USL and LS analyses pair tables +struct TaskDDbarCorrelation { + + HistogramRegistry registry{ + "registry", + //NOTE: use hMassD0 (from correlator task) for normalisation, and hMass2DCorrelationPairs for 2D-sideband-subtraction purposes + {{"hMass2DCorrelationPairs", "D,Dbar candidates 2D;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaEtaPtIntSignalRegion", "D,Dbar candidates signal region;#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSignalRegion", "D,Dbar candidates signal region;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSignalRegion", "D,Dbar candidates signal region;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtSignalRegion", "D,Dbar candidates signal region;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarSignalRegion", "D,Dbar candidates signal region;#it{p}_{T}^{Dbar}-#it{p}_{T}^{D};entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSignalRegion", "D,Dbar candidates signal region;#it{p}_{T}^{max}-#it{p}_{T}^{min};entries", {HistType::kTH1F, {{72, 0., 36.}}}}, + {"hDeltaEtaPtIntSidebands", "D,Dbar candidates sidebands;#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSidebands", "D,Dbar candidates sidebands;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSidebands", "D,Dbar candidates sidebands;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtSidebands", "D,Dbar candidates sidebands;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarSidebands", "D,Dbar candidates sidebands;#it{p}_{T}^{Dbar}-#it{p}_{T}^{D};entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSidebands", "D,Dbar candidates sidebands;#it{p}_{T}^{max}-#it{p}_{T}^{min};entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; + + //pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_topik (i.e. the mass pT bins), but can be redefined via json files + Configurable> binsCorrelations{"ptBinsForCorrelations", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for correlation plots"}; + //signal and sideband region edges, to be defined via json file (initialised to empty) + Configurable> signalRegionInner{"signalRegionInner", std::vector(), "Inner values of signal region vs pT"}; + Configurable> signalRegionOuter{"signalRegionOuter", std::vector(), "Outer values of signal region vs pT"}; + Configurable> sidebandLeftInner{"sidebandLeftInner", std::vector(), "Inner values of left sideband vs pT"}; + Configurable> sidebandLeftOuter{"sidebandLeftOuter", std::vector(), "Outer values of left sideband vs pT"}; + Configurable> sidebandRightInner{"sidebandRightInner", std::vector(), "Inner values of right sideband vs pT"}; + Configurable> sidebandRightOuter{"sidebandRightOuter", std::vector(), "Outer values of right sideband vs pT"}; + + void init(o2::framework::InitContext&) + { + // redefinition of pT axes for THnSparse holding correlation entries + int nBinspTaxis = binsCorrelations->size() - 1; + const double* valuespTaxis = binsCorrelations->data(); + + for (int i = 2; i <= 3; i++) { + registry.get(HIST("hMass2DCorrelationPairs"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hCorrel2DVsPtSignalRegion"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hCorrel2DVsPtSidebands"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + } + } + + void process(aod::DDbarPairFull const& pairEntries) + { + for (auto& pairEntry : pairEntries) { + //define variables for widely used quantities + double deltaPhi = pairEntry.deltaPhi(); + double deltaEta = pairEntry.deltaEta(); + double ptD = pairEntry.ptD(); + double ptDbar = pairEntry.ptDbar(); + double massD = pairEntry.mD(); + double massDbar = pairEntry.mDbar(); + + //reject entries outside pT ranges of interest + double minPtAllowed = binsCorrelations->at(0); + double maxPtAllowed = binsCorrelations->at(binsCorrelations->size()-1); + if (ptD < minPtAllowed || ptDbar < minPtAllowed || ptD > maxPtAllowed || ptDbar > maxPtAllowed) { + continue; + } + + //fill 2D invariant mass plots + registry.fill(HIST("hMass2DCorrelationPairs"), massD, massDbar, ptD, ptDbar); + + //check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots + int pTBinD = o2::analysis::findBin(binsCorrelations, ptD); + int pTBinDbar = o2::analysis::findBin(binsCorrelations, ptDbar); + + if (massD > signalRegionInner->at(pTBinD) && massD < signalRegionOuter->at(pTBinD) && massDbar > signalRegionInner->at(pTBinDbar) && massDbar < signalRegionOuter->at(pTBinDbar)) { + //in signal region + registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptDbar); + registry.fill(HIST("hCorrel2DPtIntSignalRegion"), deltaPhi, deltaEta); + registry.fill(HIST("hDeltaEtaPtIntSignalRegion"), deltaEta); + registry.fill(HIST("hDeltaPhiPtIntSignalRegion"), deltaPhi); + registry.fill(HIST("hDeltaPtDDbarSignalRegion"), ptDbar - ptD); + registry.fill(HIST("hDeltaPtMaxMinSignalRegion"), std::abs(ptDbar - ptD)); + } + + if ((pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandLeftOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar)) || + (pairEntry.mD() > sidebandRightInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar)) || + (pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandLeftOuter->at(pTBinDbar)) || + (pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandRightInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar))) { + //in sideband region + registry.fill(HIST("hCorrel2DVsPtSidebands"), deltaPhi, deltaEta, ptD, ptDbar); + registry.fill(HIST("hCorrel2DPtIntSidebands"), deltaPhi, deltaEta); + registry.fill(HIST("hDeltaEtaPtIntSidebands"), deltaEta); + registry.fill(HIST("hDeltaPhiPtIntSidebands"), deltaPhi); + registry.fill(HIST("hDeltaPtDDbarSidebands"), ptDbar - ptD); + registry.fill(HIST("hDeltaPtMaxMinSidebands"), std::abs(ptDbar - ptD)); + } + } //end loop + } +}; + +/// D-Dbar correlation pair filling task, from pair tables - for MC reco-level analysis (candidates matched to true signal only, but also bkg sources are studied) +/// Works on both USL and LS analyses pair tables +struct TaskDDbarCorrelationMCRec { + + HistogramRegistry registry{ + "registry", + //NOTE: use hMassD0 (from correlator task) for normalisation, and hMass2DCorrelationPairs for 2D-sideband-subtraction purposes + {{"hMass2DCorrelationPairsMCRecSigSig", "D,Dbar candidates 2D SigSig - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hMass2DCorrelationPairsMCRecSigBkg", "D,Dbar candidates 2D SigBkg - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hMass2DCorrelationPairsMCRecBkgSig", "D,Dbar candidates 2D BkgSig - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hMass2DCorrelationPairsMCRecBkgBkg", "D,Dbar candidates 2D BkgBkg - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaEtaPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hDeltaPtDDbarSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;#it{p}_{T}^{Dbar}-#it{p}_{T}^{D};entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;#it{p}_{T}^{max}-#it{p}_{T}^{min};entries", {HistType::kTH1F, {{72, 0., 36.}}}}, + {"hCorrel2DVsPtSignalRegionMCRecSigSig", "D,Dbar candidates signal region SigSig - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSignalRegionMCRecSigBkg", "D,Dbar candidates signal region SigBkg - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSignalRegionMCRecBkgSig", "D,Dbar candidates signal region BkgSig - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSignalRegionMCRecBkgBkg", "D,Dbar candidates signal region BkgBkg - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaEtaPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtSidebandsMCRecSigSig", "D,Dbar candidates sidebands SigSig - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - should be empty, kept for cross-check and debug + {"hCorrel2DVsPtSidebandsMCRecSigBkg", "D,Dbar candidates sidebands SigBkg - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSidebandsMCRecBkgSig", "D,Dbar candidates sidebands BkgSig - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSidebandsMCRecBkgBkg", "D,Dbar candidates sidebands BkgBkg - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarSidebandsMCRec", "D,Dbar candidates signal region - MC reco;#it{p}_{T}^{Dbar}-#it{p}_{T}^{D};entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSidebandsMCRec", "D,Dbar candidates signal region - MC reco;#it{p}_{T}^{max}-#it{p}_{T}^{min};entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; + + //pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_topik (i.e. the mass pT bins), but can be redefined via json files + Configurable> binsCorrelations{"ptBinsForCorrelations", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for correlation plots"}; + //signal and sideband region edges, to be defined via json file (initialised to empty) + Configurable> signalRegionInner{"signalRegionInner", std::vector(), "Inner values of signal region vs pT"}; + Configurable> signalRegionOuter{"signalRegionOuter", std::vector(), "Outer values of signal region vs pT"}; + Configurable> sidebandLeftInner{"sidebandLeftInner", std::vector(), "Inner values of left sideband vs pT"}; + Configurable> sidebandLeftOuter{"sidebandLeftOuter", std::vector(), "Outer values of left sideband vs pT"}; + Configurable> sidebandRightInner{"sidebandRightInner", std::vector(), "Inner values of right sideband vs pT"}; + Configurable> sidebandRightOuter{"sidebandRightOuter", std::vector(), "Outer values of right sideband vs pT"}; + + void init(o2::framework::InitContext&) + { + // redefinition of pT axes for THnSparse holding correlation entries + int nBinspTaxis = binsCorrelations->size() - 1; + const double* valuespTaxis = binsCorrelations->data(); + + for (int i = 2; i <= 3; i++) { + registry.get(HIST("hMass2DCorrelationPairsMCRecSigSig"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hMass2DCorrelationPairsMCRecSigBkg"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hMass2DCorrelationPairsMCRecBkgSig"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hMass2DCorrelationPairsMCRecBkgBkg"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hCorrel2DVsPtSignalRegionMCRecSigSig"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hCorrel2DVsPtSignalRegionMCRecSigBkg"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hCorrel2DVsPtSignalRegionMCRecBkgSig"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hCorrel2DVsPtSignalRegionMCRecBkgBkg"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hCorrel2DVsPtSidebandsMCRecSigSig"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hCorrel2DVsPtSidebandsMCRecSigBkg"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hCorrel2DVsPtSidebandsMCRecBkgSig"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + registry.get(HIST("hCorrel2DVsPtSidebandsMCRecBkgBkg"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + } + } + + void process(aod::DDbarPairFull const& pairEntries) + { + for (auto& pairEntry : pairEntries) { + //define variables for widely used quantities + double deltaPhi = pairEntry.deltaPhi(); + double deltaEta = pairEntry.deltaEta(); + double ptD = pairEntry.ptD(); + double ptDbar = pairEntry.ptDbar(); + + //reject entries outside pT ranges of interest + double minPtAllowed = binsCorrelations->at(0); + double maxPtAllowed = binsCorrelations->at(binsCorrelations->size()-1); + if (ptD < minPtAllowed || ptDbar < minPtAllowed || ptD > maxPtAllowed || ptDbar > maxPtAllowed) { + continue; + } + + //fill 2D invariant mass plots + switch (pairEntry.signalStatus()) { + case 0: //D Bkg, Dbar Bkg + registry.fill(HIST("hMass2DCorrelationPairsMCRecBkgBkg"), pairEntry.mD(), pairEntry.mDbar(), ptD, ptDbar); + break; + case 1: //D Bkg, Dbar Sig + registry.fill(HIST("hMass2DCorrelationPairsMCRecBkgSig"), pairEntry.mD(), pairEntry.mDbar(), ptD, ptDbar); + break; + case 2: //D Sig, Dbar Bkg + registry.fill(HIST("hMass2DCorrelationPairsMCRecSigBkg"), pairEntry.mD(), pairEntry.mDbar(), ptD, ptDbar); + break; + case 3: //D Sig, Dbar Sig + registry.fill(HIST("hMass2DCorrelationPairsMCRecSigSig"), pairEntry.mD(), pairEntry.mDbar(), ptD, ptDbar); + break; + default: //should not happen for MC reco + break; + } + + //check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots + int pTBinD = o2::analysis::findBin(binsCorrelations, ptD); + int pTBinDbar = o2::analysis::findBin(binsCorrelations, ptDbar); + + if (pairEntry.mD() > signalRegionInner->at(pTBinD) && pairEntry.mD() < signalRegionOuter->at(pTBinD) && pairEntry.mDbar() > signalRegionInner->at(pTBinDbar) && pairEntry.mDbar() < signalRegionOuter->at(pTBinDbar)) { + //in signal region + registry.fill(HIST("hCorrel2DPtIntSignalRegionMCRec"), deltaPhi, deltaEta); + registry.fill(HIST("hDeltaEtaPtIntSignalRegionMCRec"), deltaEta); + registry.fill(HIST("hDeltaPhiPtIntSignalRegionMCRec"), deltaPhi); + registry.fill(HIST("hDeltaPtDDbarSignalRegionMCRec"), ptDbar - ptD); + registry.fill(HIST("hDeltaPtMaxMinSignalRegionMCRec"), std::abs(ptDbar - ptD)); + switch (pairEntry.signalStatus()) { + case 0: //D Bkg, Dbar Bkg + registry.fill(HIST("hCorrel2DVsPtSignalRegionMCRecBkgBkg"), deltaPhi, deltaEta, ptD, ptDbar); + break; + case 1: //D Bkg, Dbar Sig + registry.fill(HIST("hCorrel2DVsPtSignalRegionMCRecBkgSig"), deltaPhi, deltaEta, ptD, ptDbar); + break; + case 2: //D Sig, Dbar Bkg + registry.fill(HIST("hCorrel2DVsPtSignalRegionMCRecSigBkg"), deltaPhi, deltaEta, ptD, ptDbar); + break; + case 3: //D Sig, Dbar Sig + registry.fill(HIST("hCorrel2DVsPtSignalRegionMCRecSigSig"), deltaPhi, deltaEta, ptD, ptDbar); + break; + default: //should not happen for MC reco + break; + } + } + + if ((pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandLeftOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar)) || + (pairEntry.mD() > sidebandRightInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar)) || + (pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandLeftOuter->at(pTBinDbar)) || + (pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandRightInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar))) { + //in sideband region + registry.fill(HIST("hCorrel2DPtIntSidebandsMCRec"), deltaPhi, deltaEta); + registry.fill(HIST("hDeltaEtaPtIntSidebandsMCRec"), deltaEta); + registry.fill(HIST("hDeltaPhiPtIntSidebandsMCRec"), deltaPhi); + registry.fill(HIST("hDeltaPtDDbarSidebandsMCRec"), ptDbar - ptD); + registry.fill(HIST("hDeltaPtMaxMinSidebandsMCRec"), std::abs(ptDbar - ptD)); + switch (pairEntry.signalStatus()) { + case 0: //D Bkg, Dbar Bkg + registry.fill(HIST("hCorrel2DVsPtSidebandsMCRecBkgBkg"), deltaPhi, deltaEta, ptD, ptDbar); + break; + case 1: //D Bkg, Dbar Sig + registry.fill(HIST("hCorrel2DVsPtSidebandsMCRecBkgSig"), deltaPhi, deltaEta, ptD, ptDbar); + break; + case 2: //D Sig, Dbar Bkg + registry.fill(HIST("hCorrel2DVsPtSidebandsMCRecSigBkg"), deltaPhi, deltaEta, ptD, ptDbar); + break; + case 3: //D Sig, Dbar Sig + registry.fill(HIST("hCorrel2DVsPtSidebandsMCRecSigSig"), deltaPhi, deltaEta, ptD, ptDbar); + break; + default: //should not happen for MC reco + break; + } + } + } //end loop + } +}; + +/// D-Dbar correlation pair filling task, from pair tables - for MC gen-level analysis (no filter/selection, only true signal) - Ok for both USL and LS analyses +/// Works on both USL and LS analyses pair tables (and if tables are filled with quark pairs as well) +struct TaskDDbarCorrelationMCGen { + + HistogramRegistry registry{ + "registry", + {{"hDeltaEtaPtIntMCGen", "D,Dbar particles - MC gen;#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntMCGen", "D,Dbar particles - MC gen;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntMCGen", "D,Dbar particles - MC gen;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtMCGen", "D,Dbar particles - MC gen;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarMCGen", "D,Dbar particles - MC gen;#it{p}_{T}^{Dbar}-#it{p}_{T}^{D};entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinMCGen", "D,Dbar particles - MC gen;#it{p}_{T}^{max}-#it{p}_{T}^{min};entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; + + //pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_topik (i.e. the mass pT bins), but can be redefined via json files + Configurable> binsCorrelations{"ptBinsForCorrelations", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for correlation plots"}; + + void init(o2::framework::InitContext&) + { + // redefinition of pT axes for THnSparse holding correlation entries + int nBinspTaxis = binsCorrelations->size() - 1; + const double* valuespTaxis = binsCorrelations->data(); + + for (int i = 2; i <= 3; i++) { + registry.get(HIST("hCorrel2DVsPtMCGen"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); + } + } + + void process(aod::DDbarPair const& pairEntries) + { + for (auto& pairEntry : pairEntries) { + //define variables for widely used quantities + double deltaPhi = pairEntry.deltaPhi(); + double deltaEta = pairEntry.deltaEta(); + double ptD = pairEntry.ptD(); + double ptDbar = pairEntry.ptDbar(); + + //reject entries outside pT ranges of interest + double minPtAllowed = binsCorrelations->at(0); + double maxPtAllowed = binsCorrelations->at(binsCorrelations->size()-1); + if (ptD < minPtAllowed || ptDbar < minPtAllowed || ptD > maxPtAllowed || ptDbar > maxPtAllowed) { + continue; + } + + registry.fill(HIST("hCorrel2DVsPtMCGen"), deltaPhi, deltaEta, ptD, ptDbar); + registry.fill(HIST("hCorrel2DPtIntMCGen"), deltaPhi, deltaEta); + registry.fill(HIST("hDeltaEtaPtIntMCGen"), deltaEta); + registry.fill(HIST("hDeltaPhiPtIntMCGen"), deltaPhi); + registry.fill(HIST("hDeltaPtDDbarMCGen"), ptDbar - ptD); + registry.fill(HIST("hDeltaPtMaxMinMCGen"), std::abs(ptDbar - ptD)); + } //end loop + } +}; + +/// checks phi resolution for standard definition and sec-vtx based definition +struct TaskDDbarCorrelationCheckPhiResolution { + + HistogramRegistry registry{ + "registry", + {{"hMass", "D,Dbar candidates;inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{120, 1.5848, 2.1848}}}}, + {"hEta", "D,Dbar candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiStdPhi", "D,Dbar candidates;candidate #it{#varphi};#it{p}_{T}", {HistType::kTH2F, {{128, 0., 2. * o2::constants::math::PI}, {50, 0., 50.}}}}, + {"hPhiByVtxPhi", "D,Dbar candidates;candidate #it{#varphi};#it{p}_{T}", {HistType::kTH2F, {{128, 0., 2. * o2::constants::math::PI}, {50, 0., 50.}}}}, + {"hPhiDifferenceTwoMethods", "D,Dbar candidates;candidate #it{#Delta#varphi};#it{p}_{T}", {HistType::kTH2F, {{128, -o2::constants::math::PI, o2::constants::math::PI}, {50, 0., 50.}}}}, + {"hDifferenceGenPhiStdPhi", "D,Dbar candidates;candidate #it{#varphi};#it{p}_{T}", {HistType::kTH2F, {{128, -o2::constants::math::PI, o2::constants::math::PI}, {50, 0., 50.}}}}, + {"hDifferenceGenPhiByVtxPhi", "D,Dbar candidates;candidate #it{#varphi};#it{p}_{T}", {HistType::kTH2F, {{128, -o2::constants::math::PI, o2::constants::math::PI}, {50, 0., 50.}}}}, + {"hDeltaPhiPtIntStdPhi", "D,Dbar candidates;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{128, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hDeltaPhiPtIntByVtxPhi", "D,Dbar candidates;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{128, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hDeltaPhiVsPtStdPhi", "D,Dbar candidates;#it{p}_{T}^{D};#it{p}_{T}^{Dbar};#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH3F, {{36, 0., 36.}, {36, 0., 36.}, {128, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hDeltaPhiVsPtByVtxPhi", "D,Dbar candidates;#it{p}_{T}^{D};#it{p}_{T}^{Dbar};#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH3F, {{36, 0., 36.}, {36, 0., 36.}, {128, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}}}; + + Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; + Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; + + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + + void process(aod::Collision const& collision, soa::Filtered> const& candidates, aod::McParticles const& particlesMC, aod::BigTracksMC const& tracksMC) + { + for (auto& candidate1 : candidates) { + //check decay channel flag for candidate1 + if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + continue; + } + if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && candidate1.pt() < cutPtCandMin) { + continue; + } + registry.fill(HIST("hMass"), InvMassD0(candidate1)); + registry.fill(HIST("hEta"), candidate1.eta()); + + //D-Dbar correlation dedicated section + //if it's a candidate D0, search for D0bar and evaluate correlations + if (candidate1.isSelD0() >= dSelectionFlagD0) { + double xPrimaryVertex = candidate1.index0_as().collision().posX(), yPrimaryVertex = candidate1.index0_as().collision().posY(); + double pt1 = candidate1.pt(), phi1Std = candidate1.phi(); + double phi1ByVtx = evaluatePhiByVertex(xPrimaryVertex, candidate1.xSecondaryVertex(), yPrimaryVertex, candidate1.ySecondaryVertex()); + registry.fill(HIST("hPhiStdPhi"), phi1Std, pt1); + registry.fill(HIST("hPhiByVtxPhi"), phi1ByVtx, pt1); + registry.fill(HIST("hPhiDifferenceTwoMethods"), getDeltaPhiForResolution(phi1ByVtx, phi1Std), pt1); + + //get corresponding gen-level D0, if exists, and evaluate gen-rec phi-difference with two approaches + if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { //ok to keep both D0 and D0bar + int indexGen = RecoDecay::getMother(particlesMC, candidate1.index0_as().mcParticle(), 421, true); //MC-gen corresponding index for MC-reco candidate + double phi1Gen = particlesMC.iteratorAt(indexGen).phi(); + registry.fill(HIST("hDifferenceGenPhiStdPhi"), getDeltaPhiForResolution(phi1Std, phi1Gen), pt1); + registry.fill(HIST("hDifferenceGenPhiByVtxPhi"), getDeltaPhiForResolution(phi1ByVtx, phi1Gen), pt1); + } + + for (auto& candidate2 : candidates) { + //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << D0ToPiK)) { + continue; + } + if (candidate2.isSelD0bar() >= dSelectionFlagD0bar) { //accept only D0bar candidates + if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && candidate2.pt() < cutPtCandMin) { + continue; + } + //Excluding self-correlations (could happen in case of reflections) + if (candidate1.mRowIndex == candidate2.mRowIndex) { + continue; + } + double pt2 = candidate2.pt(), phi2Std = candidate2.phi(); + double phi2ByVtx = evaluatePhiByVertex(xPrimaryVertex, candidate2.xSecondaryVertex(), yPrimaryVertex, candidate2.ySecondaryVertex()); + registry.fill(HIST("hDeltaPhiPtIntStdPhi"), getDeltaPhi(phi2Std, phi1Std)); + registry.fill(HIST("hDeltaPhiPtIntByVtxPhi"), getDeltaPhi(phi2ByVtx, phi1ByVtx)); + registry.fill(HIST("hDeltaPhiVsPtStdPhi"), pt1, pt2, getDeltaPhi(phi2Std, phi1Std)); + registry.fill(HIST("hDeltaPhiVsPtByVtxPhi"), pt1, pt2, getDeltaPhi(phi2ByVtx, phi1ByVtx)); + } + } // end inner loop (Dbars) + } + } //end outer loop + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{}; + //MC-based tasks + const bool doMCGen = cfgc.options().get("doMCGen"); + const bool doMCRec = cfgc.options().get("doMCRec"); + if (doMCGen) { //MC-Gen analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-ddbar-correlation-mc-gen"})); + } else if (doMCRec) { //MC-Rec analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-ddbar-correlation-mc-rec"})); +// workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-DDbar-correlation-check-phi-resolution"})); + } else { //data analysis + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-ddbar-correlation"})); + } + return workflow; +} From faac671ec43a432eafdaacdd4b7ee59fc2bbc9ea Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Fri, 7 May 2021 15:48:39 +0200 Subject: [PATCH 02/14] Added full LS support for DplusDminus --- Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx | 5 +- .../Tasks/PWGHF/DplusDminusCorrelator.cxx | 352 +++++++++--------- Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx | 116 +----- 3 files changed, 202 insertions(+), 271 deletions(-) diff --git a/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx b/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx index ca6c67bb7f6c2..6bec04e5ac0bd 100644 --- a/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx +++ b/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx @@ -531,11 +531,12 @@ struct D0D0barCorrelatorMCRecLS { registry.fill(HIST("hMassD0barMCRec"), InvMassD0bar(candidate1)); } registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); - registry.fill(HIST("hPtprong0MCRec"), candidate1.ptProng0()); - registry.fill(HIST("hPtprong1MCRec"), candidate1.ptProng1()); + registry.fill(HIST("hPtProng0MCRec"), candidate1.ptProng0()); + registry.fill(HIST("hPtProng1MCRec"), candidate1.ptProng1()); registry.fill(HIST("hEtaMCRec"), candidate1.eta()); registry.fill(HIST("hPhiMCRec"), candidate1.phi()); registry.fill(HIST("hYMCRec"), YD0(candidate1)); + registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); double ptParticle1 = candidate1.pt(); //trigger particle is the largest pT one diff --git a/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx b/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx index 96431e56ea3f5..211a68690acb6 100644 --- a/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx +++ b/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx @@ -29,11 +29,11 @@ using namespace o2::aod::hf_ddbar_correlation; void customize(std::vector& workflowOptions) { -// ConfigParamSpec optionDoLikeSign{"doLikeSign", VariantType::Bool, false, {"Run Like-Sign analysis."}}; //TOLTO PER ORA + ConfigParamSpec optionDoLikeSign{"doLikeSign", VariantType::Bool, false, {"Run Like-Sign analysis."}}; ConfigParamSpec optionDoMCccbar{"doMCccbar", VariantType::Bool, false, {"Run MC-Gen dedicated tasks."}}; ConfigParamSpec optionDoMCGen{"doMCGen", VariantType::Bool, false, {"Run MC-Gen dedicated tasks."}}; ConfigParamSpec optionDoMCRec{"doMCRec", VariantType::Bool, false, {"Run MC-Rec dedicated tasks."}}; -// workflowOptions.push_back(optionDoLikeSign); //TOLTO PER ORA + workflowOptions.push_back(optionDoLikeSign); workflowOptions.push_back(optionDoMCccbar); workflowOptions.push_back(optionDoMCGen); workflowOptions.push_back(optionDoMCRec); @@ -67,6 +67,7 @@ struct DplusDminusCorrelator { {{"hPtCand", "Dplus,Dminus candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng0", "Dplus,Dminus candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1", "Dplus,Dminus candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng2", "Dplus,Dminus candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hSelectionStatus", "Dplus,Dminus candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, {"hEta", "Dplus,Dminus candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhi", "Dplus,Dminus candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, @@ -118,6 +119,7 @@ struct DplusDminusCorrelator { registry.fill(HIST("hPtCand"), candidate1.pt()); registry.fill(HIST("hPtProng0"), candidate1.ptProng0()); registry.fill(HIST("hPtProng1"), candidate1.ptProng1()); + registry.fill(HIST("hPtProng2"), candidate1.ptProng2()); registry.fill(HIST("hEta"), candidate1.eta()); registry.fill(HIST("hPhi"), candidate1.phi()); registry.fill(HIST("hY"), YDPlus(candidate1)); @@ -143,17 +145,13 @@ struct DplusDminusCorrelator { if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { continue; } - //Excluding trigger self-correlations (possible in case of both mass hypotheses accepted) -> Dummy for D+D- - if (candidate1.mRowIndex == candidate2.mRowIndex) { - continue; - } entryDplusDminusPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), - candidate2.eta() - candidate1.eta(), - candidate1.pt(), - candidate2.pt()); + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); entryDplusDminusRecoInfo(InvMassDPlus(candidate1), - InvMassDPlus(candidate2), - 0); + InvMassDPlus(candidate2), + 0); double etaCut = 0.; double ptCut = 0.; do { //fill pairs vs etaCut plot @@ -184,6 +182,7 @@ struct DplusDminusCorrelatorMCRec { {{"hPtCandMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng0MCRec", "Dplus,Dminus candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1MCRec", "Dplus,Dminus candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng2MCRec", "Dplus,Dminus candidates - MC reco;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hSelectionStatusMCRec", "Dplus,Dminus candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, {"hEtaMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, @@ -235,6 +234,7 @@ struct DplusDminusCorrelatorMCRec { registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); registry.fill(HIST("hPtProng0MCRec"), candidate1.ptProng0()); registry.fill(HIST("hPtProng1MCRec"), candidate1.ptProng1()); + registry.fill(HIST("hPtProng2MCRec"), candidate1.ptProng2()); registry.fill(HIST("hEtaMCRec"), candidate1.eta()); registry.fill(HIST("hPhiMCRec"), candidate1.phi()); registry.fill(HIST("hYMCRec"), YDPlus(candidate1)); @@ -274,10 +274,6 @@ struct DplusDminusCorrelatorMCRec { if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { continue; } - //Excluding trigger self-correlations (possible in case of both mass hypotheses accepted) - Seems dummy for D+D- - if (candidate1.mRowIndex == candidate2.mRowIndex) { - continue; - } //choice of options (Dplus/Dminus signal/bkg) int pairSignalStatus = 0; //0 = bkg/bkg, 1 = bkg/sig, 2 = sig/bkg, 3 = sig/sig if (flagDplusSignal) { @@ -287,12 +283,12 @@ struct DplusDminusCorrelatorMCRec { pairSignalStatus += 1; } entryDplusDminusPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), - candidate2.eta() - candidate1.eta(), - candidate1.pt(), - candidate2.pt()); + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); entryDplusDminusRecoInfo(InvMassDPlus(candidate1), - InvMassDPlus(candidate2), - pairSignalStatus); + InvMassDPlus(candidate2), + pairSignalStatus); double etaCut = 0.; double ptCut = 0.; do { //fill pairs vs etaCut plot @@ -369,9 +365,9 @@ struct DplusDminusCorrelatorMCGen { continue; } entryDplusDminusPair(getDeltaPhi(particle2.phi(), particle1.phi()), - particle2.eta() - particle1.eta(), - particle1.pt(), - particle2.pt()); + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); double etaCut = 0.; double ptCut = 0.; do { //fill pairs vs etaCut plot @@ -391,81 +387,94 @@ struct DplusDminusCorrelatorMCGen { registry.fill(HIST("hcountDplusDminusPerEvent"), counterDplusDminus); } }; -/* -/// D0-D0bar correlation pair builder - LIKE SIGN - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) -struct DDbarCorrelatorLS { - Produces entryD0D0barPair; - Produces entryD0D0barRecoInfo; +/// Dplus-Dminus correlation pair builder - LIKE SIGN - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) +struct DplusDminusCorrelatorLS { + + Produces entryDplusDminusPair; + Produces entryDplusDminusRecoInfo; 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, {{180, 0., 36.}}}}, - {"hPtProng0", "D0,D0bar candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hPtProng1", "D0,D0bar candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hSelectionStatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, - {"hEta", "D0,D0bar candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, - {"hPhi", "D0,D0bar candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, - {"hY", "D0,D0bar candidates;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; - - Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; - Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + //NOTE: use hMassDplus for trigger normalisation (S*0.955), and hMass2DCorrelationPairs (in final task) for 2D-sideband-subtraction purposes + {{"hPtCand", "Dplus,Dminus candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng0", "Dplus,Dminus candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng1", "Dplus,Dminus candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng2", "Dplus,Dminus candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hSelectionStatus", "Dplus,Dminus candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hEta", "Dplus,Dminus candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhi", "Dplus,Dminus candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hY", "Dplus,Dminus candidates;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; + + Configurable dSelectionFlagDplus{"dSelectivonFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; - Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_dplus_topikpi::pTBins_v}, "pT bin limits for candidate mass plots"}; void init(o2::framework::InitContext&) { - registry.add("hMass", "D0,D0bar candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassD0", "D0,D0bar candidates;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassD0bar", "D0,D0bar candidates;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMass", "Dplus,Dminus candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDplus", "Dplus,Dminus candidates;inv. mass Dplus only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDminus", "Dplus,Dminus candidates;inv. mass Dminus only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= dSelectionFlagDplus); - void process(aod::Collision const& collision, soa::Filtered> const& candidates) + void process(aod::Collision const& collision, soa::Filtered> const& candidates, aod::BigTracks const& tracks) { for (auto& candidate1 : candidates) { - //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + if (cutYCandMax >= 0. && std::abs(YDPlus(candidate1)) > cutYCandMax) { continue; } - if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { + if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + //check decay channel flag for candidate1 + if (!(candidate1.hfflag() & 1 << DPlusToPiKPi)) { //probably dummy since already selected? not sure... continue; } - //fill invariant mass plots and generic info from all D0/D0bar candidates - if (candidate1.isSelD0() >= dSelectionFlagD0) { - registry.fill(HIST("hMass"), InvMassD0(candidate1), candidate1.pt()); - registry.fill(HIST("hMassD0"), InvMassD0(candidate1), candidate1.pt()); + int outerParticleSign = 1; //Dplus + auto outerSecondTrack = candidate1.index1_as(); + if (outerSecondTrack.sign()==1) { + outerParticleSign = -1; //Dminus (second daughter track is positive) + } + + //fill invariant mass plots and generic info from all Dplus/Dminus candidates + if (outerParticleSign==1) { + registry.fill(HIST("hMass"), InvMassDPlus(candidate1), candidate1.pt()); + registry.fill(HIST("hMassDplus"), InvMassDPlus(candidate1), candidate1.pt()); } - if (candidate1.isSelD0bar() >= dSelectionFlagD0bar) { - registry.fill(HIST("hMass"), InvMassD0bar(candidate1), candidate1.pt()); - registry.fill(HIST("hMassD0bar"), InvMassD0bar(candidate1), candidate1.pt()); + else { + registry.fill(HIST("hMass"), InvMassDPlus(candidate1), candidate1.pt()); + registry.fill(HIST("hMassDminus"), InvMassDPlus(candidate1), candidate1.pt()); } registry.fill(HIST("hPtCand"), candidate1.pt()); registry.fill(HIST("hPtProng0"), candidate1.ptProng0()); registry.fill(HIST("hPtProng1"), candidate1.ptProng1()); + registry.fill(HIST("hPtProng2"), candidate1.ptProng2()); registry.fill(HIST("hEta"), candidate1.eta()); registry.fill(HIST("hPhi"), candidate1.phi()); - registry.fill(HIST("hY"), YD0(candidate1)); - registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); + registry.fill(HIST("hY"), YDPlus(candidate1)); + registry.fill(HIST("hSelectionStatus"), candidate1.isSelDplusToPiKPi()); double ptParticle1 = candidate1.pt(); //trigger particle is the largest-pT one //D-Dbar correlation dedicated section - //For like-sign, first loop on both D0 and D0bars. First candidate is for sure a D0 and D0bars (checked before, so don't re-check anything on it) + //For like-sign, first loop on both Dplus and Dminus. First candidate is for sure a Dplus/Dminus (checked before, so don't re-check anything on it) for (auto& candidate2 : candidates) { //check decay channel flag for candidate2 - if (!(candidate2.hfflag() & 1 << D0ToPiK)) { + if (!(candidate2.hfflag() & 1 << DPlusToPiKPi)) { continue; } - //for the associated, has to have smaller pT, and pass D0sel if trigger passes D0sel, or D0barsel if trigger passes D0barsel - if (candidate2.pt() < ptParticle1 && ((candidate1.isSelD0() >= dSelectionFlagD0 && candidate2.isSelD0() >= dSelectionFlagD0) || (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate2.isSelD0bar() >= dSelectionFlagD0bar))) { - if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { + //check if inner particle is Dplus or Dminus + int innerParticleSign = 1; //Dplus + auto innerSecondTrack = candidate2.index1_as(); + if (innerSecondTrack.sign()==1) { + innerParticleSign = -1; //Dminus (second daughter track is positive) + } + //for the associated, has to have smaller pT, and has to be Dplus if outer is Dplu, or Dminus if outer is Dminus + if (candidate2.pt() < ptParticle1 && innerParticleSign==outerParticleSign) { + if (cutYCandMax >= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { continue; } if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { @@ -475,96 +484,104 @@ struct DDbarCorrelatorLS { if (candidate1.mRowIndex == candidate2.mRowIndex) { continue; } - entryD0D0barPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), - candidate2.eta() - candidate1.eta(), - candidate1.pt(), - candidate2.pt()); - entryD0D0barRecoInfo(InvMassD0(candidate1), - InvMassD0bar(candidate2), - 0); + entryDplusDminusPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryDplusDminusRecoInfo(InvMassDPlus(candidate1), + InvMassDPlus(candidate2), + 0); } - //note: candidates selected as both D0 and D0bar are used, and considered in both situation (but not auto-correlated): reflections could play a relevant role. - //another, more restrictive, option, could be to consider only candidates selected with a single option (D0 xor D0bar) - - } // end inner loop (Dbars) - + } // end inner loop } //end outer loop } }; -/// D0-D0bar correlation pair builder - LIKE SIGN - for MC reco analysis (data-like but matching to true DO and D0bar) -struct D0D0barCorrelatorMCRecLS { - - Produces entryD0D0barPair; - Produces entryD0D0barRecoInfo; +/// Dplus-Dminus correlation pair builder - LIKE SIGN - for MC reco analysis (data-like but matching to true Dplus and Dminus) +struct DplusDminusCorrelatorMCRecLS { + Produces entryDplusDminusPair; + Produces entryDplusDminusRecoInfo; HistogramRegistry registry{ "registry", //NOTE: use hMassD0 for trigger normalisation (S*0.955), and hMass2DCorrelationPairs (in final task) for 2D-sideband-subtraction purposes - {{"hPtCandMCRec", "D0,D0bar candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hPtProng0MCRec", "D0,D0bar candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hPtProng1MCRec", "D0,D0bar candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hSelectionStatusMCRec", "D0,D0bar candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, - {"hEtaMCRec", "D0,D0bar candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, - {"hPhiMCRec", "D0,D0bar candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, - {"hYMCRec", "D0,D0bar candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; - - Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; - Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + {{"hPtCandMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng0MCRec", "Dplus,Dminus candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng1MCRec", "Dplus,Dminus candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng2MCRec", "Dplus,Dminus candidates - MC reco;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hSelectionStatusMCRec", "Dplus,Dminus candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hEtaMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hYMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; + + Configurable dSelectionFlagDplus{"dSelectionFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; - Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_dplus_topikpi::pTBins_v}, "pT bin limits for candidate mass plots"}; void init(o2::framework::InitContext&) { - registry.add("hMassD0MCRec", "D0,D0bar candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassD0barMCRec", "D0,D0bar candidates - MC reco;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDplusMCRec", "Dplus,Dminus candidates - MC reco;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDminusMCRec", "Dplus,Dminus candidates - MC reco;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= dSelectionFlagDplus); - void process(aod::Collision const& collision, soa::Filtered> const& candidates) + void process(aod::Collision const& collision, soa::Filtered> const& candidates, aod::BigTracks const& tracks) { //MC reco level for (auto& candidate1 : candidates) { //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + if (!(candidate1.hfflag() & 1 << DPlusToPiKPi)) { continue; } - if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { + if (cutYCandMax >= 0. && std::abs(YDPlus(candidate1)) > cutYCandMax) { continue; } if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { continue; } - if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { - //fill invariant mass plots and generic info from all D0/D0bar candidates - if (candidate1.isSelD0() >= dSelectionFlagD0 && candidate1.flagMCMatchRec() == D0ToPiK) { //only reco and matched as D0 - registry.fill(HIST("hMassD0MCRec"), InvMassD0(candidate1)); + int outerParticleSign = 1; //Dplus + auto outerSecondTrack = candidate1.index1_as(); + if (outerSecondTrack.sign()==1) { + outerParticleSign = -1; //Dminus (second daughter track is positive) + } + if (std::abs(candidate1.flagMCMatchRec()) == 1 << DPlusToPiKPi) { + //fill invariant mass plots and generic info from all Dplus/Dminus candidates + if (outerParticleSign==1) { //matched as Dplus + registry.fill(HIST("hMassDplusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); } - if (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == D0ToPiK) { //only reco and matched as D0bar - registry.fill(HIST("hMassD0barMCRec"), InvMassD0bar(candidate1)); + else { //matched as Dminus + registry.fill(HIST("hMassDminusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); } registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); - registry.fill(HIST("hPtprong0MCRec"), candidate1.ptProng0()); - registry.fill(HIST("hPtprong1MCRec"), candidate1.ptProng1()); + registry.fill(HIST("hPtProng0MCRec"), candidate1.ptProng0()); + registry.fill(HIST("hPtProng1MCRec"), candidate1.ptProng1()); + registry.fill(HIST("hPtProng2MCRec"), candidate1.ptProng2()); registry.fill(HIST("hEtaMCRec"), candidate1.eta()); registry.fill(HIST("hPhiMCRec"), candidate1.phi()); - registry.fill(HIST("hYMCRec"), YD0(candidate1)); + registry.fill(HIST("hYMCRec"), YDPlus(candidate1)); + registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelDplusToPiKPi()); double ptParticle1 = candidate1.pt(); //trigger particle is the largest pT one //D-Dbar correlation dedicated section - //For like-sign, first loop on both D0 and D0bars. First candidate is for sure a D0 and D0bars (looping on filtered) and was already matched, so don't re-check anything on it) + //For like-sign, first loop on both Dplus and Dminus. First candidate is for sure a Dplus/Dminus (looping on filtered) and was already matched, so don't re-check anything on it) for (auto& candidate2 : candidates) { //check decay channel flag for candidate2 - if (!(candidate2.hfflag() & 1 << D0ToPiK)) { + if (!(candidate2.hfflag() & 1 << DPlusToPiKPi)) { continue; } - bool conditionLSForD0 = (candidate1.isSelD0() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == 1 << D0ToPiK) && (candidate2.isSelD0() >= dSelectionFlagD0bar && candidate2.flagMCMatchRec() == 1 << D0ToPiK); - bool conditionLSForD0bar = (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << D0ToPiK) && (candidate2.isSelD0bar() >= dSelectionFlagD0bar && candidate2.flagMCMatchRec() == -1 << D0ToPiK); - if (candidate2.pt() < ptParticle1 && (conditionLSForD0 || conditionLSForD0bar)) { //LS pair (of D0 or of D0bar) + pt2= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { + int innerParticleSign = 1; //Dplus + auto innerSecondTrack = candidate2.index1_as(); + if (innerSecondTrack.sign()==1) { + innerParticleSign = -1; //Dminus (second daughter track is positive) + } + if (!std::abs(candidate2.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //reject fake candidates + continue; + } + if (candidate2.pt() < ptParticle1 && outerParticleSign==innerParticleSign) { //LS pair (of Dplus or Dmnius) + pt2= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { continue; } if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { @@ -574,53 +591,53 @@ struct D0D0barCorrelatorMCRecLS { if (candidate1.mRowIndex == candidate2.mRowIndex) { continue; } - entryD0D0barPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), - candidate2.eta() - candidate1.eta(), - candidate1.pt(), - candidate2.pt()); - entryD0D0barRecoInfo(InvMassD0(candidate1), - InvMassD0bar(candidate2), - 0); //for LS studies we set a dummy 0 for pairSignalStatus (there are no more the usual 4 possible combinations) + entryDplusDminusPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryDplusDminusRecoInfo(InvMassDPlus(candidate1), + InvMassDPlus(candidate2), + 0); //for LS studies we set a dummy 0 for pairSignalStatus (there are no more the usual 4 possible combinations) } //end inner if (MC match) - } // end inner loop (Dbars) + } // end inner loop } //end outer if (MC match) } //end outer loop } }; -/// D0-D0bar correlation pair builder - for MC gen-level analysis, like sign particles -struct D0D0barCorrelatorMCGenLS { +/// Dplus-Dminus correlation pair builder - for MC gen-level analysis, like sign particles +struct DplusDminusCorrelatorMCGenLS { - Produces entryD0D0barPair; + Produces entryDplusDminusPair; HistogramRegistry registry{ "registry", {{"hMCEvtCount", "Event counter - MC gen;;entries", {HistType::kTH1F, {{1, -0.5, 0.5}}}}, - {"hPtCandMCGen", "D0,D0bar particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hEtaMCGen", "D0,D0bar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, - {"hPhiMCGen", "D0,D0bar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, - {"hYMCGen", "D0,D0bar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, - {"hcountD0D0barPerEvent", "D0,D0bar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + {"hPtCandMCGen", "Dplus,Dminus particles - MC gen;particle #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hEtaMCGen", "Dplus,Dminus particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hPhiMCGen", "Dplus,Dminus particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, + {"hYMCGen", "Dplus,Dminus candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, + {"hcountDplusDminusPerEvent", "Dplus,Dminus particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; - Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for trigger counters"}; + Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_dplus_topikpi::pTBins_v}, "pT bin limits for trigger counters"}; void init(o2::framework::InitContext&) { - registry.add("hcountD0triggersMCGen", "D0 trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hcountDplustriggersMCGen", "Dplus trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) + void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) { - int counterD0D0bar = 0; + int counterDplusDminus = 0; registry.fill(HIST("hMCEvtCount"), 0); //MC gen level for (auto& particle1 : particlesMC) { - //check if the particle is D0 or D0bar (both can be trigger) - NOTE: decay channel is not probed! - if (std::abs(particle1.pdgCode()) != 421) { + //check if the particle is Dplus or Dminus (both can be trigger) - NOTE: decay channel is not probed! + if (std::abs(particle1.pdgCode()) != 411) { continue; } if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { @@ -636,12 +653,13 @@ struct D0D0barCorrelatorMCGenLS { registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); - counterD0D0bar++; + counterDplusDminus++; + //D-Dbar correlation dedicated section - //if it's D0, search for D0bar and evaluate correlations. - registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger D0 (normalisation) + //if it's Dplus/Dminus, search for LS pair companions and evaluate correlations. + registry.fill(HIST("hcountDplustriggersMCGen"), 0, particle1.pt()); //to count trigger Dplus (normalisation) for (auto& particle2 : particlesMC) { - if (std::abs(particle2.pdgCode()) != 421) { //check that associated is a D0/D0bar (both are fine) + if (std::abs(particle2.pdgCode()) != 411) { //check that associated is a Dplus/Dminus (both are fine) continue; } if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { @@ -650,26 +668,26 @@ struct D0D0barCorrelatorMCGenLS { if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { continue; } - if (particle2.pt() < ptParticle1 && particle2.pdgCode() == particle1.pdgCode()) { //like-sign condition (both 421 or both -421) and pT_Trig>pT_assoc + if (particle2.pt() < ptParticle1 && particle2.pdgCode() == particle1.pdgCode()) { //like-sign condition (both 411 or both -411) and pT_Trig>pT_assoc //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) if (particle1.mRowIndex == particle2.mRowIndex) { continue; } - entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), - particle2.eta() - particle1.eta(), - particle1.pt(), - particle2.pt()); + entryDplusDminusPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); } - } // end inner loop (Dbars) + } // end inner loop } //end outer loop - registry.fill(HIST("hcountD0D0barPerEvent"), counterD0D0bar); + registry.fill(HIST("hcountDplusDminusPerEvent"), counterDplusDminus); } }; -*/ + /// c-cbar correlator table builder - for MC gen-level analysis struct CCbarCorrelatorMCGen { - Produces entryD0D0barPair; + Produces entryccbarPair; HistogramRegistry registry{ "registry", @@ -678,7 +696,7 @@ struct CCbarCorrelatorMCGen { {"hEtaMCGen", "c,cbar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hYMCGen", "c,cbar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCGen", "c,cbar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, - {"hcountD0D0barPerEvent", "D0,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + {"hcountCCbarPerEvent", "c,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; @@ -686,7 +704,7 @@ struct CCbarCorrelatorMCGen { void init(o2::framework::InitContext&) { - registry.add("hcountD0triggersMCGen", "c trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hcountCtriggersMCGen", "c trigger particles - MC gen;;N of trigger c quark", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) @@ -721,7 +739,7 @@ struct CCbarCorrelatorMCGen { //if it's c, search for cbar and evaluate correlations. if (particle1.pdgCode() == 4) { - registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) + registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) for (auto& particle2 : particlesMC) { if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { @@ -735,7 +753,7 @@ struct CCbarCorrelatorMCGen { if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == -4) { continue; } - entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), + entryccbarPair(getDeltaPhi(particle2.phi(), particle1.phi()), particle2.eta() - particle1.eta(), particle1.pt(), particle2.pt()); @@ -744,14 +762,13 @@ struct CCbarCorrelatorMCGen { } //end outer if (check c) } //end outer loop registry.fill(HIST("hcountCCbarPerEvent"), counterccbar); - registry.fill(HIST("hcountCCbarPerEventPreEtaCut"), counterccbarPreEtasel); } }; -/* + /// c-cbar correlator table builder - for MC gen-level analysis - Like Sign struct CCbarCorrelatorMCGenLS { - Produces entryD0D0barPair; + Produces entryccbarPair; HistogramRegistry registry{ "registry", @@ -760,7 +777,7 @@ struct CCbarCorrelatorMCGenLS { {"hEtaMCGen", "c,cbar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hYMCGen", "c,cbar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCGen", "c,cbar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, - {"hcountD0D0barPerEvent", "D0,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + {"hcountCCbarPerEvent", "c,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; @@ -768,7 +785,7 @@ struct CCbarCorrelatorMCGenLS { void init(o2::framework::InitContext&) { - registry.add("hcountD0triggersMCGen", "c trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hcountCtriggersMCGen", "c trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) @@ -801,7 +818,7 @@ struct CCbarCorrelatorMCGenLS { //c-cbar correlation dedicated section double ptParticle1 = particle1.pt(); //trigger particle is the largest pT one - registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) + registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) for (auto& particle2 : particlesMC) { if (std::abs(particle2.pdgCode()) != 4) { //search c or cbar for associated particles @@ -818,7 +835,7 @@ struct CCbarCorrelatorMCGenLS { if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == particle2.pdgCode()) { continue; } - entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), + entryccbarPair(getDeltaPhi(particle2.phi(), particle1.phi()), particle2.eta() - particle1.eta(), particle1.pt(), particle2.pt()); @@ -826,18 +843,17 @@ struct CCbarCorrelatorMCGenLS { } // end inner loop } //end outer loop registry.fill(HIST("hcountCCbarPerEvent"), counterccbar); - registry.fill(HIST("hcountCCbarPerEventPreEtaCut"), counterccbarPreEtasel); } }; -*/ + WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{}; const bool doMCccbar = cfgc.options().get("doMCccbar"); const bool doMCGen = cfgc.options().get("doMCGen"); const bool doMCRec = cfgc.options().get("doMCRec"); -// const bool doLikeSign = cfgc.options().get("doLikeSign"); -// if (!doLikeSign) { //unlike-sign analyses + const bool doLikeSign = cfgc.options().get("doLikeSign"); + if (!doLikeSign) { //unlike-sign analyses if (doMCGen) { //MC-Gen analysis workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-mc-gen"})); } else if (doMCRec) { //MC-Reco analysis @@ -847,18 +863,18 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) } else { //data analysis workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator"})); } -//} - /* else { //like-sign analyses //FABIO -> QUESTE NON MODIFICATE! +} + else { if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-gen-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-mc-gen-ls"})); } else if (doMCRec) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-rec-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-mc-rec-ls"})); } else if (doMCccbar) { //MC-Reco analysis workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"ccbar-correlator-mc-gen-ls"})); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-ls"})); } } -*/ + return workflow; } diff --git a/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx b/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx index b1437703d332e..b080633e98df9 100644 --- a/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx +++ b/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx @@ -151,10 +151,10 @@ struct TaskDDbarCorrelation { registry.fill(HIST("hDeltaPtMaxMinSignalRegion"), std::abs(ptDbar - ptD)); } - if ((pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandLeftOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar)) || - (pairEntry.mD() > sidebandRightInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar)) || - (pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandLeftOuter->at(pTBinDbar)) || - (pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandRightInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar))) { + if ((massD > sidebandLeftInner->at(pTBinD) && massD < sidebandLeftOuter->at(pTBinD) && massDbar > sidebandLeftInner->at(pTBinDbar) && massDbar < sidebandRightOuter->at(pTBinDbar)) || + (massD > sidebandRightInner->at(pTBinD) && massD < sidebandRightOuter->at(pTBinD) && massDbar > sidebandLeftInner->at(pTBinDbar) && massDbar < sidebandRightOuter->at(pTBinDbar)) || + (massD > sidebandLeftInner->at(pTBinD) && massD < sidebandRightOuter->at(pTBinD) && massDbar > sidebandLeftInner->at(pTBinDbar) && massDbar < sidebandLeftOuter->at(pTBinDbar)) || + (massD > sidebandLeftInner->at(pTBinD) && massD < sidebandRightOuter->at(pTBinD) && massDbar > sidebandRightInner->at(pTBinDbar) && massDbar < sidebandRightOuter->at(pTBinDbar))) { //in sideband region registry.fill(HIST("hCorrel2DVsPtSidebands"), deltaPhi, deltaEta, ptD, ptDbar); registry.fill(HIST("hCorrel2DPtIntSidebands"), deltaPhi, deltaEta); @@ -237,6 +237,8 @@ struct TaskDDbarCorrelationMCRec { double deltaEta = pairEntry.deltaEta(); double ptD = pairEntry.ptD(); double ptDbar = pairEntry.ptDbar(); + double massD = pairEntry.mD(); + double massDbar = pairEntry.mDbar(); //reject entries outside pT ranges of interest double minPtAllowed = binsCorrelations->at(0); @@ -248,16 +250,16 @@ struct TaskDDbarCorrelationMCRec { //fill 2D invariant mass plots switch (pairEntry.signalStatus()) { case 0: //D Bkg, Dbar Bkg - registry.fill(HIST("hMass2DCorrelationPairsMCRecBkgBkg"), pairEntry.mD(), pairEntry.mDbar(), ptD, ptDbar); + registry.fill(HIST("hMass2DCorrelationPairsMCRecBkgBkg"), massD, massDbar, ptD, ptDbar); break; case 1: //D Bkg, Dbar Sig - registry.fill(HIST("hMass2DCorrelationPairsMCRecBkgSig"), pairEntry.mD(), pairEntry.mDbar(), ptD, ptDbar); + registry.fill(HIST("hMass2DCorrelationPairsMCRecBkgSig"), massD, massDbar, ptD, ptDbar); break; case 2: //D Sig, Dbar Bkg - registry.fill(HIST("hMass2DCorrelationPairsMCRecSigBkg"), pairEntry.mD(), pairEntry.mDbar(), ptD, ptDbar); + registry.fill(HIST("hMass2DCorrelationPairsMCRecSigBkg"), massD, massDbar, ptD, ptDbar); break; case 3: //D Sig, Dbar Sig - registry.fill(HIST("hMass2DCorrelationPairsMCRecSigSig"), pairEntry.mD(), pairEntry.mDbar(), ptD, ptDbar); + registry.fill(HIST("hMass2DCorrelationPairsMCRecSigSig"), massD, massDbar, ptD, ptDbar); break; default: //should not happen for MC reco break; @@ -267,7 +269,7 @@ struct TaskDDbarCorrelationMCRec { int pTBinD = o2::analysis::findBin(binsCorrelations, ptD); int pTBinDbar = o2::analysis::findBin(binsCorrelations, ptDbar); - if (pairEntry.mD() > signalRegionInner->at(pTBinD) && pairEntry.mD() < signalRegionOuter->at(pTBinD) && pairEntry.mDbar() > signalRegionInner->at(pTBinDbar) && pairEntry.mDbar() < signalRegionOuter->at(pTBinDbar)) { + if (massD > signalRegionInner->at(pTBinD) && massD < signalRegionOuter->at(pTBinD) && massDbar > signalRegionInner->at(pTBinDbar) && massDbar < signalRegionOuter->at(pTBinDbar)) { //in signal region registry.fill(HIST("hCorrel2DPtIntSignalRegionMCRec"), deltaPhi, deltaEta); registry.fill(HIST("hDeltaEtaPtIntSignalRegionMCRec"), deltaEta); @@ -292,10 +294,10 @@ struct TaskDDbarCorrelationMCRec { } } - if ((pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandLeftOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar)) || - (pairEntry.mD() > sidebandRightInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar)) || - (pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandLeftInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandLeftOuter->at(pTBinDbar)) || - (pairEntry.mD() > sidebandLeftInner->at(pTBinD) && pairEntry.mD() < sidebandRightOuter->at(pTBinD) && pairEntry.mDbar() > sidebandRightInner->at(pTBinDbar) && pairEntry.mDbar() < sidebandRightOuter->at(pTBinDbar))) { + if ((massD > sidebandLeftInner->at(pTBinD) && massD < sidebandLeftOuter->at(pTBinD) && massDbar > sidebandLeftInner->at(pTBinDbar) && massDbar < sidebandRightOuter->at(pTBinDbar)) || + (massD > sidebandRightInner->at(pTBinD) && massD < sidebandRightOuter->at(pTBinD) && massDbar > sidebandLeftInner->at(pTBinDbar) && massDbar < sidebandRightOuter->at(pTBinDbar)) || + (massD > sidebandLeftInner->at(pTBinD) && massD < sidebandRightOuter->at(pTBinD) && massDbar > sidebandLeftInner->at(pTBinDbar) && massDbar < sidebandLeftOuter->at(pTBinDbar)) || + (massD > sidebandLeftInner->at(pTBinD) && massD < sidebandRightOuter->at(pTBinD) && massDbar > sidebandRightInner->at(pTBinDbar) && massDbar < sidebandRightOuter->at(pTBinDbar))) { //in sideband region registry.fill(HIST("hCorrel2DPtIntSidebandsMCRec"), deltaPhi, deltaEta); registry.fill(HIST("hDeltaEtaPtIntSidebandsMCRec"), deltaEta); @@ -376,93 +378,6 @@ struct TaskDDbarCorrelationMCGen { } }; -/// checks phi resolution for standard definition and sec-vtx based definition -struct TaskDDbarCorrelationCheckPhiResolution { - - HistogramRegistry registry{ - "registry", - {{"hMass", "D,Dbar candidates;inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{120, 1.5848, 2.1848}}}}, - {"hEta", "D,Dbar candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, - {"hPhiStdPhi", "D,Dbar candidates;candidate #it{#varphi};#it{p}_{T}", {HistType::kTH2F, {{128, 0., 2. * o2::constants::math::PI}, {50, 0., 50.}}}}, - {"hPhiByVtxPhi", "D,Dbar candidates;candidate #it{#varphi};#it{p}_{T}", {HistType::kTH2F, {{128, 0., 2. * o2::constants::math::PI}, {50, 0., 50.}}}}, - {"hPhiDifferenceTwoMethods", "D,Dbar candidates;candidate #it{#Delta#varphi};#it{p}_{T}", {HistType::kTH2F, {{128, -o2::constants::math::PI, o2::constants::math::PI}, {50, 0., 50.}}}}, - {"hDifferenceGenPhiStdPhi", "D,Dbar candidates;candidate #it{#varphi};#it{p}_{T}", {HistType::kTH2F, {{128, -o2::constants::math::PI, o2::constants::math::PI}, {50, 0., 50.}}}}, - {"hDifferenceGenPhiByVtxPhi", "D,Dbar candidates;candidate #it{#varphi};#it{p}_{T}", {HistType::kTH2F, {{128, -o2::constants::math::PI, o2::constants::math::PI}, {50, 0., 50.}}}}, - {"hDeltaPhiPtIntStdPhi", "D,Dbar candidates;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{128, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hDeltaPhiPtIntByVtxPhi", "D,Dbar candidates;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{128, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hDeltaPhiVsPtStdPhi", "D,Dbar candidates;#it{p}_{T}^{D};#it{p}_{T}^{Dbar};#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH3F, {{36, 0., 36.}, {36, 0., 36.}, {128, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hDeltaPhiVsPtByVtxPhi", "D,Dbar candidates;#it{p}_{T}^{D};#it{p}_{T}^{Dbar};#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH3F, {{36, 0., 36.}, {36, 0., 36.}, {128, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}}}; - - Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; - Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; - Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; - Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; - - Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); - - void process(aod::Collision const& collision, soa::Filtered> const& candidates, aod::McParticles const& particlesMC, aod::BigTracksMC const& tracksMC) - { - for (auto& candidate1 : candidates) { - //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << D0ToPiK)) { - continue; - } - if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { - continue; - } - if (cutPtCandMin >= 0. && candidate1.pt() < cutPtCandMin) { - continue; - } - registry.fill(HIST("hMass"), InvMassD0(candidate1)); - registry.fill(HIST("hEta"), candidate1.eta()); - - //D-Dbar correlation dedicated section - //if it's a candidate D0, search for D0bar and evaluate correlations - if (candidate1.isSelD0() >= dSelectionFlagD0) { - double xPrimaryVertex = candidate1.index0_as().collision().posX(), yPrimaryVertex = candidate1.index0_as().collision().posY(); - double pt1 = candidate1.pt(), phi1Std = candidate1.phi(); - double phi1ByVtx = evaluatePhiByVertex(xPrimaryVertex, candidate1.xSecondaryVertex(), yPrimaryVertex, candidate1.ySecondaryVertex()); - registry.fill(HIST("hPhiStdPhi"), phi1Std, pt1); - registry.fill(HIST("hPhiByVtxPhi"), phi1ByVtx, pt1); - registry.fill(HIST("hPhiDifferenceTwoMethods"), getDeltaPhiForResolution(phi1ByVtx, phi1Std), pt1); - - //get corresponding gen-level D0, if exists, and evaluate gen-rec phi-difference with two approaches - if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { //ok to keep both D0 and D0bar - int indexGen = RecoDecay::getMother(particlesMC, candidate1.index0_as().mcParticle(), 421, true); //MC-gen corresponding index for MC-reco candidate - double phi1Gen = particlesMC.iteratorAt(indexGen).phi(); - registry.fill(HIST("hDifferenceGenPhiStdPhi"), getDeltaPhiForResolution(phi1Std, phi1Gen), pt1); - registry.fill(HIST("hDifferenceGenPhiByVtxPhi"), getDeltaPhiForResolution(phi1ByVtx, phi1Gen), pt1); - } - - for (auto& candidate2 : candidates) { - //check decay channel flag for candidate2 - if (!(candidate2.hfflag() & 1 << D0ToPiK)) { - continue; - } - if (candidate2.isSelD0bar() >= dSelectionFlagD0bar) { //accept only D0bar candidates - if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { - continue; - } - if (cutPtCandMin >= 0. && candidate2.pt() < cutPtCandMin) { - continue; - } - //Excluding self-correlations (could happen in case of reflections) - if (candidate1.mRowIndex == candidate2.mRowIndex) { - continue; - } - double pt2 = candidate2.pt(), phi2Std = candidate2.phi(); - double phi2ByVtx = evaluatePhiByVertex(xPrimaryVertex, candidate2.xSecondaryVertex(), yPrimaryVertex, candidate2.ySecondaryVertex()); - registry.fill(HIST("hDeltaPhiPtIntStdPhi"), getDeltaPhi(phi2Std, phi1Std)); - registry.fill(HIST("hDeltaPhiPtIntByVtxPhi"), getDeltaPhi(phi2ByVtx, phi1ByVtx)); - registry.fill(HIST("hDeltaPhiVsPtStdPhi"), pt1, pt2, getDeltaPhi(phi2Std, phi1Std)); - registry.fill(HIST("hDeltaPhiVsPtByVtxPhi"), pt1, pt2, getDeltaPhi(phi2ByVtx, phi1ByVtx)); - } - } // end inner loop (Dbars) - } - } //end outer loop - } -}; - WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{}; @@ -473,7 +388,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-ddbar-correlation-mc-gen"})); } else if (doMCRec) { //MC-Rec analysis workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-ddbar-correlation-mc-rec"})); -// workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-DDbar-correlation-check-phi-resolution"})); } else { //data analysis workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-ddbar-correlation"})); } From 00fe5edbb2f4de72484d5bc33c8eb5bf8b2e36d6 Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Mon, 10 May 2021 10:14:58 +0200 Subject: [PATCH 03/14] Clang fixes and removal of pT1>pT2 request for LS --- Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx | 39 ++++--- .../Tasks/PWGHF/DplusDminusCorrelator.cxx | 110 +++++++++--------- Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx | 14 +-- 3 files changed, 80 insertions(+), 83 deletions(-) diff --git a/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx b/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx index 6bec04e5ac0bd..85e2a988c03e3 100644 --- a/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx +++ b/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx @@ -262,7 +262,7 @@ struct D0D0barCorrelatorMCRec { //Excluding trigger self-correlations (possible in case of both mass hypotheses accepted) if (candidate1.mRowIndex == candidate2.mRowIndex) { continue; - } + } //choice of options (D0/D0bar signal/bkg) int pairSignalStatus = 0; //0 = bkg/bkg, 1 = bkg/sig, 2 = sig/bkg, 3 = sig/sig if (flagD0Signal) { @@ -378,6 +378,7 @@ struct D0D0barCorrelatorMCGen { }; /// D0-D0bar correlation pair builder - LIKE SIGN - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. struct D0D0barCorrelatorLS { Produces entryD0D0barPair; @@ -439,8 +440,6 @@ struct D0D0barCorrelatorLS { registry.fill(HIST("hY"), YD0(candidate1)); registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); - double ptParticle1 = candidate1.pt(); //trigger particle is the largest-pT one - //D-Dbar correlation dedicated section //For like-sign, first loop on both D0 and D0bars. First candidate is for sure a D0 and D0bars (checked before, so don't re-check anything on it) for (auto& candidate2 : candidates) { @@ -449,14 +448,14 @@ struct D0D0barCorrelatorLS { continue; } //for the associated, has to have smaller pT, and pass D0sel if trigger passes D0sel, or D0barsel if trigger passes D0barsel - if (candidate2.pt() < ptParticle1 && ((candidate1.isSelD0() >= dSelectionFlagD0 && candidate2.isSelD0() >= dSelectionFlagD0) || (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate2.isSelD0bar() >= dSelectionFlagD0bar))) { + if ((candidate1.isSelD0() >= dSelectionFlagD0 && candidate2.isSelD0() >= dSelectionFlagD0) || (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate2.isSelD0bar() >= dSelectionFlagD0bar)) { if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { continue; } if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { continue; } - //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + //Excluding self-correlations if (candidate1.mRowIndex == candidate2.mRowIndex) { continue; } @@ -478,6 +477,7 @@ struct D0D0barCorrelatorLS { }; /// D0-D0bar correlation pair builder - LIKE SIGN - for MC reco analysis (data-like but matching to true DO and D0bar) +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. struct D0D0barCorrelatorMCRecLS { Produces entryD0D0barPair; @@ -538,8 +538,6 @@ struct D0D0barCorrelatorMCRecLS { registry.fill(HIST("hYMCRec"), YD0(candidate1)); registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); - double ptParticle1 = candidate1.pt(); //trigger particle is the largest pT one - //D-Dbar correlation dedicated section //For like-sign, first loop on both D0 and D0bars. First candidate is for sure a D0 and D0bars (looping on filtered) and was already matched, so don't re-check anything on it) for (auto& candidate2 : candidates) { @@ -549,14 +547,14 @@ struct D0D0barCorrelatorMCRecLS { } bool conditionLSForD0 = (candidate1.isSelD0() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == 1 << D0ToPiK) && (candidate2.isSelD0() >= dSelectionFlagD0bar && candidate2.flagMCMatchRec() == 1 << D0ToPiK); bool conditionLSForD0bar = (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << D0ToPiK) && (candidate2.isSelD0bar() >= dSelectionFlagD0bar && candidate2.flagMCMatchRec() == -1 << D0ToPiK); - if (candidate2.pt() < ptParticle1 && (conditionLSForD0 || conditionLSForD0bar)) { //LS pair (of D0 or of D0bar) + pt2= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { continue; } if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { continue; } - //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + //Excluding self-correlations if (candidate1.mRowIndex == candidate2.mRowIndex) { continue; } @@ -577,6 +575,7 @@ struct D0D0barCorrelatorMCRecLS { }; /// D0-D0bar correlation pair builder - for MC gen-level analysis, like sign particles +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. struct D0D0barCorrelatorMCGenLS { Produces entryD0D0barPair; @@ -608,7 +607,7 @@ struct D0D0barCorrelatorMCGenLS { //check if the particle is D0 or D0bar (both can be trigger) - NOTE: decay channel is not probed! if (std::abs(particle1.pdgCode()) != 421) { continue; - } + } if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { continue; } @@ -616,8 +615,6 @@ struct D0D0barCorrelatorMCGenLS { continue; } - double ptParticle1 = particle1.pt(); //trigger particle is the largest pT one - registry.fill(HIST("hPtCandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); @@ -629,15 +626,15 @@ struct D0D0barCorrelatorMCGenLS { for (auto& particle2 : particlesMC) { if (std::abs(particle2.pdgCode()) != 421) { //check that associated is a D0/D0bar (both are fine) continue; - } + } if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { continue; } if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { continue; } - if (particle2.pt() < ptParticle1 && particle2.pdgCode() == particle1.pdgCode()) { //like-sign condition (both 421 or both -421) and pT_Trig>pT_assoc - //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + if (particle2.pdgCode() == particle1.pdgCode()) { //like-sign condition (both 421 or both -421) and pT_Trig>pT_assoc + //Excluding self-correlations if (particle1.mRowIndex == particle2.mRowIndex) { continue; } @@ -647,7 +644,7 @@ struct D0D0barCorrelatorMCGenLS { particle2.pt()); } } // end inner loop (Dbars) - } //end outer loop + } //end outer loop registry.fill(HIST("hcountD0D0barPerEvent"), counterD0D0bar); } }; @@ -735,6 +732,7 @@ struct CCbarCorrelatorMCGen { }; /// c-cbar correlator table builder - for MC gen-level analysis - Like Sign +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. struct CCbarCorrelatorMCGenLS { Produces entryD0D0barPair; @@ -786,24 +784,27 @@ struct CCbarCorrelatorMCGenLS { counterccbar++; //count if c or cbar don't come from themselves during fragmentation (after kinematic selection) //c-cbar correlation dedicated section - double ptParticle1 = particle1.pt(); //trigger particle is the largest pT one registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) for (auto& particle2 : particlesMC) { if (std::abs(particle2.pdgCode()) != 4) { //search c or cbar for associated particles continue; - } + } if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { continue; } if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { continue; } - if (particle2.pt() < ptParticle1 && particle2.pdgCode() == particle1.pdgCode()) { + if (particle2.pdgCode() == particle1.pdgCode()) { //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == particle2.pdgCode()) { continue; } + //Excluding self-correlations + if (particle1.mRowIndex == particle2.mRowIndex) { + continue; + } entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), particle2.eta() - particle1.eta(), particle1.pt(), diff --git a/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx b/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx index 211a68690acb6..01a41824ba0e9 100644 --- a/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx +++ b/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx @@ -25,7 +25,7 @@ using namespace o2::aod::hf_cand_prong3; using namespace o2::analysis::hf_cuts_dplus_topikpi; using namespace o2::framework::expressions; using namespace o2::constants::math; -using namespace o2::aod::hf_ddbar_correlation; +using namespace o2::aod::hf_ddbar_correlation; void customize(std::vector& workflowOptions) { @@ -67,7 +67,7 @@ struct DplusDminusCorrelator { {{"hPtCand", "Dplus,Dminus candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng0", "Dplus,Dminus candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1", "Dplus,Dminus candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hPtProng2", "Dplus,Dminus candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, + {"hPtProng2", "Dplus,Dminus candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hSelectionStatus", "Dplus,Dminus candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, {"hEta", "Dplus,Dminus candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhi", "Dplus,Dminus candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, @@ -103,16 +103,15 @@ struct DplusDminusCorrelator { } int outerParticleSign = 1; //Dplus auto outerSecondTrack = candidate1.index1_as(); - if (outerSecondTrack.sign()==1) { + if (outerSecondTrack.sign() == 1) { outerParticleSign = -1; //Dminus (second daughter track is positive) } //fill invariant mass plots and generic info from all Dplus/Dminus candidates - if (outerParticleSign==1) { + if (outerParticleSign == 1) { registry.fill(HIST("hMass"), InvMassDPlus(candidate1), candidate1.pt()); registry.fill(HIST("hMassDplus"), InvMassDPlus(candidate1), candidate1.pt()); - } - else { + } else { registry.fill(HIST("hMass"), InvMassDPlus(candidate1), candidate1.pt()); registry.fill(HIST("hMassDminus"), InvMassDPlus(candidate1), candidate1.pt()); } @@ -127,7 +126,7 @@ struct DplusDminusCorrelator { //D-Dbar correlation dedicated section //if the candidate is a Dplus, search for Dminus and evaluate correlations - if (outerParticleSign==1) { + if (outerParticleSign == 1) { for (auto& candidate2 : candidates) { //check decay channel flag for candidate2 if (!(candidate2.hfflag() & 1 << DPlusToPiKPi)) { //probably dummy since already selected? not sure... @@ -135,10 +134,10 @@ struct DplusDminusCorrelator { } int innerParticleSign = 1; //Dplus auto innerSecondTrack = candidate2.index1_as(); - if (innerSecondTrack.sign()==1) { - innerParticleSign = -1; //Dminus (second daughter track is positive) + if (innerSecondTrack.sign() == 1) { + innerParticleSign = -1; //Dminus (second daughter track is positive) } - if (innerParticleSign==-1) { + if (innerParticleSign == -1) { if (cutYCandMax >= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { continue; } @@ -220,15 +219,14 @@ struct DplusDminusCorrelatorMCRec { } int outerParticleSign = 1; //Dplus auto outerSecondTrack = candidate1.index1_as(); - if (outerSecondTrack.sign()==1) { + if (outerSecondTrack.sign() == 1) { outerParticleSign = -1; //Dminus (second daughter track is positive) } if (std::abs(candidate1.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //fill invariant mass plots and generic info from all Dplus/Dminus candidates - if (outerParticleSign==1) { //matched as Dplus + if (outerParticleSign == 1) { //matched as Dplus registry.fill(HIST("hMassDplusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); - } - else { //matched as Dminus + } else { //matched as Dminus registry.fill(HIST("hMassDminusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); } registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); @@ -242,7 +240,7 @@ struct DplusDminusCorrelatorMCRec { } //D-Dbar correlation dedicated section - if (outerParticleSign==-1) { + if (outerParticleSign == -1) { continue; //reject Dminus in outer loop } if (std::abs(candidate1.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //candidate matched to Dplus (particle) @@ -256,13 +254,13 @@ struct DplusDminusCorrelatorMCRec { } int innerParticleSign = 1; //Dplus auto innerSecondTrack = candidate2.index1_as(); - if (innerSecondTrack.sign()==1) { - innerParticleSign = -1; //Dminus (second daughter track is positive) + if (innerSecondTrack.sign() == 1) { + innerParticleSign = -1; //Dminus (second daughter track is positive) } - if (innerParticleSign==1) { + if (innerParticleSign == 1) { continue; //reject Dplus in outer loop - } + } if (std::abs(candidate2.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //candidate matched to Dminus (antiparticle) flagDminusSignal = kTRUE; } else { //candidate of bkg, wrongly selected as Dminus @@ -354,7 +352,7 @@ struct DplusDminusCorrelatorMCGen { //D-Dbar correlation dedicated section //if it's a Dplus particle, search for Dminus and evaluate correlations - if (particle1.pdgCode() == 411) { //just checking the particle PDG, not the decay channel (differently from Reco: you have a BR factor btw such levels!) + if (particle1.pdgCode() == 411) { //just checking the particle PDG, not the decay channel (differently from Reco: you have a BR factor btw such levels!) registry.fill(HIST("hcountDplustriggersMCGen"), 0, particle1.pt()); //to count trigger Dplus (for normalisation) for (auto& particle2 : particlesMC) { if (particle2.pdgCode() == -411) { @@ -389,6 +387,7 @@ struct DplusDminusCorrelatorMCGen { }; /// Dplus-Dminus correlation pair builder - LIKE SIGN - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. struct DplusDminusCorrelatorLS { Produces entryDplusDminusPair; @@ -435,16 +434,15 @@ struct DplusDminusCorrelatorLS { } int outerParticleSign = 1; //Dplus auto outerSecondTrack = candidate1.index1_as(); - if (outerSecondTrack.sign()==1) { + if (outerSecondTrack.sign() == 1) { outerParticleSign = -1; //Dminus (second daughter track is positive) } //fill invariant mass plots and generic info from all Dplus/Dminus candidates - if (outerParticleSign==1) { + if (outerParticleSign == 1) { registry.fill(HIST("hMass"), InvMassDPlus(candidate1), candidate1.pt()); registry.fill(HIST("hMassDplus"), InvMassDPlus(candidate1), candidate1.pt()); - } - else { + } else { registry.fill(HIST("hMass"), InvMassDPlus(candidate1), candidate1.pt()); registry.fill(HIST("hMassDminus"), InvMassDPlus(candidate1), candidate1.pt()); } @@ -457,8 +455,6 @@ struct DplusDminusCorrelatorLS { registry.fill(HIST("hY"), YDPlus(candidate1)); registry.fill(HIST("hSelectionStatus"), candidate1.isSelDplusToPiKPi()); - double ptParticle1 = candidate1.pt(); //trigger particle is the largest-pT one - //D-Dbar correlation dedicated section //For like-sign, first loop on both Dplus and Dminus. First candidate is for sure a Dplus/Dminus (checked before, so don't re-check anything on it) for (auto& candidate2 : candidates) { @@ -469,18 +465,18 @@ struct DplusDminusCorrelatorLS { //check if inner particle is Dplus or Dminus int innerParticleSign = 1; //Dplus auto innerSecondTrack = candidate2.index1_as(); - if (innerSecondTrack.sign()==1) { - innerParticleSign = -1; //Dminus (second daughter track is positive) - } + if (innerSecondTrack.sign() == 1) { + innerParticleSign = -1; //Dminus (second daughter track is positive) + } //for the associated, has to have smaller pT, and has to be Dplus if outer is Dplu, or Dminus if outer is Dminus - if (candidate2.pt() < ptParticle1 && innerParticleSign==outerParticleSign) { + if (innerParticleSign == outerParticleSign) { if (cutYCandMax >= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { continue; } if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { continue; } - //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + //Excluding self-correlations if (candidate1.mRowIndex == candidate2.mRowIndex) { continue; } @@ -493,11 +489,12 @@ struct DplusDminusCorrelatorLS { 0); } } // end inner loop - } //end outer loop + } //end outer loop } }; /// Dplus-Dminus correlation pair builder - LIKE SIGN - for MC reco analysis (data-like but matching to true Dplus and Dminus) +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. struct DplusDminusCorrelatorMCRecLS { Produces entryDplusDminusPair; Produces entryDplusDminusRecoInfo; @@ -543,15 +540,14 @@ struct DplusDminusCorrelatorMCRecLS { } int outerParticleSign = 1; //Dplus auto outerSecondTrack = candidate1.index1_as(); - if (outerSecondTrack.sign()==1) { + if (outerSecondTrack.sign() == 1) { outerParticleSign = -1; //Dminus (second daughter track is positive) - } + } if (std::abs(candidate1.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //fill invariant mass plots and generic info from all Dplus/Dminus candidates - if (outerParticleSign==1) { //matched as Dplus + if (outerParticleSign == 1) { //matched as Dplus registry.fill(HIST("hMassDplusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); - } - else { //matched as Dminus + } else { //matched as Dminus registry.fill(HIST("hMassDminusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); } registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); @@ -561,9 +557,7 @@ struct DplusDminusCorrelatorMCRecLS { registry.fill(HIST("hEtaMCRec"), candidate1.eta()); registry.fill(HIST("hPhiMCRec"), candidate1.phi()); registry.fill(HIST("hYMCRec"), YDPlus(candidate1)); - registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelDplusToPiKPi()); - - double ptParticle1 = candidate1.pt(); //trigger particle is the largest pT one + registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelDplusToPiKPi()); //D-Dbar correlation dedicated section //For like-sign, first loop on both Dplus and Dminus. First candidate is for sure a Dplus/Dminus (looping on filtered) and was already matched, so don't re-check anything on it) @@ -574,13 +568,13 @@ struct DplusDminusCorrelatorMCRecLS { } int innerParticleSign = 1; //Dplus auto innerSecondTrack = candidate2.index1_as(); - if (innerSecondTrack.sign()==1) { - innerParticleSign = -1; //Dminus (second daughter track is positive) - } + if (innerSecondTrack.sign() == 1) { + innerParticleSign = -1; //Dminus (second daughter track is positive) + } if (!std::abs(candidate2.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //reject fake candidates continue; } - if (candidate2.pt() < ptParticle1 && outerParticleSign==innerParticleSign) { //LS pair (of Dplus or Dmnius) + pt2= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { continue; } @@ -608,6 +602,7 @@ struct DplusDminusCorrelatorMCRecLS { }; /// Dplus-Dminus correlation pair builder - for MC gen-level analysis, like sign particles +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. struct DplusDminusCorrelatorMCGenLS { Produces entryDplusDminusPair; @@ -647,8 +642,6 @@ struct DplusDminusCorrelatorMCGenLS { continue; } - double ptParticle1 = particle1.pt(); //trigger particle is the largest pT one - registry.fill(HIST("hPtCandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); @@ -668,7 +661,7 @@ struct DplusDminusCorrelatorMCGenLS { if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { continue; } - if (particle2.pt() < ptParticle1 && particle2.pdgCode() == particle1.pdgCode()) { //like-sign condition (both 411 or both -411) and pT_Trig>pT_assoc + if (particle2.pdgCode() == particle1.pdgCode()) { //like-sign condition (both 411 or both -411) and pT_Trig>pT_assoc //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) if (particle1.mRowIndex == particle2.mRowIndex) { continue; @@ -754,9 +747,9 @@ struct CCbarCorrelatorMCGen { continue; } entryccbarPair(getDeltaPhi(particle2.phi(), particle1.phi()), - particle2.eta() - particle1.eta(), - particle1.pt(), - particle2.pt()); + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); } // end outer if (check cbar) } // end inner loop } //end outer if (check c) @@ -766,6 +759,7 @@ struct CCbarCorrelatorMCGen { }; /// c-cbar correlator table builder - for MC gen-level analysis - Like Sign +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. struct CCbarCorrelatorMCGenLS { Produces entryccbarPair; @@ -817,7 +811,6 @@ struct CCbarCorrelatorMCGenLS { counterccbar++; //count if c or cbar don't come from themselves during fragmentation (after kinematic selection) //c-cbar correlation dedicated section - double ptParticle1 = particle1.pt(); //trigger particle is the largest pT one registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) for (auto& particle2 : particlesMC) { @@ -830,15 +823,19 @@ struct CCbarCorrelatorMCGenLS { if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { continue; } - if (particle2.pt() < ptParticle1 && particle2.pdgCode() == particle1.pdgCode()) { + if (particle2.pdgCode() == particle1.pdgCode()) { //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == particle2.pdgCode()) { continue; } + //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + if (particle1.mRowIndex == particle2.mRowIndex) { + continue; + } entryccbarPair(getDeltaPhi(particle2.phi(), particle1.phi()), - particle2.eta() - particle1.eta(), - particle1.pt(), - particle2.pt()); + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); } // end outer if (check PDG associate) } // end inner loop } //end outer loop @@ -863,8 +860,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) } else { //data analysis workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator"})); } -} - else { + } else { if (doMCGen) { //MC-Gen analysis workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-mc-gen-ls"})); } else if (doMCRec) { //MC-Reco analysis diff --git a/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx b/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx index b080633e98df9..f3782d39f06fd 100644 --- a/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx +++ b/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx @@ -129,9 +129,9 @@ struct TaskDDbarCorrelation { //reject entries outside pT ranges of interest double minPtAllowed = binsCorrelations->at(0); - double maxPtAllowed = binsCorrelations->at(binsCorrelations->size()-1); + double maxPtAllowed = binsCorrelations->at(binsCorrelations->size() - 1); if (ptD < minPtAllowed || ptDbar < minPtAllowed || ptD > maxPtAllowed || ptDbar > maxPtAllowed) { - continue; + continue; } //fill 2D invariant mass plots @@ -242,9 +242,9 @@ struct TaskDDbarCorrelationMCRec { //reject entries outside pT ranges of interest double minPtAllowed = binsCorrelations->at(0); - double maxPtAllowed = binsCorrelations->at(binsCorrelations->size()-1); + double maxPtAllowed = binsCorrelations->at(binsCorrelations->size() - 1); if (ptD < minPtAllowed || ptDbar < minPtAllowed || ptD > maxPtAllowed || ptDbar > maxPtAllowed) { - continue; + continue; } //fill 2D invariant mass plots @@ -346,7 +346,7 @@ struct TaskDDbarCorrelationMCGen { // redefinition of pT axes for THnSparse holding correlation entries int nBinspTaxis = binsCorrelations->size() - 1; const double* valuespTaxis = binsCorrelations->data(); - + for (int i = 2; i <= 3; i++) { registry.get(HIST("hCorrel2DVsPtMCGen"))->GetAxis(i)->Set(nBinspTaxis, valuespTaxis); } @@ -360,10 +360,10 @@ struct TaskDDbarCorrelationMCGen { double deltaEta = pairEntry.deltaEta(); double ptD = pairEntry.ptD(); double ptDbar = pairEntry.ptDbar(); - + //reject entries outside pT ranges of interest double minPtAllowed = binsCorrelations->at(0); - double maxPtAllowed = binsCorrelations->at(binsCorrelations->size()-1); + double maxPtAllowed = binsCorrelations->at(binsCorrelations->size() - 1); if (ptD < minPtAllowed || ptDbar < minPtAllowed || ptD > maxPtAllowed || ptDbar > maxPtAllowed) { continue; } From ee4e61165fd82c7b30cbad695611a0a2965c941a Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Mon, 10 May 2021 12:48:22 +0200 Subject: [PATCH 04/14] Minimal comment fix --- .../DataModel/include/AnalysisDataModel/HFSecondaryVertex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h index 6436baad222fd..9f7b3396f43d3 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h @@ -548,7 +548,7 @@ DECLARE_SOA_COLUMN(PtDbar, ptDbar, float); DECLARE_SOA_COLUMN(MD, mD, float); DECLARE_SOA_COLUMN(MDbar, mDbar, float); DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); -} // namespace hf_d0d0bar_correlation +} // namespace hf_ddbar_correlation DECLARE_SOA_TABLE(DDbarPair, "AOD", "DDBARPAIR", aod::hf_ddbar_correlation::DeltaPhi, aod::hf_ddbar_correlation::DeltaEta, From 8d96f2bdf5ee43ea09457b1cca226ef1059bf00e Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Thu, 27 May 2021 16:25:13 +0200 Subject: [PATCH 05/14] Update after PR review --- .../AnalysisDataModel/HFSecondaryVertex.h | 18 +- Analysis/Tasks/PWGHF/CMakeLists.txt | 25 +- ...Correlator.cxx => HFCorrelatorD0D0bar.cxx} | 429 ++++++++--------- ...elator.cxx => HFCorrelatorDplusDminus.cxx} | 447 +++++++++--------- ...rrelation.cxx => taskCorrelationDDbar.cxx} | 53 +-- 5 files changed, 473 insertions(+), 499 deletions(-) rename Analysis/Tasks/PWGHF/{D0D0barCorrelator.cxx => HFCorrelatorD0D0bar.cxx} (69%) rename Analysis/Tasks/PWGHF/{DplusDminusCorrelator.cxx => HFCorrelatorDplusDminus.cxx} (72%) rename Analysis/Tasks/PWGHF/{taskDDbarCorrelation.cxx => taskCorrelationDDbar.cxx} (95%) diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h index 96e0fdbbc0ae2..024addbf16a0c 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h @@ -653,7 +653,7 @@ DECLARE_SOA_TABLE(HfCandProng3MCGen, "AOD", "HFCANDP3MCGEN", //! hf_cand_prong3::FlagMCDecayChanGen); // definition of columns and tables for D-Dbar correlation pairs -namespace hf_ddbar_correlation +namespace hf_correlation_ddbar { DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); DECLARE_SOA_COLUMN(DeltaEta, deltaEta, float); @@ -662,16 +662,16 @@ DECLARE_SOA_COLUMN(PtDbar, ptDbar, float); DECLARE_SOA_COLUMN(MD, mD, float); DECLARE_SOA_COLUMN(MDbar, mDbar, float); DECLARE_SOA_COLUMN(SignalStatus, signalStatus, int); -} // namespace hf_ddbar_correlation +} // namespace hf_correlation_ddbar DECLARE_SOA_TABLE(DDbarPair, "AOD", "DDBARPAIR", - aod::hf_ddbar_correlation::DeltaPhi, - aod::hf_ddbar_correlation::DeltaEta, - aod::hf_ddbar_correlation::PtD, - aod::hf_ddbar_correlation::PtDbar); + aod::hf_correlation_ddbar::DeltaPhi, + aod::hf_correlation_ddbar::DeltaEta, + aod::hf_correlation_ddbar::PtD, + aod::hf_correlation_ddbar::PtDbar); DECLARE_SOA_TABLE(DDbarRecoInfo, "AOD", "DDBARRECOINFO", - aod::hf_ddbar_correlation::MD, - aod::hf_ddbar_correlation::MDbar, - aod::hf_ddbar_correlation::SignalStatus); + aod::hf_correlation_ddbar::MD, + aod::hf_correlation_ddbar::MDbar, + aod::hf_correlation_ddbar::SignalStatus); } // namespace o2::aod #endif // O2_ANALYSIS_HFSECONDARYVERTEX_H_ diff --git a/Analysis/Tasks/PWGHF/CMakeLists.txt b/Analysis/Tasks/PWGHF/CMakeLists.txt index 2dbd956a8bd55..ad51e257e161c 100644 --- a/Analysis/Tasks/PWGHF/CMakeLists.txt +++ b/Analysis/Tasks/PWGHF/CMakeLists.txt @@ -118,28 +118,27 @@ o2_add_dpl_workflow(hf-task-x PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing COMPONENT_NAME Analysis) -o2_add_dpl_workflow(hf-d0d0bar-correlator - SOURCES D0D0barCorrelator.cxx +o2_add_dpl_workflow(hf-mc-validation + SOURCES HFMCValidation.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing COMPONENT_NAME Analysis) -o2_add_dpl_workflow(hf-dplusdminus-correlator - SOURCES DplusDminusCorrelator.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing +o2_add_dpl_workflow(hf-task-lc-tok0sp + SOURCES taskLcK0sP.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils COMPONENT_NAME Analysis) -o2_add_dpl_workflow(hf-task-ddbar-correlation - SOURCES taskDDbarCorrelation.cxx +o2_add_dpl_workflow(hf-correlator-d0d0bar + SOURCES HFCorrelatorD0D0bar.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing COMPONENT_NAME Analysis) -o2_add_dpl_workflow(hf-mc-validation - SOURCES HFMCValidation.cxx +o2_add_dpl_workflow(hf-correlator-dplusdminus + SOURCES HFCorrelatorDplusDminus.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing COMPONENT_NAME Analysis) -o2_add_dpl_workflow(hf-task-lc-tok0sp - SOURCES taskLcK0sP.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils +o2_add_dpl_workflow(hf-task-correlation-ddbar + SOURCES taskCorrelationDDbar.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing COMPONENT_NAME Analysis) - diff --git a/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx similarity index 69% rename from Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx rename to Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx index 85e2a988c03e3..c2a7571d84bbb 100644 --- a/Analysis/Tasks/PWGHF/D0D0barCorrelator.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx @@ -8,24 +8,23 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file D0D0barCorrelator.cxx +/// \file HFCorrelatorD0D0bar.cxx /// \brief D0-D0bar correlator task - data-like, MC-reco and MC-kine analyses. For ULS and LS pairs /// /// \author Fabio Colamaria , INFN Bari #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "AnalysisCore/HFSelectorCuts.h" #include "AnalysisDataModel/HFSecondaryVertex.h" #include "AnalysisDataModel/HFCandidateSelectionTables.h" using namespace o2; using namespace o2::framework; +using namespace o2::framework::expressions; using namespace o2::aod::hf_cand_prong2; +using namespace o2::aod::hf_correlation_ddbar; using namespace o2::analysis::hf_cuts_d0_topik; -using namespace o2::framework::expressions; using namespace o2::constants::math; -using namespace o2::aod::hf_ddbar_correlation; void customize(std::vector& workflowOptions) { @@ -57,7 +56,7 @@ const double incrementPtThreshold = 0.5; const double epsilon = 1E-5; /// D0-D0bar correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) -struct D0D0barCorrelator { +struct HfCorrelatorD0D0bar { Produces entryD0D0barPair; Produces entryD0D0barRecoInfo; @@ -67,14 +66,14 @@ struct D0D0barCorrelator { {{"hPtCand", "D0,D0bar candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng0", "D0,D0bar candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1", "D0,D0bar candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hSelectionStatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hSelectionStatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{4, -0.5, 3.5}}}}, {"hEta", "D0,D0bar candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhi", "D0,D0bar candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hY", "D0,D0bar candidates;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hDDbarVsEtaCut", "D0,D0bar pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; - Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; - Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; + Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; @@ -86,7 +85,7 @@ struct D0D0barCorrelator { registry.add("hMassD0bar", "D0,D0bar candidates;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= selectionFlagD0bar); void process(aod::Collision const& collision, soa::Filtered> const& candidates) { @@ -94,19 +93,19 @@ struct D0D0barCorrelator { if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate1.pt() < cutPtCandMin) { continue; } //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + if (!(candidate1.hfflag() & 1 << DecayType::D0ToPiK)) { continue; } //fill invariant mass plots and generic info from all D0/D0bar candidates - if (candidate1.isSelD0() >= dSelectionFlagD0) { + if (candidate1.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hMass"), InvMassD0(candidate1), candidate1.pt()); registry.fill(HIST("hMassD0"), InvMassD0(candidate1), candidate1.pt()); } - if (candidate1.isSelD0bar() >= dSelectionFlagD0bar) { + if (candidate1.isSelD0bar() >= selectionFlagD0bar) { registry.fill(HIST("hMass"), InvMassD0bar(candidate1), candidate1.pt()); registry.fill(HIST("hMassD0bar"), InvMassD0bar(candidate1), candidate1.pt()); } @@ -116,58 +115,60 @@ struct D0D0barCorrelator { registry.fill(HIST("hEta"), candidate1.eta()); registry.fill(HIST("hPhi"), candidate1.phi()); registry.fill(HIST("hY"), YD0(candidate1)); - registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); + registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); //D-Dbar correlation dedicated section //if the candidate is a D0, search for D0bar and evaluate correlations - if (candidate1.isSelD0() >= dSelectionFlagD0) { - for (auto& candidate2 : candidates) { - //check decay channel flag for candidate2 - if (!(candidate2.hfflag() & 1 << D0ToPiK)) { - continue; - } - if (candidate2.isSelD0bar() >= dSelectionFlagD0bar) { - if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { - continue; - } - if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { - continue; - } - //Excluding trigger self-correlations (possible in case of both mass hypotheses accepted) - if (candidate1.mRowIndex == candidate2.mRowIndex) { - continue; - } - entryD0D0barPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), - candidate2.eta() - candidate1.eta(), - candidate1.pt(), - candidate2.pt()); - entryD0D0barRecoInfo(InvMassD0(candidate1), - InvMassD0bar(candidate2), - 0); - double etaCut = 0.; - double ptCut = 0.; - do { //fill pairs vs etaCut plot - ptCut = 0.; - etaCut += incrementEtaCut; - do { //fill pairs vs etaCut plot - if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) - registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); - ptCut += incrementPtThreshold; - } while (ptCut < ptThresholdForMaxEtaCut - epsilon); - } while (etaCut < maxEtaCut - epsilon); - } - //note: candidates selected as both D0 and D0bar are used, and considered in both situation (but not auto-correlated): reflections could play a relevant role. - //another, more restrictive, option, could be to consider only candidates selected with a single option (D0 xor D0bar) - - } // end inner loop (Dbars) + if (candidate1.isSelD0() < selectionFlagD0) { + continue; } + for (auto& candidate2 : candidates) { + if (!(candidate2.hfflag() & 1 << DecayType::D0ToPiK)) { //check decay channel flag for candidate2 + continue; + } + if (candidate2.isSelD0bar() < selectionFlagD0bar) { //keep only D0bar candidates passing the selection + continue; + } + //kinematic selection on D0bar candidates + if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && candidate2.pt() < cutPtCandMin) { + continue; + } + //excluding trigger self-correlations (possible in case of both mass hypotheses accepted) + if (candidate1.mRowIndex == candidate2.mRowIndex) { + continue; + } + entryD0D0barPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryD0D0barRecoInfo(InvMassD0(candidate1), + InvMassD0bar(candidate2), + 0); + double etaCut = 0.; + double ptCut = 0.; + do { //fill pairs vs etaCut plot + ptCut = 0.; + etaCut += incrementEtaCut; + do { //fill pairs vs etaCut plot + if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) + registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + ptCut += incrementPtThreshold; + } while (ptCut < ptThresholdForMaxEtaCut - epsilon); + } while (etaCut < maxEtaCut - epsilon); + //note: candidates selected as both D0 and D0bar are used, and considered in both situation (but not auto-correlated): reflections could play a relevant role. + //another, more restrictive, option, could be to consider only candidates selected with a single option (D0 xor D0bar) + + } // end inner loop (Dbars) } //end outer loop } }; /// D0-D0bar correlation pair builder - for MC reco-level analysis (candidates matched to true signal only, but also the various bkg sources are studied) -struct D0D0barCorrelatorMCRec { +struct HfCorrelatorD0D0barMCRec { Produces entryD0D0barPair; Produces entryD0D0barRecoInfo; @@ -178,14 +179,14 @@ struct D0D0barCorrelatorMCRec { {{"hPtCandMCRec", "D0,D0bar candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng0MCRec", "D0,D0bar candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1MCRec", "D0,D0bar candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hSelectionStatusMCRec", "D0,D0bar candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hSelectionStatusMCRec", "D0,D0bar candidates - MC reco;selection status;entries", {HistType::kTH1F, {{4, -0.5, 3.5}}}}, {"hEtaMCRec", "D0,D0bar candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCRec", "D0,D0bar candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hYMCRec", "D0,D0bar candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hDDbarVsEtaCut", "D0,D0bar pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; - Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; - Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; + Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; @@ -196,30 +197,30 @@ struct D0D0barCorrelatorMCRec { registry.add("hMassD0barMCRec", "D0,D0bar candidates - MC reco;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= selectionFlagD0bar); void process(aod::Collision const& collision, soa::Filtered> const& candidates) { //MC reco level - bool flagD0Signal = kFALSE; - bool flagD0barSignal = kFALSE; + bool flagD0Signal = false; + bool flagD0barSignal = false; for (auto& candidate1 : candidates) { //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + if (!(candidate1.hfflag() & 1 << DecayType::D0ToPiK)) { continue; } if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate1.pt() < cutPtCandMin) { continue; } - if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { + if (std::abs(candidate1.flagMCMatchRec()) == 1 << DecayType::D0ToPiK) { //fill invariant mass plots and generic info from all D0/D0bar candidates - if (candidate1.isSelD0() >= dSelectionFlagD0 && candidate1.flagMCMatchRec() == 1 << D0ToPiK) { //only reco and matched as D0 + if (candidate1.isSelD0() >= selectionFlagD0 && candidate1.flagMCMatchRec() == 1 << DecayType::D0ToPiK) { //only reco and matched as D0 registry.fill(HIST("hMassD0MCRec"), InvMassD0(candidate1), candidate1.pt()); } - if (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << D0ToPiK) { //only reco and matched as D0bar + if (candidate1.isSelD0bar() >= selectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << DecayType::D0ToPiK) { //only reco and matched as D0bar registry.fill(HIST("hMassD0barMCRec"), InvMassD0bar(candidate1), candidate1.pt()); } registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); @@ -228,35 +229,27 @@ struct D0D0barCorrelatorMCRec { registry.fill(HIST("hEtaMCRec"), candidate1.eta()); registry.fill(HIST("hPhiMCRec"), candidate1.phi()); registry.fill(HIST("hYMCRec"), YD0(candidate1)); - registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); + registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); } //D-Dbar correlation dedicated section //if the candidate is selected ad D0, search for D0bar and evaluate correlations - if (candidate1.isSelD0() < dSelectionFlagD0) { //discard candidates not selected as D0 in outer loop + if (candidate1.isSelD0() < selectionFlagD0) { //discard candidates not selected as D0 in outer loop continue; } - if (candidate1.flagMCMatchRec() == 1 << D0ToPiK) { //candidate matched to D0 (particle) - flagD0Signal = kTRUE; - } else { //candidate of bkg, wrongly selected as D0 - flagD0Signal = kFALSE; - } + flagD0Signal = candidate1.flagMCMatchRec() == 1 << DecayType::D0ToPiK; //flagD0Signal 'true' if candidate1 matched to D0 (particle) for (auto& candidate2 : candidates) { - if (!(candidate2.hfflag() & 1 << D0ToPiK)) { //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << DecayType::D0ToPiK)) { //check decay channel flag for candidate2 continue; } - if (candidate2.isSelD0bar() < dSelectionFlagD0bar) { //discard candidates not selected as D0bar in inner loop + if (candidate2.isSelD0bar() < selectionFlagD0bar) { //discard candidates not selected as D0bar in inner loop continue; } - if (candidate2.flagMCMatchRec() == -1 << D0ToPiK) { //candidate matched to D0bar (antiparticle) - flagD0barSignal = kTRUE; - } else { //candidate of bkg, wrongly selected as D0bar - flagD0barSignal = kFALSE; - } + flagD0barSignal = candidate2.flagMCMatchRec() == -1 << DecayType::D0ToPiK; //flagD0barSignal 'true' if candidate2 matched to D0 (particle) if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate2.pt() < cutPtCandMin) { continue; } //Excluding trigger self-correlations (possible in case of both mass hypotheses accepted) @@ -296,7 +289,7 @@ struct D0D0barCorrelatorMCRec { }; /// D0-D0bar correlation pair builder - for MC gen-level analysis (no filter/selection, only true signal) -struct D0D0barCorrelatorMCGen { +struct HfCorrelatorD0D0barMCGen { Produces entryD0D0barPair; @@ -326,60 +319,63 @@ struct D0D0barCorrelatorMCGen { //MC gen level for (auto& particle1 : particlesMC) { //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()) != 421) { + if (std::abs(particle1.pdgCode()) != pdg::Code::kD0) { continue; } - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + if (cutYCandMax >= 0. && std::abs(yD) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } registry.fill(HIST("hPtCandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); - registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + registry.fill(HIST("hYMCGen"), yD); counterD0D0bar++; //D-Dbar correlation dedicated section //if it's a D0 particle, search for D0bar and evaluate correlations - if (particle1.pdgCode() == 421) { //just checking the particle PDG, not the decay channel (differently from Reco: you have a BR factor btw such levels!) - registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger D0 (for normalisation) - for (auto& particle2 : particlesMC) { - if (particle2.pdgCode() == -421) { - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { - continue; - } - if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { - continue; - } - entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), - particle2.eta() - particle1.eta(), - particle1.pt(), - particle2.pt()); - double etaCut = 0.; - double ptCut = 0.; - do { //fill pairs vs etaCut plot - ptCut = 0.; - etaCut += incrementEtaCut; - do { //fill pairs vs etaCut plot - if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) - registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); - ptCut += incrementPtThreshold; - } while (ptCut < ptThresholdForMaxEtaCut - epsilon); - } while (etaCut < maxEtaCut - epsilon); - } // end D0bar check - } //end inner loop - } //end D0 check - - } //end outer loop + if (particle1.pdgCode() != pdg::Code::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("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger D0 (for normalisation) + for (auto& particle2 : particlesMC) { + if (particle2.pdgCode() != pdg::Code::kD0bar) { //check that inner particle is D0bar + continue; + } + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { + continue; + } + entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + double etaCut = 0.; + double ptCut = 0.; + do { //fill pairs vs etaCut plot + ptCut = 0.; + etaCut += incrementEtaCut; + do { //fill pairs vs etaCut plot + if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) + registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + ptCut += incrementPtThreshold; + } while (ptCut < ptThresholdForMaxEtaCut - epsilon); + } while (etaCut < maxEtaCut - epsilon); + } //end inner loop + } //end outer loop registry.fill(HIST("hcountD0D0barPerEvent"), counterD0D0bar); } }; /// D0-D0bar correlation pair builder - LIKE SIGN - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) -/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct D0D0barCorrelatorLS { +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, +/// since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. +struct HfCorrelatorD0D0barLS { Produces entryD0D0barPair; Produces entryD0D0barRecoInfo; @@ -390,13 +386,13 @@ struct D0D0barCorrelatorLS { {{"hPtCand", "D0,D0bar candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng0", "D0,D0bar candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1", "D0,D0bar candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hSelectionStatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hSelectionStatus", "D0,D0bar candidates;selection status;entries", {HistType::kTH1F, {{4, -0.5, 3.5}}}}, {"hEta", "D0,D0bar candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhi", "D0,D0bar candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hY", "D0,D0bar candidates;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; - Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; - Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; + Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; @@ -408,27 +404,27 @@ struct D0D0barCorrelatorLS { registry.add("hMassD0bar", "D0,D0bar candidates;inv. mass D0bar only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= selectionFlagD0bar); void process(aod::Collision const& collision, soa::Filtered> const& candidates) { for (auto& candidate1 : candidates) { //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + if (!(candidate1.hfflag() & 1 << DecayType::D0ToPiK)) { continue; } if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate1.pt() < cutPtCandMin) { continue; } //fill invariant mass plots and generic info from all D0/D0bar candidates - if (candidate1.isSelD0() >= dSelectionFlagD0) { + if (candidate1.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hMass"), InvMassD0(candidate1), candidate1.pt()); registry.fill(HIST("hMassD0"), InvMassD0(candidate1), candidate1.pt()); } - if (candidate1.isSelD0bar() >= dSelectionFlagD0bar) { + if (candidate1.isSelD0bar() >= selectionFlagD0bar) { registry.fill(HIST("hMass"), InvMassD0bar(candidate1), candidate1.pt()); registry.fill(HIST("hMassD0bar"), InvMassD0bar(candidate1), candidate1.pt()); } @@ -438,21 +434,21 @@ struct D0D0barCorrelatorLS { registry.fill(HIST("hEta"), candidate1.eta()); registry.fill(HIST("hPhi"), candidate1.phi()); registry.fill(HIST("hY"), YD0(candidate1)); - registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); + registry.fill(HIST("hSelectionStatus"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); //D-Dbar correlation dedicated section //For like-sign, first loop on both D0 and D0bars. First candidate is for sure a D0 and D0bars (checked before, so don't re-check anything on it) for (auto& candidate2 : candidates) { //check decay channel flag for candidate2 - if (!(candidate2.hfflag() & 1 << D0ToPiK)) { + if (!(candidate2.hfflag() & 1 << DecayType::D0ToPiK)) { continue; } //for the associated, has to have smaller pT, and pass D0sel if trigger passes D0sel, or D0barsel if trigger passes D0barsel - if ((candidate1.isSelD0() >= dSelectionFlagD0 && candidate2.isSelD0() >= dSelectionFlagD0) || (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate2.isSelD0bar() >= dSelectionFlagD0bar)) { + if ((candidate1.isSelD0() >= selectionFlagD0 && candidate2.isSelD0() >= selectionFlagD0) || (candidate1.isSelD0bar() >= selectionFlagD0bar && candidate2.isSelD0bar() >= selectionFlagD0bar)) { if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate2.pt() < cutPtCandMin) { continue; } //Excluding self-correlations @@ -469,16 +465,15 @@ struct D0D0barCorrelatorLS { } //note: candidates selected as both D0 and D0bar are used, and considered in both situation (but not auto-correlated): reflections could play a relevant role. //another, more restrictive, option, could be to consider only candidates selected with a single option (D0 xor D0bar) - } // end inner loop (Dbars) - - } //end outer loop + } //end outer loop } }; /// D0-D0bar correlation pair builder - LIKE SIGN - for MC reco analysis (data-like but matching to true DO and D0bar) -/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct D0D0barCorrelatorMCRecLS { +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, +/// since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. +struct HfCorrelatorD0D0barMCRecLS { Produces entryD0D0barPair; Produces entryD0D0barRecoInfo; @@ -489,13 +484,13 @@ struct D0D0barCorrelatorMCRecLS { {{"hPtCandMCRec", "D0,D0bar candidates - MC reco;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng0MCRec", "D0,D0bar candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1MCRec", "D0,D0bar candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hSelectionStatusMCRec", "D0,D0bar candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hSelectionStatusMCRec", "D0,D0bar candidates - MC reco;selection status;entries", {HistType::kTH1F, {{4, -0.5, 3.5}}}}, {"hEtaMCRec", "D0,D0bar candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCRec", "D0,D0bar candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hYMCRec", "D0,D0bar candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; - Configurable dSelectionFlagD0{"dSelectionFlagD0", 1, "Selection Flag for D0"}; - Configurable dSelectionFlagD0bar{"dSelectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; + Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for candidate mass plots"}; @@ -506,28 +501,28 @@ struct D0D0barCorrelatorMCRecLS { registry.add("hMassD0barMCRec", "D0,D0bar candidates - MC reco;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= dSelectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= dSelectionFlagD0bar); + Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= selectionFlagD0bar); void process(aod::Collision const& collision, soa::Filtered> const& candidates) { //MC reco level for (auto& candidate1 : candidates) { //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << D0ToPiK)) { + if (!(candidate1.hfflag() & 1 << DecayType::D0ToPiK)) { continue; } if (cutYCandMax >= 0. && std::abs(YD0(candidate1)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate1.pt() < cutPtCandMin) { continue; } - if (std::abs(candidate1.flagMCMatchRec()) == 1 << D0ToPiK) { + if (std::abs(candidate1.flagMCMatchRec()) == 1 << DecayType::D0ToPiK) { //fill invariant mass plots and generic info from all D0/D0bar candidates - if (candidate1.isSelD0() >= dSelectionFlagD0 && candidate1.flagMCMatchRec() == D0ToPiK) { //only reco and matched as D0 + if (candidate1.isSelD0() >= selectionFlagD0 && candidate1.flagMCMatchRec() == DecayType::D0ToPiK) { //only reco and matched as D0 registry.fill(HIST("hMassD0MCRec"), InvMassD0(candidate1)); } - if (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == D0ToPiK) { //only reco and matched as D0bar + if (candidate1.isSelD0bar() >= selectionFlagD0bar && candidate1.flagMCMatchRec() == DecayType::D0ToPiK) { //only reco and matched as D0bar registry.fill(HIST("hMassD0barMCRec"), InvMassD0bar(candidate1)); } registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); @@ -536,22 +531,22 @@ struct D0D0barCorrelatorMCRecLS { registry.fill(HIST("hEtaMCRec"), candidate1.eta()); registry.fill(HIST("hPhiMCRec"), candidate1.phi()); registry.fill(HIST("hYMCRec"), YD0(candidate1)); - registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelD0() + (candidate1.isSelD0bar() * 2)); + registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelD0bar() + (candidate1.isSelD0() * 2)); //D-Dbar correlation dedicated section //For like-sign, first loop on both D0 and D0bars. First candidate is for sure a D0 and D0bars (looping on filtered) and was already matched, so don't re-check anything on it) for (auto& candidate2 : candidates) { //check decay channel flag for candidate2 - if (!(candidate2.hfflag() & 1 << D0ToPiK)) { + if (!(candidate2.hfflag() & 1 << DecayType::D0ToPiK)) { continue; } - bool conditionLSForD0 = (candidate1.isSelD0() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == 1 << D0ToPiK) && (candidate2.isSelD0() >= dSelectionFlagD0bar && candidate2.flagMCMatchRec() == 1 << D0ToPiK); - bool conditionLSForD0bar = (candidate1.isSelD0bar() >= dSelectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << D0ToPiK) && (candidate2.isSelD0bar() >= dSelectionFlagD0bar && candidate2.flagMCMatchRec() == -1 << D0ToPiK); + bool conditionLSForD0 = (candidate1.isSelD0() >= selectionFlagD0bar && candidate1.flagMCMatchRec() == 1 << DecayType::D0ToPiK) && (candidate2.isSelD0() >= selectionFlagD0bar && candidate2.flagMCMatchRec() == 1 << DecayType::D0ToPiK); + bool conditionLSForD0bar = (candidate1.isSelD0bar() >= selectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << DecayType::D0ToPiK) && (candidate2.isSelD0bar() >= selectionFlagD0bar && candidate2.flagMCMatchRec() == -1 << DecayType::D0ToPiK); if (conditionLSForD0 || conditionLSForD0bar) { //LS pair (of D0 or of D0bar) + pt2= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate2.pt() < cutPtCandMin) { continue; } //Excluding self-correlations @@ -567,16 +562,16 @@ struct D0D0barCorrelatorMCRecLS { 0); //for LS studies we set a dummy 0 for pairSignalStatus (there are no more the usual 4 possible combinations) } //end inner if (MC match) - - } // end inner loop (Dbars) - } //end outer if (MC match) - } //end outer loop + } // end inner loop (Dbars) + } //end outer if (MC match) + } //end outer loop } }; /// D0-D0bar correlation pair builder - for MC gen-level analysis, like sign particles -/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct D0D0barCorrelatorMCGenLS { +/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, +/// since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. +struct HfCorrelatorD0D0barMCGenLS { Produces entryD0D0barPair; @@ -605,32 +600,33 @@ struct D0D0barCorrelatorMCGenLS { //MC gen level for (auto& particle1 : particlesMC) { //check if the particle is D0 or D0bar (both can be trigger) - NOTE: decay channel is not probed! - if (std::abs(particle1.pdgCode()) != 421) { + if (std::abs(particle1.pdgCode()) != pdg::Code::kD0) { continue; } - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + if (cutYCandMax >= 0. && std::abs(yD) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } registry.fill(HIST("hPtCandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); - registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + registry.fill(HIST("hYMCGen"), yD); counterD0D0bar++; //D-Dbar correlation dedicated section //if it's D0, search for D0bar and evaluate correlations. registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger D0 (normalisation) for (auto& particle2 : particlesMC) { - if (std::abs(particle2.pdgCode()) != 421) { //check that associated is a D0/D0bar (both are fine) + if (std::abs(particle2.pdgCode()) != pdg::Code::kD0) { //check that associated is a D0/D0bar (both are fine) continue; } if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { continue; } if (particle2.pdgCode() == particle1.pdgCode()) { //like-sign condition (both 421 or both -421) and pT_Trig>pT_assoc @@ -650,9 +646,9 @@ struct D0D0barCorrelatorMCGenLS { }; /// c-cbar correlator table builder - for MC gen-level analysis -struct CCbarCorrelatorMCGen { +struct HfCorrelatorCCbarMCGen { - Produces entryD0D0barPair; + Produces entryccbarPair; HistogramRegistry registry{ "registry", @@ -661,7 +657,8 @@ struct CCbarCorrelatorMCGen { {"hEtaMCGen", "c,cbar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hYMCGen", "c,cbar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCGen", "c,cbar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, - {"hcountD0D0barPerEvent", "D0,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + {"hcountCCbarPerEvent", "c,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}, + {"hcountCCbarPerEventPreEtaCut", "c,cbar particles - MC gen;Number per event pre #eta cut;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; @@ -669,7 +666,7 @@ struct CCbarCorrelatorMCGen { void init(o2::framework::InitContext&) { - registry.add("hcountD0triggersMCGen", "c trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hcountCtriggersMCGen", "c trigger particles - MC gen;;N of trigger c quark", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) @@ -688,54 +685,56 @@ struct CCbarCorrelatorMCGen { continue; } counterccbarPreEtasel++; //count c or cbar (before kinematic selection) - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) + if (cutYCandMax >= 0. && std::abs(yC) > cutYCandMax) + { continue; } - if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } registry.fill(HIST("hPtcandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); - registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + registry.fill(HIST("hYMCGen"), yC); counterccbar++; //count if c or cbar don't come from themselves during fragmentation (after kinematic selection) //c-cbar correlation dedicated section //if it's c, search for cbar and evaluate correlations. - if (particle1.pdgCode() == 4) { - - registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) + if (particle1.pdgCode() != 4) { + continue; + } + registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) - for (auto& particle2 : particlesMC) { - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { - continue; - } - if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { - continue; - } - if (particle2.pdgCode() == -4) { - //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it - if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == -4) { - continue; - } - entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), - particle2.eta() - particle1.eta(), - particle1.pt(), - particle2.pt()); - } // end outer if (check cbar) - } // end inner loop - } //end outer if (check c) - } //end outer loop + for (auto& particle2 : particlesMC) { + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { + continue; + } + if (particle2.pdgCode() != -4) { //check that inner particle is a cbar + continue; + } + //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it + if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == -4) { + continue; + } + entryccbarPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + } // end inner loop + } //end outer loop registry.fill(HIST("hcountCCbarPerEvent"), counterccbar); registry.fill(HIST("hcountCCbarPerEventPreEtaCut"), counterccbarPreEtasel); } }; /// c-cbar correlator table builder - for MC gen-level analysis - Like Sign -/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct CCbarCorrelatorMCGenLS { +struct HfCorrelatorCCbarMCGenLS { - Produces entryD0D0barPair; + Produces entryccbarPair; HistogramRegistry registry{ "registry", @@ -744,7 +743,8 @@ struct CCbarCorrelatorMCGenLS { {"hEtaMCGen", "c,cbar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hYMCGen", "c,cbar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCGen", "c,cbar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, - {"hcountD0D0barPerEvent", "D0,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + {"hcountCCbarPerEvent", "c,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}, + {"hcountCCbarPerEventPreEtaCut", "c,cbar particles - MC gen;Number per event pre #eta cut;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; @@ -752,7 +752,7 @@ struct CCbarCorrelatorMCGenLS { void init(o2::framework::InitContext&) { - registry.add("hcountD0triggersMCGen", "c trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hcountCtriggersMCGen", "c trigger particles - MC gen;;N of trigger c quark", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) @@ -771,20 +771,21 @@ struct CCbarCorrelatorMCGenLS { continue; } counterccbarPreEtasel++; //count c or cbar (before kinematic selection) - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + if (cutYCandMax >= 0. && std::abs(yC) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } registry.fill(HIST("hPtcandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); - registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + registry.fill(HIST("hYMCGen"), yC); counterccbar++; //count if c or cbar don't come from themselves during fragmentation (after kinematic selection) //c-cbar correlation dedicated section - registry.fill(HIST("hcountD0triggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) + registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) for (auto& particle2 : particlesMC) { if (std::abs(particle2.pdgCode()) != 4) { //search c or cbar for associated particles @@ -793,7 +794,7 @@ struct CCbarCorrelatorMCGenLS { if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { continue; } if (particle2.pdgCode() == particle1.pdgCode()) { @@ -805,10 +806,10 @@ struct CCbarCorrelatorMCGenLS { if (particle1.mRowIndex == particle2.mRowIndex) { continue; } - entryD0D0barPair(getDeltaPhi(particle2.phi(), particle1.phi()), - particle2.eta() - particle1.eta(), - particle1.pt(), - particle2.pt()); + entryccbarPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); } // end outer if (check PDG associate) } // end inner loop } //end outer loop @@ -826,23 +827,23 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) const bool doLikeSign = cfgc.options().get("doLikeSign"); if (!doLikeSign) { //unlike-sign analyses if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-gen"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar-mc-gen"})); } else if (doMCRec) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-rec"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar-mc-rec"})); } else if (doMCccbar) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"ccbar-correlator-mc-gen"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-ccbar-mc-gen"})); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar"})); } - } else { //ike-sign analyses + } else { //like-sign analyses if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-gen-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar-mc-gen-ls"})); } else if (doMCRec) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-mc-rec-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar-mc-rec-ls"})); } else if (doMCccbar) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"ccbar-correlator-mc-gen-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-ccbar-mc-gen-ls"})); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"d0d0bar-correlator-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar-ls"})); } } diff --git a/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx similarity index 72% rename from Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx rename to Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx index 01a41824ba0e9..f75ae31b7c02a 100644 --- a/Analysis/Tasks/PWGHF/DplusDminusCorrelator.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx @@ -8,24 +8,23 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file DplusDminusCorrelator.cxx +/// \file HFCorrelatorDplusDminus.cxx /// \brief Dplus-Dminus correlator task - data-like, MC-reco and MC-kine analyses. For ULS and LS pairs /// /// \author Fabio Colamaria , INFN Bari #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "AnalysisCore/HFSelectorCuts.h" #include "AnalysisDataModel/HFSecondaryVertex.h" #include "AnalysisDataModel/HFCandidateSelectionTables.h" using namespace o2; using namespace o2::framework; +using namespace o2::framework::expressions; using namespace o2::aod::hf_cand_prong3; +using namespace o2::aod::hf_correlation_ddbar; using namespace o2::analysis::hf_cuts_dplus_topikpi; -using namespace o2::framework::expressions; using namespace o2::constants::math; -using namespace o2::aod::hf_ddbar_correlation; void customize(std::vector& workflowOptions) { @@ -57,7 +56,7 @@ const double incrementPtThreshold = 0.5; const double epsilon = 1E-5; /// Dplus-Dminus correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) -struct DplusDminusCorrelator { +struct HfCorrelatorDplusDminus { Produces entryDplusDminusPair; Produces entryDplusDminusRecoInfo; @@ -68,13 +67,13 @@ struct DplusDminusCorrelator { {"hPtProng0", "Dplus,Dminus candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1", "Dplus,Dminus candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng2", "Dplus,Dminus candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hSelectionStatus", "Dplus,Dminus candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hSelectionStatus", "Dplus,Dminus candidates;selection status;entries", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, {"hEta", "Dplus,Dminus candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhi", "Dplus,Dminus candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hY", "Dplus,Dminus candidates;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hDDbarVsEtaCut", "Dplus,Dminus pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; - Configurable dSelectionFlagDplus{"dSelectionFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; + Configurable selectionFlagDplus{"selectionFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_dplus_topikpi::pTBins_v}, "pT bin limits for candidate mass plots"}; @@ -86,7 +85,7 @@ struct DplusDminusCorrelator { registry.add("hMassDminus", "Dplus,Dminus candidates;inv. mass Dminus only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= dSelectionFlagDplus); + Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus); void process(aod::Collision const& collision, soa::Filtered> const& candidates, aod::BigTracks const& tracks) { @@ -94,11 +93,11 @@ struct DplusDminusCorrelator { if (cutYCandMax >= 0. && std::abs(YDPlus(candidate1)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate1.pt() < cutPtCandMin) { continue; } //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << DPlusToPiKPi)) { //probably dummy since already selected? not sure... + if (!(candidate1.hfflag() & 1 << DecayType::DPlusToPiKPi)) { //probably dummy since already selected? not sure... continue; } int outerParticleSign = 1; //Dplus @@ -126,52 +125,49 @@ struct DplusDminusCorrelator { //D-Dbar correlation dedicated section //if the candidate is a Dplus, search for Dminus and evaluate correlations - if (outerParticleSign == 1) { - for (auto& candidate2 : candidates) { - //check decay channel flag for candidate2 - if (!(candidate2.hfflag() & 1 << DPlusToPiKPi)) { //probably dummy since already selected? not sure... - continue; - } - int innerParticleSign = 1; //Dplus - auto innerSecondTrack = candidate2.index1_as(); - if (innerSecondTrack.sign() == 1) { - innerParticleSign = -1; //Dminus (second daughter track is positive) - } - if (innerParticleSign == -1) { - if (cutYCandMax >= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { - continue; - } - if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { - continue; - } - entryDplusDminusPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), - candidate2.eta() - candidate1.eta(), - candidate1.pt(), - candidate2.pt()); - entryDplusDminusRecoInfo(InvMassDPlus(candidate1), - InvMassDPlus(candidate2), - 0); - double etaCut = 0.; - double ptCut = 0.; - do { //fill pairs vs etaCut plot - ptCut = 0.; - etaCut += incrementEtaCut; - do { //fill pairs vs etaCut plot - if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) - registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); - ptCut += incrementPtThreshold; - } while (ptCut < ptThresholdForMaxEtaCut - epsilon); - } while (etaCut < maxEtaCut - epsilon); - } - } // end inner loop (Dbars) + if (outerParticleSign != 1) { + continue; } - - } //end outer loop + for (auto& candidate2 : candidates) { + //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << DecayType::DPlusToPiKPi)) { //probably dummy since already selected? not sure... + continue; + } + auto innerSecondTrack = candidate2.index1_as(); + if (innerSecondTrack.sign() != 1) { //keep only Dminus (with second daughter track positive) + continue; + } + if (cutYCandMax >= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && candidate2.pt() < cutPtCandMin) { + continue; + } + entryDplusDminusPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryDplusDminusRecoInfo(InvMassDPlus(candidate1), + InvMassDPlus(candidate2), + 0); + double etaCut = 0.; + double ptCut = 0.; + do { //fill pairs vs etaCut plot + ptCut = 0.; + etaCut += incrementEtaCut; + do { //fill pairs vs etaCut plot + if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) + registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + ptCut += incrementPtThreshold; + } while (ptCut < ptThresholdForMaxEtaCut - epsilon); + } while (etaCut < maxEtaCut - epsilon); + } // end inner loop (Dminus) + } //end outer loop (Dplus) } }; /// Dplus-Dminus correlation pair builder - for MC reco-level analysis (candidates matched to true signal only, but also the various bkg sources are studied) -struct DplusDminusCorrelatorMCRec { +struct HfCorrelatorDplusDminusMCRec { Produces entryDplusDminusPair; Produces entryDplusDminusRecoInfo; @@ -182,13 +178,13 @@ struct DplusDminusCorrelatorMCRec { {"hPtProng0MCRec", "Dplus,Dminus candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1MCRec", "Dplus,Dminus candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng2MCRec", "Dplus,Dminus candidates - MC reco;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hSelectionStatusMCRec", "Dplus,Dminus candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hSelectionStatusMCRec", "Dplus,Dminus candidates - MC reco;selection status;entries", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, {"hEtaMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hYMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hDDbarVsEtaCut", "Dplus,Dminus pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; - Configurable dSelectionFlagDplus{"dSelectionFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; + Configurable selectionFlagDplus{"selectionFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_dplus_topikpi::pTBins_v}, "pT bin limits for candidate mass plots"}; @@ -199,22 +195,22 @@ struct DplusDminusCorrelatorMCRec { registry.add("hMassDminusMCRec", "Dplus,Dminus candidates - MC reco;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= dSelectionFlagDplus); + Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus); void process(aod::Collision const& collision, soa::Filtered> const& candidates, aod::BigTracks const& tracks) { //MC reco level - bool flagDplusSignal = kFALSE; - bool flagDminusSignal = kFALSE; + bool flagDplusSignal = false; + bool flagDminusSignal = false; for (auto& candidate1 : candidates) { //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << DPlusToPiKPi)) { + if (!(candidate1.hfflag() & 1 << DecayType::DPlusToPiKPi)) { continue; } if (cutYCandMax >= 0. && std::abs(YDPlus(candidate1)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate1.pt() < cutPtCandMin) { continue; } int outerParticleSign = 1; //Dplus @@ -222,7 +218,7 @@ struct DplusDminusCorrelatorMCRec { if (outerSecondTrack.sign() == 1) { outerParticleSign = -1; //Dminus (second daughter track is positive) } - if (std::abs(candidate1.flagMCMatchRec()) == 1 << DPlusToPiKPi) { + if (std::abs(candidate1.flagMCMatchRec()) == 1 << DecayType::DPlusToPiKPi) { //fill invariant mass plots and generic info from all Dplus/Dminus candidates if (outerParticleSign == 1) { //matched as Dplus registry.fill(HIST("hMassDplusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); @@ -243,33 +239,20 @@ struct DplusDminusCorrelatorMCRec { if (outerParticleSign == -1) { continue; //reject Dminus in outer loop } - if (std::abs(candidate1.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //candidate matched to Dplus (particle) - flagDplusSignal = kTRUE; - } else { //candidate of bkg, wrongly selected as Dplus - flagDplusSignal = kFALSE; - } + flagDplusSignal = std::abs(candidate1.flagMCMatchRec()) == 1 << DecayType::DPlusToPiKPi; //flagDplusSignal 'true' if candidate1 matched to Dplus for (auto& candidate2 : candidates) { - if (!(candidate2.hfflag() & 1 << DPlusToPiKPi)) { //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << DecayType::DPlusToPiKPi)) { //check decay channel flag for candidate2 continue; } - int innerParticleSign = 1; //Dplus auto innerSecondTrack = candidate2.index1_as(); - if (innerSecondTrack.sign() == 1) { - innerParticleSign = -1; //Dminus (second daughter track is positive) - } - - if (innerParticleSign == 1) { - continue; //reject Dplus in outer loop - } - if (std::abs(candidate2.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //candidate matched to Dminus (antiparticle) - flagDminusSignal = kTRUE; - } else { //candidate of bkg, wrongly selected as Dminus - flagDminusSignal = kFALSE; + if (innerSecondTrack.sign() != 1) { //keep only Dminus (with second daughter track positive) + continue; } + flagDminusSignal = std::abs(candidate2.flagMCMatchRec()) == 1 << DecayType::DPlusToPiKPi; //flagDminusSignal 'true' if candidate2 matched to Dminus if (cutYCandMax >= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate2.pt() < cutPtCandMin) { continue; } //choice of options (Dplus/Dminus signal/bkg) @@ -305,7 +288,7 @@ struct DplusDminusCorrelatorMCRec { }; /// Dplus-Dminus correlation pair builder - for MC gen-level analysis (no filter/selection, only true signal) -struct DplusDminusCorrelatorMCGen { +struct HfCorrelatorDplusDminusMCGen { Produces entryDplusDminusPair; @@ -335,60 +318,62 @@ struct DplusDminusCorrelatorMCGen { //MC gen level for (auto& particle1 : particlesMC) { //check if the particle is Dplus or Dminus (for general plot filling and selection, so both cases are fine) - NOTE: decay channel is not probed! - if (std::abs(particle1.pdgCode()) != 411) { + if (std::abs(particle1.pdgCode()) != pdg::Code::kDPlus) { continue; } - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + if (cutYCandMax >= 0. && std::abs(yD) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } registry.fill(HIST("hPtCandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); - registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + registry.fill(HIST("hYMCGen"), yD); counterDplusDminus++; //D-Dbar correlation dedicated section //if it's a Dplus particle, search for Dminus and evaluate correlations - if (particle1.pdgCode() == 411) { //just checking the particle PDG, not the decay channel (differently from Reco: you have a BR factor btw such levels!) - registry.fill(HIST("hcountDplustriggersMCGen"), 0, particle1.pt()); //to count trigger Dplus (for normalisation) - for (auto& particle2 : particlesMC) { - if (particle2.pdgCode() == -411) { - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { - continue; - } - if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { - continue; - } - entryDplusDminusPair(getDeltaPhi(particle2.phi(), particle1.phi()), - particle2.eta() - particle1.eta(), - particle1.pt(), - particle2.pt()); - double etaCut = 0.; - double ptCut = 0.; - do { //fill pairs vs etaCut plot - ptCut = 0.; - etaCut += incrementEtaCut; - do { //fill pairs vs etaCut plot - if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) - registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); - ptCut += incrementPtThreshold; - } while (ptCut < ptThresholdForMaxEtaCut - epsilon); - } while (etaCut < maxEtaCut - epsilon); - } // end Dminus check - } //end inner loop - } //end Dplus check - - } //end outer loop + if (particle1.pdgCode() != pdg::Code::kDPlus) { //just checking the particle PDG, not the decay channel (differently from Reco: you have a BR factor btw such levels!) + continue; + } + registry.fill(HIST("hcountDplustriggersMCGen"), 0, particle1.pt()); //to count trigger Dplus (for normalisation) + for (auto& particle2 : particlesMC) { + if (particle2.pdgCode() != -pdg::Code::kDPlus) { //check that inner particle is a Dminus + continue; + } + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { + continue; + } + entryDplusDminusPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + double etaCut = 0.; + double ptCut = 0.; + do { //fill pairs vs etaCut plot + ptCut = 0.; + etaCut += incrementEtaCut; + do { //fill pairs vs etaCut plot + if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) + registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + ptCut += incrementPtThreshold; + } while (ptCut < ptThresholdForMaxEtaCut - epsilon); + } while (etaCut < maxEtaCut - epsilon); + } //end inner loop + } //end outer loop registry.fill(HIST("hcountDplusDminusPerEvent"), counterDplusDminus); } }; /// Dplus-Dminus correlation pair builder - LIKE SIGN - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) /// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct DplusDminusCorrelatorLS { +struct HfCorrelatorDplusDminusLS { Produces entryDplusDminusPair; Produces entryDplusDminusRecoInfo; @@ -400,12 +385,12 @@ struct DplusDminusCorrelatorLS { {"hPtProng0", "Dplus,Dminus candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1", "Dplus,Dminus candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng2", "Dplus,Dminus candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hSelectionStatus", "Dplus,Dminus candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hSelectionStatus", "Dplus,Dminus candidates;selection status;entries", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, {"hEta", "Dplus,Dminus candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhi", "Dplus,Dminus candidates;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hY", "Dplus,Dminus candidates;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; - Configurable dSelectionFlagDplus{"dSelectivonFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; + Configurable selectionFlagDplus{"dSelectivonFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_dplus_topikpi::pTBins_v}, "pT bin limits for candidate mass plots"}; @@ -417,7 +402,7 @@ struct DplusDminusCorrelatorLS { registry.add("hMassDminus", "Dplus,Dminus candidates;inv. mass Dminus only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= dSelectionFlagDplus); + Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus); void process(aod::Collision const& collision, soa::Filtered> const& candidates, aod::BigTracks const& tracks) { @@ -425,11 +410,11 @@ struct DplusDminusCorrelatorLS { if (cutYCandMax >= 0. && std::abs(YDPlus(candidate1)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate1.pt() < cutPtCandMin) { continue; } //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << DPlusToPiKPi)) { //probably dummy since already selected? not sure... + if (!(candidate1.hfflag() & 1 << DecayType::DPlusToPiKPi)) { //probably dummy since already selected? not sure... continue; } int outerParticleSign = 1; //Dplus @@ -437,7 +422,6 @@ struct DplusDminusCorrelatorLS { if (outerSecondTrack.sign() == 1) { outerParticleSign = -1; //Dminus (second daughter track is positive) } - //fill invariant mass plots and generic info from all Dplus/Dminus candidates if (outerParticleSign == 1) { registry.fill(HIST("hMass"), InvMassDPlus(candidate1), candidate1.pt()); @@ -459,7 +443,7 @@ struct DplusDminusCorrelatorLS { //For like-sign, first loop on both Dplus and Dminus. First candidate is for sure a Dplus/Dminus (checked before, so don't re-check anything on it) for (auto& candidate2 : candidates) { //check decay channel flag for candidate2 - if (!(candidate2.hfflag() & 1 << DPlusToPiKPi)) { + if (!(candidate2.hfflag() & 1 << DecayType::DPlusToPiKPi)) { continue; } //check if inner particle is Dplus or Dminus @@ -473,7 +457,7 @@ struct DplusDminusCorrelatorLS { if (cutYCandMax >= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate2.pt() < cutPtCandMin) { continue; } //Excluding self-correlations @@ -495,7 +479,7 @@ struct DplusDminusCorrelatorLS { /// Dplus-Dminus correlation pair builder - LIKE SIGN - for MC reco analysis (data-like but matching to true Dplus and Dminus) /// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct DplusDminusCorrelatorMCRecLS { +struct HfCorrelatorDplusDminusMCRecLS { Produces entryDplusDminusPair; Produces entryDplusDminusRecoInfo; @@ -506,12 +490,12 @@ struct DplusDminusCorrelatorMCRecLS { {"hPtProng0MCRec", "Dplus,Dminus candidates - MC reco;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng1MCRec", "Dplus,Dminus candidates - MC reco;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, {"hPtProng2MCRec", "Dplus,Dminus candidates - MC reco;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{180, 0., 36.}}}}, - {"hSelectionStatusMCRec", "Dplus,Dminus candidates - MC reco;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hSelectionStatusMCRec", "Dplus,Dminus candidates - MC reco;selection status;entries", {HistType::kTH1F, {{2, -0.5, 1.5}}}}, {"hEtaMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hYMCRec", "Dplus,Dminus candidates - MC reco;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}}}; - Configurable dSelectionFlagDplus{"dSelectionFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; + Configurable selectionFlagDplus{"selectionFlagDplus", 1, "Selection Flag for Dplus,Dminus"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; Configurable> bins{"ptBinsForMass", std::vector{o2::analysis::hf_cuts_dplus_topikpi::pTBins_v}, "pT bin limits for candidate mass plots"}; @@ -522,20 +506,20 @@ struct DplusDminusCorrelatorMCRecLS { registry.add("hMassDminusMCRec", "Dplus,Dminus candidates - MC reco;inv. mass D0 only (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= dSelectionFlagDplus); + Filter filterSelectCandidates = (aod::hf_selcandidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus); void process(aod::Collision const& collision, soa::Filtered> const& candidates, aod::BigTracks const& tracks) { //MC reco level for (auto& candidate1 : candidates) { //check decay channel flag for candidate1 - if (!(candidate1.hfflag() & 1 << DPlusToPiKPi)) { + if (!(candidate1.hfflag() & 1 << DecayType::DPlusToPiKPi)) { continue; } if (cutYCandMax >= 0. && std::abs(YDPlus(candidate1)) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(candidate1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && candidate1.pt() < cutPtCandMin) { continue; } int outerParticleSign = 1; //Dplus @@ -543,67 +527,67 @@ struct DplusDminusCorrelatorMCRecLS { if (outerSecondTrack.sign() == 1) { outerParticleSign = -1; //Dminus (second daughter track is positive) } - if (std::abs(candidate1.flagMCMatchRec()) == 1 << DPlusToPiKPi) { - //fill invariant mass plots and generic info from all Dplus/Dminus candidates - if (outerParticleSign == 1) { //matched as Dplus - registry.fill(HIST("hMassDplusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); - } else { //matched as Dminus - registry.fill(HIST("hMassDminusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); - } - registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); - registry.fill(HIST("hPtProng0MCRec"), candidate1.ptProng0()); - registry.fill(HIST("hPtProng1MCRec"), candidate1.ptProng1()); - registry.fill(HIST("hPtProng2MCRec"), candidate1.ptProng2()); - registry.fill(HIST("hEtaMCRec"), candidate1.eta()); - registry.fill(HIST("hPhiMCRec"), candidate1.phi()); - registry.fill(HIST("hYMCRec"), YDPlus(candidate1)); - registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelDplusToPiKPi()); + if (std::abs(candidate1.flagMCMatchRec()) != 1 << DecayType::DPlusToPiKPi) { //keep only Dplus/Dminus matched candidates + continue; + } + //fill invariant mass plots and generic info from all Dplus/Dminus candidates + if (outerParticleSign == 1) { //matched as Dplus + registry.fill(HIST("hMassDplusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); + } else { //matched as Dminus + registry.fill(HIST("hMassDminusMCRec"), InvMassDPlus(candidate1), candidate1.pt()); + } + registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); + registry.fill(HIST("hPtProng0MCRec"), candidate1.ptProng0()); + registry.fill(HIST("hPtProng1MCRec"), candidate1.ptProng1()); + registry.fill(HIST("hPtProng2MCRec"), candidate1.ptProng2()); + registry.fill(HIST("hEtaMCRec"), candidate1.eta()); + registry.fill(HIST("hPhiMCRec"), candidate1.phi()); + registry.fill(HIST("hYMCRec"), YDPlus(candidate1)); + registry.fill(HIST("hSelectionStatusMCRec"), candidate1.isSelDplusToPiKPi()); - //D-Dbar correlation dedicated section - //For like-sign, first loop on both Dplus and Dminus. First candidate is for sure a Dplus/Dminus (looping on filtered) and was already matched, so don't re-check anything on it) - for (auto& candidate2 : candidates) { - //check decay channel flag for candidate2 - if (!(candidate2.hfflag() & 1 << DPlusToPiKPi)) { + //D-Dbar correlation dedicated section + //For like-sign, first loop on both Dplus and Dminus. First candidate is for sure a Dplus/Dminus (looping on filtered) and was already matched, so don't re-check anything on it) + for (auto& candidate2 : candidates) { + //check decay channel flag for candidate2 + if (!(candidate2.hfflag() & 1 << DecayType::DPlusToPiKPi)) { + continue; + } + int innerParticleSign = 1; //Dplus + auto innerSecondTrack = candidate2.index1_as(); + if (innerSecondTrack.sign() == 1) { + innerParticleSign = -1; //Dminus (second daughter track is positive) + } + if (!std::abs(candidate2.flagMCMatchRec()) == 1 << DecayType::DPlusToPiKPi) { //reject fake candidates + continue; + } + if (outerParticleSign == innerParticleSign) { //LS pair (of Dplus or Dminus) + pt2= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { continue; } - int innerParticleSign = 1; //Dplus - auto innerSecondTrack = candidate2.index1_as(); - if (innerSecondTrack.sign() == 1) { - innerParticleSign = -1; //Dminus (second daughter track is positive) + if (cutPtCandMin >= 0. && candidate2.pt() < cutPtCandMin) { + continue; } - if (!std::abs(candidate2.flagMCMatchRec()) == 1 << DPlusToPiKPi) { //reject fake candidates + //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) + if (candidate1.mRowIndex == candidate2.mRowIndex) { continue; } - if (outerParticleSign == innerParticleSign) { //LS pair (of Dplus or Dmnius) + pt2= 0. && std::abs(YDPlus(candidate2)) > cutYCandMax) { - continue; - } - if (cutPtCandMin >= 0. && std::abs(candidate2.pt()) < cutPtCandMin) { - continue; - } - //Excluding self-correlations (in principle not possible due to the '<' condition, but could rounding break it?) - if (candidate1.mRowIndex == candidate2.mRowIndex) { - continue; - } - entryDplusDminusPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), - candidate2.eta() - candidate1.eta(), - candidate1.pt(), - candidate2.pt()); - entryDplusDminusRecoInfo(InvMassDPlus(candidate1), - InvMassDPlus(candidate2), - 0); //for LS studies we set a dummy 0 for pairSignalStatus (there are no more the usual 4 possible combinations) - - } //end inner if (MC match) - - } // end inner loop - } //end outer if (MC match) + entryDplusDminusPair(getDeltaPhi(candidate2.phi(), candidate1.phi()), + candidate2.eta() - candidate1.eta(), + candidate1.pt(), + candidate2.pt()); + entryDplusDminusRecoInfo(InvMassDPlus(candidate1), + InvMassDPlus(candidate2), + 0); //for LS studies we set a dummy 0 for pairSignalStatus (there are no more the usual 4 possible combinations) + + } //end inner if (MC match) + } // end inner loop } //end outer loop } }; /// Dplus-Dminus correlation pair builder - for MC gen-level analysis, like sign particles /// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct DplusDminusCorrelatorMCGenLS { +struct HfCorrelatorDplusDminusMCGenLS { Produces entryDplusDminusPair; @@ -632,33 +616,34 @@ struct DplusDminusCorrelatorMCGenLS { //MC gen level for (auto& particle1 : particlesMC) { //check if the particle is Dplus or Dminus (both can be trigger) - NOTE: decay channel is not probed! - if (std::abs(particle1.pdgCode()) != 411) { + if (std::abs(particle1.pdgCode()) != pdg::Code::kDPlus) { continue; } - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + if (cutYCandMax >= 0. && std::abs(yD) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } registry.fill(HIST("hPtCandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); - registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + registry.fill(HIST("hYMCGen"), yD); counterDplusDminus++; //D-Dbar correlation dedicated section //if it's Dplus/Dminus, search for LS pair companions and evaluate correlations. registry.fill(HIST("hcountDplustriggersMCGen"), 0, particle1.pt()); //to count trigger Dplus (normalisation) for (auto& particle2 : particlesMC) { - if (std::abs(particle2.pdgCode()) != 411) { //check that associated is a Dplus/Dminus (both are fine) + if (std::abs(particle2.pdgCode()) != pdg::Code::kDPlus) { //check that associated is a Dplus/Dminus (both are fine) continue; } if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { continue; } if (particle2.pdgCode() == particle1.pdgCode()) { //like-sign condition (both 411 or both -411) and pT_Trig>pT_assoc @@ -678,7 +663,7 @@ struct DplusDminusCorrelatorMCGenLS { }; /// c-cbar correlator table builder - for MC gen-level analysis -struct CCbarCorrelatorMCGen { +struct HfCorrelatorCCbarMCGen { Produces entryccbarPair; @@ -689,7 +674,8 @@ struct CCbarCorrelatorMCGen { {"hEtaMCGen", "c,cbar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hYMCGen", "c,cbar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCGen", "c,cbar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, - {"hcountCCbarPerEvent", "c,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + {"hcountCCbarPerEvent", "c,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}, + {"hcountCCbarPerEventPreEtaCut", "c,cbar particles - MC gen;Number per event pre #eta cut;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; @@ -716,51 +702,53 @@ struct CCbarCorrelatorMCGen { continue; } counterccbarPreEtasel++; //count c or cbar (before kinematic selection) - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + if (cutYCandMax >= 0. && std::abs(yC) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } registry.fill(HIST("hPtcandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); - registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + registry.fill(HIST("hYMCGen"), yC); counterccbar++; //count if c or cbar don't come from themselves during fragmentation (after kinematic selection) //c-cbar correlation dedicated section //if it's c, search for cbar and evaluate correlations. - if (particle1.pdgCode() == 4) { - - registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) + if (particle1.pdgCode() != 4) { + continue; + } + registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) - for (auto& particle2 : particlesMC) { - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { - continue; - } - if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { - continue; - } - if (particle2.pdgCode() == -4) { - //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it - if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == -4) { - continue; - } - entryccbarPair(getDeltaPhi(particle2.phi(), particle1.phi()), - particle2.eta() - particle1.eta(), - particle1.pt(), - particle2.pt()); - } // end outer if (check cbar) - } // end inner loop - } //end outer if (check c) - } //end outer loop + for (auto& particle2 : particlesMC) { + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + continue; + } + if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { + continue; + } + if (particle2.pdgCode() != -4) { + continue; + } + //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it + if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == -4) { + continue; + } + entryccbarPair(getDeltaPhi(particle2.phi(), particle1.phi()), + particle2.eta() - particle1.eta(), + particle1.pt(), + particle2.pt()); + } // end inner loop + } //end outer loop registry.fill(HIST("hcountCCbarPerEvent"), counterccbar); + registry.fill(HIST("hcountCCbarPerEventPreEtaCut"), counterccbarPreEtasel); } }; /// c-cbar correlator table builder - for MC gen-level analysis - Like Sign -/// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct CCbarCorrelatorMCGenLS { +struct HfCorrelatorCCbarMCGenLS { Produces entryccbarPair; @@ -771,7 +759,8 @@ struct CCbarCorrelatorMCGenLS { {"hEtaMCGen", "c,cbar particles - MC gen;particle #it{#eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hYMCGen", "c,cbar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hPhiMCGen", "c,cbar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, - {"hcountCCbarPerEvent", "c,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; + {"hcountCCbarPerEvent", "c,cbar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}, + {"hcountCCbarPerEventPreEtaCut", "c,cbar particles - MC gen;Number per event pre #eta cut;entries", {HistType::kTH1F, {{20, 0., 20.}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; @@ -779,7 +768,7 @@ struct CCbarCorrelatorMCGenLS { void init(o2::framework::InitContext&) { - registry.add("hcountCtriggersMCGen", "c trigger particles - MC gen;;N of trigger D0", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hcountCtriggersMCGen", "c trigger particles - MC gen;;N of trigger c quark", {HistType::kTH2F, {{1, -0.5, 0.5}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } void process(aod::McCollision const& mccollision, soa::Join const& particlesMC) @@ -798,16 +787,17 @@ struct CCbarCorrelatorMCGenLS { continue; } counterccbarPreEtasel++; //count c or cbar (before kinematic selection) - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) > cutYCandMax) { + double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + if (cutYCandMax >= 0. && std::abs(yC) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle1.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } registry.fill(HIST("hPtcandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); - registry.fill(HIST("hYMCGen"), RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + registry.fill(HIST("hYMCGen"), yC); counterccbar++; //count if c or cbar don't come from themselves during fragmentation (after kinematic selection) //c-cbar correlation dedicated section @@ -820,7 +810,7 @@ struct CCbarCorrelatorMCGenLS { if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { continue; } - if (cutPtCandMin >= 0. && std::abs(particle2.pt()) < cutPtCandMin) { + if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { continue; } if (particle2.pdgCode() == particle1.pdgCode()) { @@ -840,6 +830,7 @@ struct CCbarCorrelatorMCGenLS { } // end inner loop } //end outer loop registry.fill(HIST("hcountCCbarPerEvent"), counterccbar); + registry.fill(HIST("hcountCCbarPerEventPreEtaCut"), counterccbarPreEtasel); } }; @@ -852,23 +843,23 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) const bool doLikeSign = cfgc.options().get("doLikeSign"); if (!doLikeSign) { //unlike-sign analyses if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-mc-gen"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus-mc-gen"})); } else if (doMCRec) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-mc-rec"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus-mc-rec"})); } else if (doMCccbar) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"ccbar-correlator-mc-gen"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-ccbar-mc-gen"})); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus"})); } - } else { + } else { //like-sign analyses if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-mc-gen-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus-mc-gen-ls"})); } else if (doMCRec) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-mc-rec-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus-mc-rec-ls"})); } else if (doMCccbar) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"ccbar-correlator-mc-gen-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-ccbar-mc-gen-ls"})); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"dplusdminus-correlator-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus-ls"})); } } diff --git a/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx b/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx similarity index 95% rename from Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx rename to Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx index f3782d39f06fd..8cf43c9b08a64 100644 --- a/Analysis/Tasks/PWGHF/taskDDbarCorrelation.cxx +++ b/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx @@ -8,24 +8,23 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file taskDDbarCorrelation.cxx +/// \file taskCorrelationDDbar.cxx /// \brief D-Dbar analysis task - data-like, MC-reco and MC-kine analyses. For ULS and LS pairs /// /// \author Fabio Colamaria , INFN Bari #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "AnalysisCore/HFSelectorCuts.h" #include "AnalysisDataModel/HFSecondaryVertex.h" #include "AnalysisDataModel/HFCandidateSelectionTables.h" using namespace o2; using namespace o2::framework; +using namespace o2::framework::expressions; using namespace o2::aod::hf_cand_prong2; +using namespace o2::aod::hf_correlation_ddbar; using namespace o2::analysis::hf_cuts_d0_topik; -using namespace o2::framework::expressions; using namespace o2::constants::math; -using namespace o2::aod::hf_ddbar_correlation; namespace o2::aod { @@ -50,14 +49,6 @@ double getDeltaPhi(double phiD, double phiDbar) return RecoDecay::constrainAngle(phiDbar - phiD, -o2::constants::math::PI / 2.); } -/// -/// Returns deltaPhi value in range [-pi, pi], for resolution distributions -/// -double getDeltaPhiForResolution(double phiD, double phiDbar) -{ - return RecoDecay::constrainAngle(phiDbar - phiD, -o2::constants::math::PI); -} - /// /// Returns phi of candidate/particle evaluated from x and y components of segment connecting primary and secondary vertices /// @@ -74,7 +65,7 @@ const double binMaxSparse[4] = {3. * o2::constants::math::PI / 2.,6.,10.,10.}; /// D-Dbar correlation pair filling task, from pair tables - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) /// Works on both USL and LS analyses pair tables -struct TaskDDbarCorrelation { +struct HfTaskCorrelationDDbar { HistogramRegistry registry{ "registry", @@ -127,20 +118,17 @@ struct TaskDDbarCorrelation { double massD = pairEntry.mD(); double massDbar = pairEntry.mDbar(); - //reject entries outside pT ranges of interest - double minPtAllowed = binsCorrelations->at(0); - double maxPtAllowed = binsCorrelations->at(binsCorrelations->size() - 1); - if (ptD < minPtAllowed || ptDbar < minPtAllowed || ptD > maxPtAllowed || ptDbar > maxPtAllowed) { - continue; - } - //fill 2D invariant mass plots registry.fill(HIST("hMass2DCorrelationPairs"), massD, massDbar, ptD, ptDbar); - //check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots + //reject entries outside pT ranges of interest int pTBinD = o2::analysis::findBin(binsCorrelations, ptD); int pTBinDbar = o2::analysis::findBin(binsCorrelations, ptDbar); + if (pTBinD == -1 || pTBinDbar == -1) { //at least one particle outside accepted pT range + continue; + } + //check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots if (massD > signalRegionInner->at(pTBinD) && massD < signalRegionOuter->at(pTBinD) && massDbar > signalRegionInner->at(pTBinDbar) && massDbar < signalRegionOuter->at(pTBinDbar)) { //in signal region registry.fill(HIST("hCorrel2DVsPtSignalRegion"), deltaPhi, deltaEta, ptD, ptDbar); @@ -169,7 +157,7 @@ struct TaskDDbarCorrelation { /// D-Dbar correlation pair filling task, from pair tables - for MC reco-level analysis (candidates matched to true signal only, but also bkg sources are studied) /// Works on both USL and LS analyses pair tables -struct TaskDDbarCorrelationMCRec { +struct HfTaskCorrelationDDbarMCRec { HistogramRegistry registry{ "registry", @@ -241,9 +229,9 @@ struct TaskDDbarCorrelationMCRec { double massDbar = pairEntry.mDbar(); //reject entries outside pT ranges of interest - double minPtAllowed = binsCorrelations->at(0); - double maxPtAllowed = binsCorrelations->at(binsCorrelations->size() - 1); - if (ptD < minPtAllowed || ptDbar < minPtAllowed || ptD > maxPtAllowed || ptDbar > maxPtAllowed) { + int pTBinD = o2::analysis::findBin(binsCorrelations, ptD); + int pTBinDbar = o2::analysis::findBin(binsCorrelations, ptDbar); + if (pTBinD == -1 || pTBinDbar == -1) { //at least one particle outside accepted pT range continue; } @@ -266,9 +254,6 @@ struct TaskDDbarCorrelationMCRec { } //check if correlation entry belongs to signal region, sidebands or is outside both, and fill correlation plots - int pTBinD = o2::analysis::findBin(binsCorrelations, ptD); - int pTBinDbar = o2::analysis::findBin(binsCorrelations, ptDbar); - if (massD > signalRegionInner->at(pTBinD) && massD < signalRegionOuter->at(pTBinD) && massDbar > signalRegionInner->at(pTBinDbar) && massDbar < signalRegionOuter->at(pTBinDbar)) { //in signal region registry.fill(HIST("hCorrel2DPtIntSignalRegionMCRec"), deltaPhi, deltaEta); @@ -327,7 +312,7 @@ struct TaskDDbarCorrelationMCRec { /// D-Dbar correlation pair filling task, from pair tables - for MC gen-level analysis (no filter/selection, only true signal) - Ok for both USL and LS analyses /// Works on both USL and LS analyses pair tables (and if tables are filled with quark pairs as well) -struct TaskDDbarCorrelationMCGen { +struct HfTaskCorrelationDDbarMCGen { HistogramRegistry registry{ "registry", @@ -362,9 +347,7 @@ struct TaskDDbarCorrelationMCGen { double ptDbar = pairEntry.ptDbar(); //reject entries outside pT ranges of interest - double minPtAllowed = binsCorrelations->at(0); - double maxPtAllowed = binsCorrelations->at(binsCorrelations->size() - 1); - if (ptD < minPtAllowed || ptDbar < minPtAllowed || ptD > maxPtAllowed || ptDbar > maxPtAllowed) { + if (o2::analysis::findBin(binsCorrelations, ptD) == -1 || o2::analysis::findBin(binsCorrelations, ptDbar) == -1) { continue; } @@ -385,11 +368,11 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) const bool doMCGen = cfgc.options().get("doMCGen"); const bool doMCRec = cfgc.options().get("doMCRec"); if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-ddbar-correlation-mc-gen"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-task-correlation-ddbar-mc-gen"})); } else if (doMCRec) { //MC-Rec analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-ddbar-correlation-mc-rec"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-task-correlation-ddbar-mc-rec"})); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"task-ddbar-correlation"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-task-correlation-ddbar"})); } return workflow; } From 0403394638b85e4e4ef8b8ec07bbe1d692665e99 Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Thu, 27 May 2021 16:38:42 +0200 Subject: [PATCH 06/14] Removed white spaces --- Analysis/Tasks/PWGHF/CMakeLists.txt | 6 +++--- Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Analysis/Tasks/PWGHF/CMakeLists.txt b/Analysis/Tasks/PWGHF/CMakeLists.txt index ad51e257e161c..5f782f71b211e 100644 --- a/Analysis/Tasks/PWGHF/CMakeLists.txt +++ b/Analysis/Tasks/PWGHF/CMakeLists.txt @@ -80,9 +80,9 @@ o2_add_dpl_workflow(hf-xic-topkpi-candidate-selector o2_add_dpl_workflow(hf-lc-tok0sp-candidate-selector SOURCES HFLcK0sPCandidateSelector.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils COMPONENT_NAME Analysis) - + o2_add_dpl_workflow(hf-task-d0 SOURCES taskD0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing @@ -125,7 +125,7 @@ o2_add_dpl_workflow(hf-mc-validation o2_add_dpl_workflow(hf-task-lc-tok0sp SOURCES taskLcK0sP.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils COMPONENT_NAME Analysis) o2_add_dpl_workflow(hf-correlator-d0d0bar diff --git a/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx b/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx index 8cf43c9b08a64..4bc83e3630a36 100644 --- a/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx +++ b/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx @@ -58,7 +58,7 @@ double evaluatePhiByVertex(double xVertex1, double xVertex2, double yVertex1, do } /* /// definition of axes for THnSparse (dPhi,dEta,pTD,pTDbar) - note: last two axis are dummy, will be replaced later -const int nBinsSparse[4] = {32,120,10,10}; +const int nBinsSparse[4] = {32,120,10,10}; const double binMinSparse[4] = {-o2::constants::math::PI / 2.,-6.,0.,0.; //is the minimum for all the bins const double binMaxSparse[4] = {3. * o2::constants::math::PI / 2.,6.,10.,10.}; //is the maximum for all the bins */ From 70bb755bac4742aa0260832418ef9bbf7c0b1247 Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Fri, 28 May 2021 09:31:52 +0200 Subject: [PATCH 07/14] Further updates after review follow-up --- Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx | 23 +++-- .../Tasks/PWGHF/HFCorrelatorDplusDminus.cxx | 20 ++--- Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx | 90 ++++++++++--------- 3 files changed, 70 insertions(+), 63 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx index c2a7571d84bbb..4728b638dc4eb 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx @@ -322,7 +322,7 @@ struct HfCorrelatorD0D0barMCGen { if (std::abs(particle1.pdgCode()) != pdg::Code::kD0) { continue; } - double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode())); if (cutYCandMax >= 0. && std::abs(yD) > cutYCandMax) { continue; } @@ -603,7 +603,7 @@ struct HfCorrelatorD0D0barMCGenLS { if (std::abs(particle1.pdgCode()) != pdg::Code::kD0) { continue; } - double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode())); if (cutYCandMax >= 0. && std::abs(yD) > cutYCandMax) { continue; } @@ -676,7 +676,7 @@ struct HfCorrelatorCCbarMCGen { //loop over particles at MC gen level for (auto& particle1 : particlesMC) { - if (std::abs(particle1.pdgCode()) != 4) { //search c or cbar particles + if (std::abs(particle1.pdgCode()) != PDG_t::kCharm) { //search c or cbar particles continue; } int partMothPDG = particlesMC.iteratorAt(particle1.mother0()).pdgCode(); @@ -685,9 +685,8 @@ struct HfCorrelatorCCbarMCGen { continue; } counterccbarPreEtasel++; //count c or cbar (before kinematic selection) - double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))) - if (cutYCandMax >= 0. && std::abs(yC) > cutYCandMax) - { + double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode())); + if (cutYCandMax >= 0. && std::abs(yC) > cutYCandMax) { continue; } if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { @@ -701,7 +700,7 @@ struct HfCorrelatorCCbarMCGen { //c-cbar correlation dedicated section //if it's c, search for cbar and evaluate correlations. - if (particle1.pdgCode() != 4) { + if (particle1.pdgCode() != PDG_t::kCharm) { continue; } registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) @@ -713,11 +712,11 @@ struct HfCorrelatorCCbarMCGen { if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { continue; } - if (particle2.pdgCode() != -4) { //check that inner particle is a cbar + if (particle2.pdgCode() != PDG_t::kCharmBar) { //check that inner particle is a cbar continue; } //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it - if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == -4) { + if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == PDG_t::kCharmBar) { continue; } entryccbarPair(getDeltaPhi(particle2.phi(), particle1.phi()), @@ -762,7 +761,7 @@ struct HfCorrelatorCCbarMCGenLS { //loop over particles at MC gen level for (auto& particle1 : particlesMC) { - if (std::abs(particle1.pdgCode()) != 4) { //search c or cbar particles + if (std::abs(particle1.pdgCode()) != PDG_t::kCharm) { //search c or cbar particles continue; } int partMothPDG = particlesMC.iteratorAt(particle1.mother0()).pdgCode(); @@ -771,7 +770,7 @@ struct HfCorrelatorCCbarMCGenLS { continue; } counterccbarPreEtasel++; //count c or cbar (before kinematic selection) - double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode())); if (cutYCandMax >= 0. && std::abs(yC) > cutYCandMax) { continue; } @@ -788,7 +787,7 @@ struct HfCorrelatorCCbarMCGenLS { registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) for (auto& particle2 : particlesMC) { - if (std::abs(particle2.pdgCode()) != 4) { //search c or cbar for associated particles + if (std::abs(particle2.pdgCode()) != PDG_t::kCharm) { //search c or cbar for associated particles continue; } if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx index f75ae31b7c02a..4ba17099dbcc5 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx @@ -321,7 +321,7 @@ struct HfCorrelatorDplusDminusMCGen { if (std::abs(particle1.pdgCode()) != pdg::Code::kDPlus) { continue; } - double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode())); if (cutYCandMax >= 0. && std::abs(yD) > cutYCandMax) { continue; } @@ -619,7 +619,7 @@ struct HfCorrelatorDplusDminusMCGenLS { if (std::abs(particle1.pdgCode()) != pdg::Code::kDPlus) { continue; } - double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + double yD = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode())); if (cutYCandMax >= 0. && std::abs(yD) > cutYCandMax) { continue; } @@ -693,7 +693,7 @@ struct HfCorrelatorCCbarMCGen { //loop over particles at MC gen level for (auto& particle1 : particlesMC) { - if (std::abs(particle1.pdgCode()) != 4) { //search c or cbar particles + if (std::abs(particle1.pdgCode()) != PDG_t::kCharm) { //search c or cbar particles continue; } int partMothPDG = particlesMC.iteratorAt(particle1.mother0()).pdgCode(); @@ -702,7 +702,7 @@ struct HfCorrelatorCCbarMCGen { continue; } counterccbarPreEtasel++; //count c or cbar (before kinematic selection) - double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode())); if (cutYCandMax >= 0. && std::abs(yC) > cutYCandMax) { continue; } @@ -717,7 +717,7 @@ struct HfCorrelatorCCbarMCGen { //c-cbar correlation dedicated section //if it's c, search for cbar and evaluate correlations. - if (particle1.pdgCode() != 4) { + if (particle1.pdgCode() != PDG_t::kCharm) { continue; } registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) @@ -729,11 +729,11 @@ struct HfCorrelatorCCbarMCGen { if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { continue; } - if (particle2.pdgCode() != -4) { + if (particle2.pdgCode() != PDG_t::kCharmBar) { continue; } //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it - if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == -4) { + if (particlesMC.iteratorAt(particle2.mother0()).pdgCode() == PDG_t::kCharmBar) { continue; } entryccbarPair(getDeltaPhi(particle2.phi(), particle1.phi()), @@ -778,7 +778,7 @@ struct HfCorrelatorCCbarMCGenLS { //loop over particles at MC gen level for (auto& particle1 : particlesMC) { - if (std::abs(particle1.pdgCode()) != 4) { //search c or cbar particles + if (std::abs(particle1.pdgCode()) != PDG_t::kCharm) { //search c or cbar particles continue; } int partMothPDG = particlesMC.iteratorAt(particle1.mother0()).pdgCode(); @@ -787,7 +787,7 @@ struct HfCorrelatorCCbarMCGenLS { continue; } counterccbarPreEtasel++; //count c or cbar (before kinematic selection) - double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode()))); + double yC = RecoDecay::Y(array{particle1.px(), particle1.py(), particle1.pz()}, RecoDecay::getMassPDG(particle1.pdgCode())); if (cutYCandMax >= 0. && std::abs(yC) > cutYCandMax) { continue; } @@ -804,7 +804,7 @@ struct HfCorrelatorCCbarMCGenLS { registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) for (auto& particle2 : particlesMC) { - if (std::abs(particle2.pdgCode()) != 4) { //search c or cbar for associated particles + if (std::abs(particle2.pdgCode()) != PDG_t::kCharm) { //search c or cbar for associated particles continue; } if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { diff --git a/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx b/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx index 4bc83e3630a36..cac8276dfc5f6 100644 --- a/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx +++ b/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx @@ -63,6 +63,14 @@ const double binMinSparse[4] = {-o2::constants::math::PI / 2.,-6.,0.,0.; //is t const double binMaxSparse[4] = {3. * o2::constants::math::PI / 2.,6.,10.,10.}; //is the maximum for all the bins */ +// string definitions, used for histogram axis labels +const TString stringPtD = "#it{p}_{T}^{D} (GeV/#it{c})"; +const TString stringPtDbar = "#it{p}_{T}^{Dbar} (GeV/#it{c})"; +const TString stringDeltaPt = "#it{p}_{T}^{Dbar}-#it{p}_{T}^{D} (GeV/#it{c})"; +const TString stringDeltaPtMaxMin = "#it{p}_{T}^{max}-#it{p}_{T}^{min} (GeV/#it{c})"; +const TString stringDeltaEta = "#it{#eta}^{Dbar}-#it{#eta}^{D}"; +const TString stringDeltaPhi = "#it{#varphi}^{Dbar}-#it{#varphi}^{D} (rad)"; + /// D-Dbar correlation pair filling task, from pair tables - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) /// Works on both USL and LS analyses pair tables struct HfTaskCorrelationDDbar { @@ -70,19 +78,19 @@ struct HfTaskCorrelationDDbar { HistogramRegistry registry{ "registry", //NOTE: use hMassD0 (from correlator task) for normalisation, and hMass2DCorrelationPairs for 2D-sideband-subtraction purposes - {{"hMass2DCorrelationPairs", "D,Dbar candidates 2D;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaEtaPtIntSignalRegion", "D,Dbar candidates signal region;#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH1F, {{200, -10., 10.}}}}, - {"hDeltaPhiPtIntSignalRegion", "D,Dbar candidates signal region;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hCorrel2DPtIntSignalRegion", "D,Dbar candidates signal region;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, - {"hCorrel2DVsPtSignalRegion", "D,Dbar candidates signal region;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaPtDDbarSignalRegion", "D,Dbar candidates signal region;#it{p}_{T}^{Dbar}-#it{p}_{T}^{D};entries", {HistType::kTH1F, {{144, -36., 36.}}}}, - {"hDeltaPtMaxMinSignalRegion", "D,Dbar candidates signal region;#it{p}_{T}^{max}-#it{p}_{T}^{min};entries", {HistType::kTH1F, {{72, 0., 36.}}}}, - {"hDeltaEtaPtIntSidebands", "D,Dbar candidates sidebands;#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH1F, {{200, -10., 10.}}}}, - {"hDeltaPhiPtIntSidebands", "D,Dbar candidates sidebands;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hCorrel2DPtIntSidebands", "D,Dbar candidates sidebands;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, - {"hCorrel2DVsPtSidebands", "D,Dbar candidates sidebands;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaPtDDbarSidebands", "D,Dbar candidates sidebands;#it{p}_{T}^{Dbar}-#it{p}_{T}^{D};entries", {HistType::kTH1F, {{144, -36., 36.}}}}, - {"hDeltaPtMaxMinSidebands", "D,Dbar candidates sidebands;#it{p}_{T}^{max}-#it{p}_{T}^{min};entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; + {{"hMass2DCorrelationPairs", "D,Dbar candidates 2D;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaEtaPtIntSignalRegion", "D,Dbar candidates signal region;" + stringDeltaEta + ";entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSignalRegion", "D,Dbar candidates signal region;" + stringDeltaPhi + ";entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSignalRegion", "D,Dbar candidates signal region;" + stringDeltaPhi + ";" + stringDeltaEta + ";entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtSignalRegion", "D,Dbar candidates signal region;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarSignalRegion", "D,Dbar candidates signal region;" + stringDeltaPt + ";entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSignalRegion", "D,Dbar candidates signal region;" + stringDeltaPtMaxMin + ";entries", {HistType::kTH1F, {{72, 0., 36.}}}}, + {"hDeltaEtaPtIntSidebands", "D,Dbar candidates sidebands;" + stringDeltaEta + ";entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSidebands", "D,Dbar candidates sidebands;" + stringDeltaPhi + ";entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSidebands", "D,Dbar candidates sidebands;" + stringDeltaPhi + ";" + stringDeltaEta + ";entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtSidebands", "D,Dbar candidates sidebands;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarSidebands", "D,Dbar candidates sidebands;" + stringDeltaPt + ";entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSidebands", "D,Dbar candidates sidebands;" + stringDeltaPtMaxMin + ";entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; //pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_topik (i.e. the mass pT bins), but can be redefined via json files Configurable> binsCorrelations{"ptBinsForCorrelations", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for correlation plots"}; @@ -162,28 +170,28 @@ struct HfTaskCorrelationDDbarMCRec { HistogramRegistry registry{ "registry", //NOTE: use hMassD0 (from correlator task) for normalisation, and hMass2DCorrelationPairs for 2D-sideband-subtraction purposes - {{"hMass2DCorrelationPairsMCRecSigSig", "D,Dbar candidates 2D SigSig - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hMass2DCorrelationPairsMCRecSigBkg", "D,Dbar candidates 2D SigBkg - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hMass2DCorrelationPairsMCRecBkgSig", "D,Dbar candidates 2D BkgSig - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hMass2DCorrelationPairsMCRecBkgBkg", "D,Dbar candidates 2D BkgBkg - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaEtaPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH1F, {{200, -10., 10.}}}}, - {"hDeltaPhiPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hCorrel2DPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, - {"hDeltaPtDDbarSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;#it{p}_{T}^{Dbar}-#it{p}_{T}^{D};entries", {HistType::kTH1F, {{144, -36., 36.}}}}, - {"hDeltaPtMaxMinSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;#it{p}_{T}^{max}-#it{p}_{T}^{min};entries", {HistType::kTH1F, {{72, 0., 36.}}}}, - {"hCorrel2DVsPtSignalRegionMCRecSigSig", "D,Dbar candidates signal region SigSig - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hCorrel2DVsPtSignalRegionMCRecSigBkg", "D,Dbar candidates signal region SigBkg - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hCorrel2DVsPtSignalRegionMCRecBkgSig", "D,Dbar candidates signal region BkgSig - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hCorrel2DVsPtSignalRegionMCRecBkgBkg", "D,Dbar candidates signal region BkgBkg - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaEtaPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH1F, {{200, -10., 10.}}}}, - {"hDeltaPhiPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hCorrel2DPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, - {"hCorrel2DVsPtSidebandsMCRecSigSig", "D,Dbar candidates sidebands SigSig - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - should be empty, kept for cross-check and debug - {"hCorrel2DVsPtSidebandsMCRecSigBkg", "D,Dbar candidates sidebands SigBkg - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hCorrel2DVsPtSidebandsMCRecBkgSig", "D,Dbar candidates sidebands BkgSig - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hCorrel2DVsPtSidebandsMCRecBkgBkg", "D,Dbar candidates sidebands BkgBkg - MC reco;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaPtDDbarSidebandsMCRec", "D,Dbar candidates signal region - MC reco;#it{p}_{T}^{Dbar}-#it{p}_{T}^{D};entries", {HistType::kTH1F, {{144, -36., 36.}}}}, - {"hDeltaPtMaxMinSidebandsMCRec", "D,Dbar candidates signal region - MC reco;#it{p}_{T}^{max}-#it{p}_{T}^{min};entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; + {{"hMass2DCorrelationPairsMCRecSigSig", "D,Dbar candidates 2D SigSig - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hMass2DCorrelationPairsMCRecSigBkg", "D,Dbar candidates 2D SigBkg - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hMass2DCorrelationPairsMCRecBkgSig", "D,Dbar candidates 2D BkgSig - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hMass2DCorrelationPairsMCRecBkgBkg", "D,Dbar candidates 2D BkgBkg - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaEtaPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaEta + ";entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPhi + ";entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hDeltaPtDDbarSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPt + ";entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPtMaxMin + ";entries", {HistType::kTH1F, {{72, 0., 36.}}}}, + {"hCorrel2DVsPtSignalRegionMCRecSigSig", "D,Dbar candidates signal region SigSig - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSignalRegionMCRecSigBkg", "D,Dbar candidates signal region SigBkg - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSignalRegionMCRecBkgSig", "D,Dbar candidates signal region BkgSig - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSignalRegionMCRecBkgBkg", "D,Dbar candidates signal region BkgBkg - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaEtaPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;" + stringDeltaEta + ";entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;" + stringDeltaPhi + ";entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtSidebandsMCRecSigSig", "D,Dbar candidates sidebands SigSig - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - should be empty, kept for cross-check and debug + {"hCorrel2DVsPtSidebandsMCRecSigBkg", "D,Dbar candidates sidebands SigBkg - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSidebandsMCRecBkgSig", "D,Dbar candidates sidebands BkgSig - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSidebandsMCRecBkgBkg", "D,Dbar candidates sidebands BkgBkg - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarSidebandsMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPt + ";entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSidebandsMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPtMaxMin + ";entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; //pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_topik (i.e. the mass pT bins), but can be redefined via json files Configurable> binsCorrelations{"ptBinsForCorrelations", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for correlation plots"}; @@ -316,12 +324,12 @@ struct HfTaskCorrelationDDbarMCGen { HistogramRegistry registry{ "registry", - {{"hDeltaEtaPtIntMCGen", "D,Dbar particles - MC gen;#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH1F, {{200, -10., 10.}}}}, - {"hDeltaPhiPtIntMCGen", "D,Dbar particles - MC gen;#it{#varphi}^{Dbar}-#it{#varphi}^{D};entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hCorrel2DPtIntMCGen", "D,Dbar particles - MC gen;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, - {"hCorrel2DVsPtMCGen", "D,Dbar particles - MC gen;#it{#varphi}^{Dbar}-#it{#varphi}^{D};#it{#eta}^{Dbar}-#it{#eta}^{D};#it{p}_{T}^{D};#it{p}_{T}^{Dbar};entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaPtDDbarMCGen", "D,Dbar particles - MC gen;#it{p}_{T}^{Dbar}-#it{p}_{T}^{D};entries", {HistType::kTH1F, {{144, -36., 36.}}}}, - {"hDeltaPtMaxMinMCGen", "D,Dbar particles - MC gen;#it{p}_{T}^{max}-#it{p}_{T}^{min};entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; + {{"hDeltaEtaPtIntMCGen", "D,Dbar particles - MC gen;" + stringDeltaEta + ";entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntMCGen", "D,Dbar particles - MC gen;" + stringDeltaPhi + ";entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntMCGen", "D,Dbar particles - MC gen;" + stringDeltaPhi + ";" + stringDeltaEta + ";entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtMCGen", "D,Dbar particles - MC gen;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarMCGen", "D,Dbar particles - MC gen;" + stringDeltaPt + ";entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinMCGen", "D,Dbar particles - MC gen;" + stringDeltaPtMaxMin + ";entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; //pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_topik (i.e. the mass pT bins), but can be redefined via json files Configurable> binsCorrelations{"ptBinsForCorrelations", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for correlation plots"}; From 5042609d852d73f7bc3d9342cc8c86495567d499 Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Mon, 31 May 2021 09:22:37 +0200 Subject: [PATCH 08/14] Update to histogram labels (using strings) --- Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx | 99 ++++++++++--------- 1 file changed, 52 insertions(+), 47 deletions(-) diff --git a/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx b/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx index cac8276dfc5f6..06b8d81a84959 100644 --- a/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx +++ b/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx @@ -64,12 +64,17 @@ const double binMaxSparse[4] = {3. * o2::constants::math::PI / 2.,6.,10.,10.}; */ // string definitions, used for histogram axis labels -const TString stringPtD = "#it{p}_{T}^{D} (GeV/#it{c})"; -const TString stringPtDbar = "#it{p}_{T}^{Dbar} (GeV/#it{c})"; -const TString stringDeltaPt = "#it{p}_{T}^{Dbar}-#it{p}_{T}^{D} (GeV/#it{c})"; -const TString stringDeltaPtMaxMin = "#it{p}_{T}^{max}-#it{p}_{T}^{min} (GeV/#it{c})"; -const TString stringDeltaEta = "#it{#eta}^{Dbar}-#it{#eta}^{D}"; -const TString stringDeltaPhi = "#it{#varphi}^{Dbar}-#it{#varphi}^{D} (rad)"; +const TString stringPtD = "#it{p}_{T}^{D} (GeV/#it{c});"; +const TString stringPtDbar = "#it{p}_{T}^{Dbar} (GeV/#it{c});"; +const TString stringDeltaPt = "#it{p}_{T}^{Dbar}-#it{p}_{T}^{D} (GeV/#it{c});"; +const TString stringDeltaPtMaxMin = "#it{p}_{T}^{max}-#it{p}_{T}^{min} (GeV/#it{c});"; +const TString stringDeltaEta = "#it{#eta}^{Dbar}-#it{#eta}^{D};"; +const TString stringDeltaPhi = "#it{#varphi}^{Dbar}-#it{#varphi}^{D} (rad);"; +const TString stringDDbar = "D,Dbar candidates "; +const TString stringSignal = "signal region;"; +const TString stringSideband = "sidebands;"; +const TString stringMCParticles = "MC gen - D,Dbar particles;"; +const TString stringMCReco = "MC reco - D,Dbar candidates "; /// D-Dbar correlation pair filling task, from pair tables - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) /// Works on both USL and LS analyses pair tables @@ -78,19 +83,19 @@ struct HfTaskCorrelationDDbar { HistogramRegistry registry{ "registry", //NOTE: use hMassD0 (from correlator task) for normalisation, and hMass2DCorrelationPairs for 2D-sideband-subtraction purposes - {{"hMass2DCorrelationPairs", "D,Dbar candidates 2D;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaEtaPtIntSignalRegion", "D,Dbar candidates signal region;" + stringDeltaEta + ";entries", {HistType::kTH1F, {{200, -10., 10.}}}}, - {"hDeltaPhiPtIntSignalRegion", "D,Dbar candidates signal region;" + stringDeltaPhi + ";entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hCorrel2DPtIntSignalRegion", "D,Dbar candidates signal region;" + stringDeltaPhi + ";" + stringDeltaEta + ";entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, - {"hCorrel2DVsPtSignalRegion", "D,Dbar candidates signal region;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaPtDDbarSignalRegion", "D,Dbar candidates signal region;" + stringDeltaPt + ";entries", {HistType::kTH1F, {{144, -36., 36.}}}}, - {"hDeltaPtMaxMinSignalRegion", "D,Dbar candidates signal region;" + stringDeltaPtMaxMin + ";entries", {HistType::kTH1F, {{72, 0., 36.}}}}, - {"hDeltaEtaPtIntSidebands", "D,Dbar candidates sidebands;" + stringDeltaEta + ";entries", {HistType::kTH1F, {{200, -10., 10.}}}}, - {"hDeltaPhiPtIntSidebands", "D,Dbar candidates sidebands;" + stringDeltaPhi + ";entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hCorrel2DPtIntSidebands", "D,Dbar candidates sidebands;" + stringDeltaPhi + ";" + stringDeltaEta + ";entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, - {"hCorrel2DVsPtSidebands", "D,Dbar candidates sidebands;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaPtDDbarSidebands", "D,Dbar candidates sidebands;" + stringDeltaPt + ";entries", {HistType::kTH1F, {{144, -36., 36.}}}}, - {"hDeltaPtMaxMinSidebands", "D,Dbar candidates sidebands;" + stringDeltaPtMaxMin + ";entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; + {{"hMass2DCorrelationPairs", stringDDbar + "2D;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaEtaPtIntSignalRegion", stringDDbar + stringSignal + stringDeltaEta + "entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSignalRegion", stringDDbar + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSignalRegion", stringDDbar + stringSignal + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtSignalRegion", stringDDbar + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarSignalRegion", stringDDbar + stringSignal + stringDeltaPt + "entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSignalRegion", stringDDbar + stringSignal + stringDeltaPtMaxMin + "entries", {HistType::kTH1F, {{72, 0., 36.}}}}, + {"hDeltaEtaPtIntSidebands", stringDDbar + stringSideband + stringDeltaEta + "entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSidebands", stringDDbar + stringSideband + stringDeltaPhi + "entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSidebands", stringDDbar + stringSideband + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtSidebands", stringDDbar + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarSidebands", stringDDbar + stringSideband + stringDeltaPt + "entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSidebands", stringDDbar + stringSideband + stringDeltaPtMaxMin + "entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; //pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_topik (i.e. the mass pT bins), but can be redefined via json files Configurable> binsCorrelations{"ptBinsForCorrelations", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for correlation plots"}; @@ -170,28 +175,28 @@ struct HfTaskCorrelationDDbarMCRec { HistogramRegistry registry{ "registry", //NOTE: use hMassD0 (from correlator task) for normalisation, and hMass2DCorrelationPairs for 2D-sideband-subtraction purposes - {{"hMass2DCorrelationPairsMCRecSigSig", "D,Dbar candidates 2D SigSig - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hMass2DCorrelationPairsMCRecSigBkg", "D,Dbar candidates 2D SigBkg - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hMass2DCorrelationPairsMCRecBkgSig", "D,Dbar candidates 2D BkgSig - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hMass2DCorrelationPairsMCRecBkgBkg", "D,Dbar candidates 2D BkgBkg - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaEtaPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaEta + ";entries", {HistType::kTH1F, {{200, -10., 10.}}}}, - {"hDeltaPhiPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPhi + ";entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hCorrel2DPtIntSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, - {"hDeltaPtDDbarSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPt + ";entries", {HistType::kTH1F, {{144, -36., 36.}}}}, - {"hDeltaPtMaxMinSignalRegionMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPtMaxMin + ";entries", {HistType::kTH1F, {{72, 0., 36.}}}}, - {"hCorrel2DVsPtSignalRegionMCRecSigSig", "D,Dbar candidates signal region SigSig - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hCorrel2DVsPtSignalRegionMCRecSigBkg", "D,Dbar candidates signal region SigBkg - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hCorrel2DVsPtSignalRegionMCRecBkgSig", "D,Dbar candidates signal region BkgSig - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hCorrel2DVsPtSignalRegionMCRecBkgBkg", "D,Dbar candidates signal region BkgBkg - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaEtaPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;" + stringDeltaEta + ";entries", {HistType::kTH1F, {{200, -10., 10.}}}}, - {"hDeltaPhiPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;" + stringDeltaPhi + ";entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hCorrel2DPtIntSidebandsMCRec", "D,Dbar candidates sidebands - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, - {"hCorrel2DVsPtSidebandsMCRecSigSig", "D,Dbar candidates sidebands SigSig - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - should be empty, kept for cross-check and debug - {"hCorrel2DVsPtSidebandsMCRecSigBkg", "D,Dbar candidates sidebands SigBkg - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hCorrel2DVsPtSidebandsMCRecBkgSig", "D,Dbar candidates sidebands BkgSig - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hCorrel2DVsPtSidebandsMCRecBkgBkg", "D,Dbar candidates sidebands BkgBkg - MC reco;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaPtDDbarSidebandsMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPt + ";entries", {HistType::kTH1F, {{144, -36., 36.}}}}, - {"hDeltaPtMaxMinSidebandsMCRec", "D,Dbar candidates signal region - MC reco;" + stringDeltaPtMaxMin + ";entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; + {{"hMass2DCorrelationPairsMCRecSigSig", stringDDbar + "2D SigSig - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hMass2DCorrelationPairsMCRecSigBkg", stringDDbar + "2D SigBkg - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hMass2DCorrelationPairsMCRecBkgSig", stringDDbar + "2D BkgSig - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hMass2DCorrelationPairsMCRecBkgBkg", stringDDbar + "2D BkgBkg - MC reco;inv. mass D (GeV/#it{c}^{2});inv. mass Dbar (GeV/#it{c}^{2});" + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{200, 1.6, 2.1}, {200, 1.6, 2.1}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaEtaPtIntSignalRegionMCRec", stringMCReco + stringSignal + stringDeltaEta + "entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSignalRegionMCRec", stringMCReco + stringSignal + stringDeltaPhi + "entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSignalRegionMCRec", stringMCReco + stringSignal + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hDeltaPtDDbarSignalRegionMCRec", stringMCReco + stringSignal + stringDeltaPt + "entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSignalRegionMCRec", stringMCReco + stringSignal + stringDeltaPtMaxMin + "entries", {HistType::kTH1F, {{72, 0., 36.}}}}, + {"hCorrel2DVsPtSignalRegionMCRecSigSig", stringMCReco + "SigSig" + stringSignal + stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSignalRegionMCRecSigBkg", stringMCReco + "SigBkg" + stringSignal + +stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSignalRegionMCRecBkgSig", stringMCReco + "BkgSig" + stringSignal + +stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSignalRegionMCRecBkgBkg", stringMCReco + "BkgBkg" + stringSignal + +stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaEtaPtIntSidebandsMCRec", stringMCReco + stringSideband + stringDeltaEta + "entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntSidebandsMCRec", stringMCReco + stringSideband + stringDeltaPhi + "entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntSidebandsMCRec", stringMCReco + stringSideband + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hDeltaPtDDbarSidebandsMCRec", stringMCReco + stringSideband + stringDeltaPt + "entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinSidebandsMCRec", stringMCReco + stringSideband + stringDeltaPtMaxMin + "entries", {HistType::kTH1F, {{72, 0., 36.}}}}, + {"hCorrel2DVsPtSidebandsMCRecSigSig", stringMCReco + "SigSig" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - should be empty, kept for cross-check and debug + {"hCorrel2DVsPtSidebandsMCRecSigBkg", stringMCReco + "SigBkg" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSidebandsMCRecBkgSig", stringMCReco + "BkgSig" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hCorrel2DVsPtSidebandsMCRecBkgBkg", stringMCReco + "BkgBkg" + stringSideband + stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}}}; //note: axes 3 and 4 (the pT) are updated in the init() //pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_topik (i.e. the mass pT bins), but can be redefined via json files Configurable> binsCorrelations{"ptBinsForCorrelations", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for correlation plots"}; @@ -324,12 +329,12 @@ struct HfTaskCorrelationDDbarMCGen { HistogramRegistry registry{ "registry", - {{"hDeltaEtaPtIntMCGen", "D,Dbar particles - MC gen;" + stringDeltaEta + ";entries", {HistType::kTH1F, {{200, -10., 10.}}}}, - {"hDeltaPhiPtIntMCGen", "D,Dbar particles - MC gen;" + stringDeltaPhi + ";entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, - {"hCorrel2DPtIntMCGen", "D,Dbar particles - MC gen;" + stringDeltaPhi + ";" + stringDeltaEta + ";entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, - {"hCorrel2DVsPtMCGen", "D,Dbar particles - MC gen;" + stringDeltaPhi + ";" + stringDeltaEta + ";" + stringPtD + ";" + stringPtDbar + ";entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() - {"hDeltaPtDDbarMCGen", "D,Dbar particles - MC gen;" + stringDeltaPt + ";entries", {HistType::kTH1F, {{144, -36., 36.}}}}, - {"hDeltaPtMaxMinMCGen", "D,Dbar particles - MC gen;" + stringDeltaPtMaxMin + ";entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; + {{"hDeltaEtaPtIntMCGen", stringMCParticles + stringDeltaEta + "entries", {HistType::kTH1F, {{200, -10., 10.}}}}, + {"hDeltaPhiPtIntMCGen", stringMCParticles + stringDeltaPhi + "entries", {HistType::kTH1F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}}}}, + {"hCorrel2DPtIntMCGen", stringMCParticles + stringDeltaPhi + stringDeltaEta + "entries", {HistType::kTH2F, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {200, -10., 10.}}}}, + {"hCorrel2DVsPtMCGen", stringMCParticles + stringDeltaPhi + stringDeltaEta + stringPtD + stringPtDbar + "entries", {HistType::kTHnSparseD, {{32, -o2::constants::math::PI / 2., 3. * o2::constants::math::PI / 2.}, {120, -6., 6.}, {10, 0., 10.}, {10, 0., 10.}}}}, //note: axes 3 and 4 (the pT) are updated in the init() + {"hDeltaPtDDbarMCGen", stringMCParticles + stringDeltaPt + "entries", {HistType::kTH1F, {{144, -36., 36.}}}}, + {"hDeltaPtMaxMinMCGen", stringMCParticles + stringDeltaPtMaxMin + "entries", {HistType::kTH1F, {{72, 0., 36.}}}}}}; //pT ranges for correlation plots: the default values are those embedded in hf_cuts_d0_topik (i.e. the mass pT bins), but can be redefined via json files Configurable> binsCorrelations{"ptBinsForCorrelations", std::vector{o2::analysis::hf_cuts_d0_topik::pTBins_v}, "pT bin limits for correlation plots"}; From 29d44982ae267ec6171a733d75bd5cc03c50bbeb Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Wed, 2 Jun 2021 10:00:16 +0200 Subject: [PATCH 09/14] Small improvements after running and checking outputs --- Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx | 35 ++++++++++++++---- .../Tasks/PWGHF/HFCorrelatorDplusDminus.cxx | 37 +++++++++++++++---- 2 files changed, 56 insertions(+), 16 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx index 4728b638dc4eb..b2af20e971135 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx @@ -301,7 +301,8 @@ struct HfCorrelatorD0D0barMCGen { {"hPhiMCGen", "D0,D0bar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hYMCGen", "D0,D0bar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hcountD0D0barPerEvent", "D0,D0bar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}, - {"hDDbarVsEtaCut", "D0,D0bar pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; + {"hDDbarVsEtaCut", "D0,D0bar pairs vs #eta cut of D mesons;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}, + {"hDDbarVsDaughterEtaCut", "D0,D0bar pairs vs #eta cut on D daughters;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; @@ -357,12 +358,30 @@ struct HfCorrelatorD0D0barMCGen { particle2.pt()); double etaCut = 0.; double ptCut = 0.; - do { //fill pairs vs etaCut plot + + //fill pairs vs etaCut plot + bool rightDecayChannels = kFALSE; + if((std::abs(particle1.flagMCMatchGen()) == 1 << DecayType::D0ToPiK) && (std::abs(particle2.flagMCMatchGen()) == 1 << DecayType::D0ToPiK)) { + rightDecayChannels = kTRUE; + } + do { ptCut = 0.; etaCut += incrementEtaCut; do { //fill pairs vs etaCut plot - if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) + if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) { //fill with D and Dbar acceptance checks registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + } + if (rightDecayChannels) { //fill with D and Dbar daughter particls acceptance checks + double etaCandidate1Daughter1 = particlesMC.iteratorAt(particle1.daughter0()).eta(); + double etaCandidate1Daughter2 = particlesMC.iteratorAt(particle1.daughter1()).eta(); + double etaCandidate2Daughter1 = particlesMC.iteratorAt(particle2.daughter0()).eta(); + double etaCandidate2Daughter2 = particlesMC.iteratorAt(particle2.daughter1()).eta(); + if (std::abs(etaCandidate1Daughter1) < etaCut && std::abs(etaCandidate1Daughter2) < etaCut && + std::abs(etaCandidate2Daughter1) < etaCut && std::abs(etaCandidate2Daughter2) < etaCut && + particle1.pt() > ptCut && particle2.pt() > ptCut) { + registry.fill(HIST("hDDbarVsDaughterEtaCut"), etaCut - epsilon, ptCut + epsilon); + } + } ptCut += incrementPtThreshold; } while (ptCut < ptThresholdForMaxEtaCut - epsilon); } while (etaCut < maxEtaCut - epsilon); @@ -692,7 +711,7 @@ struct HfCorrelatorCCbarMCGen { if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } - registry.fill(HIST("hPtcandMCGen"), particle1.pt()); + registry.fill(HIST("hPtCandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); registry.fill(HIST("hYMCGen"), yC); @@ -706,13 +725,13 @@ struct HfCorrelatorCCbarMCGen { registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) for (auto& particle2 : particlesMC) { - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + if (particle2.pdgCode() != PDG_t::kCharmBar) { //check that inner particle is a cbar continue; } - if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { continue; } - if (particle2.pdgCode() != PDG_t::kCharmBar) { //check that inner particle is a cbar + if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { continue; } //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it @@ -777,7 +796,7 @@ struct HfCorrelatorCCbarMCGenLS { if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } - registry.fill(HIST("hPtcandMCGen"), particle1.pt()); + registry.fill(HIST("hPtCandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); registry.fill(HIST("hYMCGen"), yC); diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx index 4ba17099dbcc5..38d712b855d75 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx @@ -300,7 +300,8 @@ struct HfCorrelatorDplusDminusMCGen { {"hPhiMCGen", "Dplus,Dminus particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hYMCGen", "Dplus,Dminus candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hcountDplusDminusPerEvent", "Dplus,Dminus particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}, - {"hDDbarVsEtaCut", "Dplus,Dminus pairs vs #eta cut;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; + {"hDDbarVsEtaCut", "Dplus,Dminus pairs vs #eta cut of D mesons;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}, + {"hDDbarVsDaughterEtaCut", "Dplus,Dminus pairs vs #eta cut on D daughters;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable cutPtCandMin{"cutPtCandMin", -1., "min. cand. pT"}; @@ -356,12 +357,32 @@ struct HfCorrelatorDplusDminusMCGen { particle2.pt()); double etaCut = 0.; double ptCut = 0.; - do { //fill pairs vs etaCut plot + + //fill pairs vs etaCut plot + bool rightDecayChannels = kFALSE; + if((std::abs(particle1.flagMCMatchGen()) == 1 << DecayType::DPlusToPiKPi) && (std::abs(particle2.flagMCMatchGen()) == 1 << DecayType::DPlusToPiKPi)) { + rightDecayChannels = kTRUE; + } + do { ptCut = 0.; etaCut += incrementEtaCut; do { //fill pairs vs etaCut plot - if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) + if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) { registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + } + if (rightDecayChannels) { //fill with D and Dbar daughter particls acceptance checks + double etaCandidate1Daughter1 = particlesMC.iteratorAt(particle1.daughter0()).eta(); + double etaCandidate1Daughter2 = particlesMC.iteratorAt(particle1.daughter0()+1).eta(); + double etaCandidate1Daughter3 = particlesMC.iteratorAt(particle1.daughter0()+2).eta(); + double etaCandidate2Daughter1 = particlesMC.iteratorAt(particle2.daughter0()).eta(); + double etaCandidate2Daughter2 = particlesMC.iteratorAt(particle2.daughter0()+1).eta(); + double etaCandidate2Daughter3 = particlesMC.iteratorAt(particle2.daughter0()+2).eta(); + if (std::abs(etaCandidate1Daughter1) < etaCut && std::abs(etaCandidate1Daughter2) < etaCut && std::abs(etaCandidate1Daughter3) < etaCut && + std::abs(etaCandidate2Daughter1) < etaCut && std::abs(etaCandidate2Daughter2) < etaCut && std::abs(etaCandidate2Daughter3) < etaCut && + particle1.pt() > ptCut && particle2.pt() > ptCut) { + registry.fill(HIST("hDDbarVsDaughterEtaCut"), etaCut - epsilon, ptCut + epsilon); + } + } ptCut += incrementPtThreshold; } while (ptCut < ptThresholdForMaxEtaCut - epsilon); } while (etaCut < maxEtaCut - epsilon); @@ -709,7 +730,7 @@ struct HfCorrelatorCCbarMCGen { if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } - registry.fill(HIST("hPtcandMCGen"), particle1.pt()); + registry.fill(HIST("hPtCandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); registry.fill(HIST("hYMCGen"), yC); @@ -723,13 +744,13 @@ struct HfCorrelatorCCbarMCGen { registry.fill(HIST("hcountCtriggersMCGen"), 0, particle1.pt()); //to count trigger c quark (for normalisation) for (auto& particle2 : particlesMC) { - if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { + if (particle2.pdgCode() != PDG_t::kCharmBar) { continue; } - if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle2.px(), particle2.py(), particle2.pz()}, RecoDecay::getMassPDG(particle2.pdgCode()))) > cutYCandMax) { continue; } - if (particle2.pdgCode() != PDG_t::kCharmBar) { + if (cutPtCandMin >= 0. && particle2.pt() < cutPtCandMin) { continue; } //check whether mothers of quark cbar (from associated loop) are still '-4' particles - in that case the cbar quark comes from its own fragmentation, skip it @@ -794,7 +815,7 @@ struct HfCorrelatorCCbarMCGenLS { if (cutPtCandMin >= 0. && particle1.pt() < cutPtCandMin) { continue; } - registry.fill(HIST("hPtcandMCGen"), particle1.pt()); + registry.fill(HIST("hPtCandMCGen"), particle1.pt()); registry.fill(HIST("hEtaMCGen"), particle1.eta()); registry.fill(HIST("hPhiMCGen"), particle1.phi()); registry.fill(HIST("hYMCGen"), yC); From 40446df457e61ce56d1aaddb0b9584bbb8bb05aa Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Wed, 2 Jun 2021 10:02:45 +0200 Subject: [PATCH 10/14] Clang fixes --- Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx | 10 +++++----- .../Tasks/PWGHF/HFCorrelatorDplusDminus.cxx | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx index b2af20e971135..50ba97f34edb5 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx @@ -301,7 +301,7 @@ struct HfCorrelatorD0D0barMCGen { {"hPhiMCGen", "D0,D0bar particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hYMCGen", "D0,D0bar candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hcountD0D0barPerEvent", "D0,D0bar particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}, - {"hDDbarVsEtaCut", "D0,D0bar pairs vs #eta cut of D mesons;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}, + {"hDDbarVsEtaCut", "D0,D0bar pairs vs #eta cut of D mesons;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}, {"hDDbarVsDaughterEtaCut", "D0,D0bar pairs vs #eta cut on D daughters;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; @@ -361,13 +361,13 @@ struct HfCorrelatorD0D0barMCGen { //fill pairs vs etaCut plot bool rightDecayChannels = kFALSE; - if((std::abs(particle1.flagMCMatchGen()) == 1 << DecayType::D0ToPiK) && (std::abs(particle2.flagMCMatchGen()) == 1 << DecayType::D0ToPiK)) { + if ((std::abs(particle1.flagMCMatchGen()) == 1 << DecayType::D0ToPiK) && (std::abs(particle2.flagMCMatchGen()) == 1 << DecayType::D0ToPiK)) { rightDecayChannels = kTRUE; - } + } do { ptCut = 0.; etaCut += incrementEtaCut; - do { //fill pairs vs etaCut plot + do { //fill pairs vs etaCut plot if (std::abs(particle1.eta()) < etaCut && std::abs(particle2.eta()) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) { //fill with D and Dbar acceptance checks registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); } @@ -380,7 +380,7 @@ struct HfCorrelatorD0D0barMCGen { std::abs(etaCandidate2Daughter1) < etaCut && std::abs(etaCandidate2Daughter2) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) { registry.fill(HIST("hDDbarVsDaughterEtaCut"), etaCut - epsilon, ptCut + epsilon); - } + } } ptCut += incrementPtThreshold; } while (ptCut < ptThresholdForMaxEtaCut - epsilon); diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx index 38d712b855d75..52cc0ddf120eb 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx @@ -300,7 +300,7 @@ struct HfCorrelatorDplusDminusMCGen { {"hPhiMCGen", "Dplus,Dminus particles - MC gen;particle #it{#varphi};entries", {HistType::kTH1F, {{32, 0., 2. * o2::constants::math::PI}}}}, {"hYMCGen", "Dplus,Dminus candidates - MC gen;candidate #it{#y};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, {"hcountDplusDminusPerEvent", "Dplus,Dminus particles - MC gen;Number per event;entries", {HistType::kTH1F, {{20, 0., 20.}}}}, - {"hDDbarVsEtaCut", "Dplus,Dminus pairs vs #eta cut of D mesons;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}, + {"hDDbarVsEtaCut", "Dplus,Dminus pairs vs #eta cut of D mesons;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}, {"hDDbarVsDaughterEtaCut", "Dplus,Dminus pairs vs #eta cut on D daughters;#eta_{max};entries", {HistType::kTH2F, {{(int)(maxEtaCut / incrementEtaCut), 0., maxEtaCut}, {(int)(ptThresholdForMaxEtaCut / incrementPtThreshold), 0., ptThresholdForMaxEtaCut}}}}}}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; @@ -360,9 +360,9 @@ struct HfCorrelatorDplusDminusMCGen { //fill pairs vs etaCut plot bool rightDecayChannels = kFALSE; - if((std::abs(particle1.flagMCMatchGen()) == 1 << DecayType::DPlusToPiKPi) && (std::abs(particle2.flagMCMatchGen()) == 1 << DecayType::DPlusToPiKPi)) { + if ((std::abs(particle1.flagMCMatchGen()) == 1 << DecayType::DPlusToPiKPi) && (std::abs(particle2.flagMCMatchGen()) == 1 << DecayType::DPlusToPiKPi)) { rightDecayChannels = kTRUE; - } + } do { ptCut = 0.; etaCut += incrementEtaCut; @@ -372,17 +372,17 @@ struct HfCorrelatorDplusDminusMCGen { } if (rightDecayChannels) { //fill with D and Dbar daughter particls acceptance checks double etaCandidate1Daughter1 = particlesMC.iteratorAt(particle1.daughter0()).eta(); - double etaCandidate1Daughter2 = particlesMC.iteratorAt(particle1.daughter0()+1).eta(); - double etaCandidate1Daughter3 = particlesMC.iteratorAt(particle1.daughter0()+2).eta(); + double etaCandidate1Daughter2 = particlesMC.iteratorAt(particle1.daughter0() + 1).eta(); + double etaCandidate1Daughter3 = particlesMC.iteratorAt(particle1.daughter0() + 2).eta(); double etaCandidate2Daughter1 = particlesMC.iteratorAt(particle2.daughter0()).eta(); - double etaCandidate2Daughter2 = particlesMC.iteratorAt(particle2.daughter0()+1).eta(); - double etaCandidate2Daughter3 = particlesMC.iteratorAt(particle2.daughter0()+2).eta(); + double etaCandidate2Daughter2 = particlesMC.iteratorAt(particle2.daughter0() + 1).eta(); + double etaCandidate2Daughter3 = particlesMC.iteratorAt(particle2.daughter0() + 2).eta(); if (std::abs(etaCandidate1Daughter1) < etaCut && std::abs(etaCandidate1Daughter2) < etaCut && std::abs(etaCandidate1Daughter3) < etaCut && std::abs(etaCandidate2Daughter1) < etaCut && std::abs(etaCandidate2Daughter2) < etaCut && std::abs(etaCandidate2Daughter3) < etaCut && particle1.pt() > ptCut && particle2.pt() > ptCut) { registry.fill(HIST("hDDbarVsDaughterEtaCut"), etaCut - epsilon, ptCut + epsilon); - } - } + } + } ptCut += incrementPtThreshold; } while (ptCut < ptThresholdForMaxEtaCut - epsilon); } while (etaCut < maxEtaCut - epsilon); From 47c7a47c51646e28da6efa7f855b37f4dfd51e64 Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Thu, 3 Jun 2021 10:55:19 +0200 Subject: [PATCH 11/14] Removed 'taskname' occurrences from adaptAnalysisTask --- Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx | 30 +++++++++---------- .../Tasks/PWGHF/HFCorrelatorDplusDminus.cxx | 30 +++++++++---------- Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx | 10 +++---- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx index 50ba97f34edb5..9cdaa6dc74530 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx @@ -168,7 +168,7 @@ struct HfCorrelatorD0D0bar { }; /// D0-D0bar correlation pair builder - for MC reco-level analysis (candidates matched to true signal only, but also the various bkg sources are studied) -struct HfCorrelatorD0D0barMCRec { +struct HfCorrelatorD0D0barMcRec { Produces entryD0D0barPair; Produces entryD0D0barRecoInfo; @@ -289,7 +289,7 @@ struct HfCorrelatorD0D0barMCRec { }; /// D0-D0bar correlation pair builder - for MC gen-level analysis (no filter/selection, only true signal) -struct HfCorrelatorD0D0barMCGen { +struct HfCorrelatorD0D0barMcGen { Produces entryD0D0barPair; @@ -394,7 +394,7 @@ struct HfCorrelatorD0D0barMCGen { /// D0-D0bar correlation pair builder - LIKE SIGN - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) /// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, /// since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct HfCorrelatorD0D0barLS { +struct HfCorrelatorD0D0barLs { Produces entryD0D0barPair; Produces entryD0D0barRecoInfo; @@ -492,7 +492,7 @@ struct HfCorrelatorD0D0barLS { /// D0-D0bar correlation pair builder - LIKE SIGN - for MC reco analysis (data-like but matching to true DO and D0bar) /// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, /// since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct HfCorrelatorD0D0barMCRecLS { +struct HfCorrelatorD0D0barMcRecLs { Produces entryD0D0barPair; Produces entryD0D0barRecoInfo; @@ -590,7 +590,7 @@ struct HfCorrelatorD0D0barMCRecLS { /// D0-D0bar correlation pair builder - for MC gen-level analysis, like sign particles /// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, /// since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct HfCorrelatorD0D0barMCGenLS { +struct HfCorrelatorD0D0barMcGenLs { Produces entryD0D0barPair; @@ -665,7 +665,7 @@ struct HfCorrelatorD0D0barMCGenLS { }; /// c-cbar correlator table builder - for MC gen-level analysis -struct HfCorrelatorCCbarMCGen { +struct HfCorrelatorCCbarMcGen { Produces entryccbarPair; @@ -750,7 +750,7 @@ struct HfCorrelatorCCbarMCGen { }; /// c-cbar correlator table builder - for MC gen-level analysis - Like Sign -struct HfCorrelatorCCbarMCGenLS { +struct HfCorrelatorCCbarMcGenLs { Produces entryccbarPair; @@ -845,23 +845,23 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) const bool doLikeSign = cfgc.options().get("doLikeSign"); if (!doLikeSign) { //unlike-sign analyses if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar-mc-gen"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else if (doMCRec) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar-mc-rec"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else if (doMCccbar) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-ccbar-mc-gen"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } } else { //like-sign analyses if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar-mc-gen-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else if (doMCRec) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar-mc-rec-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else if (doMCccbar) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-ccbar-mc-gen-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-d0d0bar-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } } diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx index 52cc0ddf120eb..cfb4721bb741e 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx @@ -167,7 +167,7 @@ struct HfCorrelatorDplusDminus { }; /// Dplus-Dminus correlation pair builder - for MC reco-level analysis (candidates matched to true signal only, but also the various bkg sources are studied) -struct HfCorrelatorDplusDminusMCRec { +struct HfCorrelatorDplusDminusMcRec { Produces entryDplusDminusPair; Produces entryDplusDminusRecoInfo; @@ -288,7 +288,7 @@ struct HfCorrelatorDplusDminusMCRec { }; /// Dplus-Dminus correlation pair builder - for MC gen-level analysis (no filter/selection, only true signal) -struct HfCorrelatorDplusDminusMCGen { +struct HfCorrelatorDplusDminusMcGen { Produces entryDplusDminusPair; @@ -394,7 +394,7 @@ struct HfCorrelatorDplusDminusMCGen { /// Dplus-Dminus correlation pair builder - LIKE SIGN - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) /// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct HfCorrelatorDplusDminusLS { +struct HfCorrelatorDplusDminusLs { Produces entryDplusDminusPair; Produces entryDplusDminusRecoInfo; @@ -500,7 +500,7 @@ struct HfCorrelatorDplusDminusLS { /// Dplus-Dminus correlation pair builder - LIKE SIGN - for MC reco analysis (data-like but matching to true Dplus and Dminus) /// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct HfCorrelatorDplusDminusMCRecLS { +struct HfCorrelatorDplusDminusMcRecLs { Produces entryDplusDminusPair; Produces entryDplusDminusRecoInfo; @@ -608,7 +608,7 @@ struct HfCorrelatorDplusDminusMCRecLS { /// Dplus-Dminus correlation pair builder - for MC gen-level analysis, like sign particles /// NOTE: At the moment, both dPhi-symmetrical correlation pairs (part1-part2 and part2-part1) are filled, since we bin in pT and selecting as trigger the largest pT particle would bias the distributions w.r.t. the ULS case. -struct HfCorrelatorDplusDminusMCGenLS { +struct HfCorrelatorDplusDminusMcGenLs { Produces entryDplusDminusPair; @@ -684,7 +684,7 @@ struct HfCorrelatorDplusDminusMCGenLS { }; /// c-cbar correlator table builder - for MC gen-level analysis -struct HfCorrelatorCCbarMCGen { +struct HfCorrelatorCCbarMcGen { Produces entryccbarPair; @@ -769,7 +769,7 @@ struct HfCorrelatorCCbarMCGen { }; /// c-cbar correlator table builder - for MC gen-level analysis - Like Sign -struct HfCorrelatorCCbarMCGenLS { +struct HfCorrelatorCCbarMcGenLs { Produces entryccbarPair; @@ -864,23 +864,23 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) const bool doLikeSign = cfgc.options().get("doLikeSign"); if (!doLikeSign) { //unlike-sign analyses if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus-mc-gen"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else if (doMCRec) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus-mc-rec"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else if (doMCccbar) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-ccbar-mc-gen"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } } else { //like-sign analyses if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus-mc-gen-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else if (doMCRec) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus-mc-rec-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else if (doMCccbar) { //MC-Reco analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-ccbar-mc-gen-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-correlator-dplusdminus-ls"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } } diff --git a/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx b/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx index 06b8d81a84959..b7f0b9bf72e21 100644 --- a/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx +++ b/Analysis/Tasks/PWGHF/taskCorrelationDDbar.cxx @@ -170,7 +170,7 @@ struct HfTaskCorrelationDDbar { /// D-Dbar correlation pair filling task, from pair tables - for MC reco-level analysis (candidates matched to true signal only, but also bkg sources are studied) /// Works on both USL and LS analyses pair tables -struct HfTaskCorrelationDDbarMCRec { +struct HfTaskCorrelationDDbarMcRec { HistogramRegistry registry{ "registry", @@ -325,7 +325,7 @@ struct HfTaskCorrelationDDbarMCRec { /// D-Dbar correlation pair filling task, from pair tables - for MC gen-level analysis (no filter/selection, only true signal) - Ok for both USL and LS analyses /// Works on both USL and LS analyses pair tables (and if tables are filled with quark pairs as well) -struct HfTaskCorrelationDDbarMCGen { +struct HfTaskCorrelationDDbarMcGen { HistogramRegistry registry{ "registry", @@ -381,11 +381,11 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) const bool doMCGen = cfgc.options().get("doMCGen"); const bool doMCRec = cfgc.options().get("doMCRec"); if (doMCGen) { //MC-Gen analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-task-correlation-ddbar-mc-gen"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else if (doMCRec) { //MC-Rec analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-task-correlation-ddbar-mc-rec"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else { //data analysis - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-task-correlation-ddbar"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } return workflow; } From d400b332d1e2b0bacb5c1e9b545959cb66fc31f0 Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Thu, 3 Jun 2021 11:00:04 +0200 Subject: [PATCH 12/14] Fix for Vit's comment (switched kFALSE to false, kTRUE to true) --- Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx | 4 ++-- Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx index 9cdaa6dc74530..b40da297b1c8a 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx @@ -360,9 +360,9 @@ struct HfCorrelatorD0D0barMcGen { double ptCut = 0.; //fill pairs vs etaCut plot - bool rightDecayChannels = kFALSE; + bool rightDecayChannels = false; if ((std::abs(particle1.flagMCMatchGen()) == 1 << DecayType::D0ToPiK) && (std::abs(particle2.flagMCMatchGen()) == 1 << DecayType::D0ToPiK)) { - rightDecayChannels = kTRUE; + rightDecayChannels = true; } do { ptCut = 0.; diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx index cfb4721bb741e..c59e1543299db 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx @@ -359,9 +359,9 @@ struct HfCorrelatorDplusDminusMcGen { double ptCut = 0.; //fill pairs vs etaCut plot - bool rightDecayChannels = kFALSE; + bool rightDecayChannels = false; if ((std::abs(particle1.flagMCMatchGen()) == 1 << DecayType::DPlusToPiKPi) && (std::abs(particle2.flagMCMatchGen()) == 1 << DecayType::DPlusToPiKPi)) { - rightDecayChannels = kTRUE; + rightDecayChannels = true; } do { ptCut = 0.; From 8a3823a6d2b835b42eb214a24b25f310dfb95af7 Mon Sep 17 00:00:00 2001 From: Fabio Colamaria Date: Fri, 4 Jun 2021 08:21:21 +0200 Subject: [PATCH 13/14] Fix building issues (improper usage of << operators) --- Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx | 6 +++--- Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx index b40da297b1c8a..5caada8f1090d 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx @@ -220,7 +220,7 @@ struct HfCorrelatorD0D0barMcRec { if (candidate1.isSelD0() >= selectionFlagD0 && candidate1.flagMCMatchRec() == 1 << DecayType::D0ToPiK) { //only reco and matched as D0 registry.fill(HIST("hMassD0MCRec"), InvMassD0(candidate1), candidate1.pt()); } - if (candidate1.isSelD0bar() >= selectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << DecayType::D0ToPiK) { //only reco and matched as D0bar + if (candidate1.isSelD0bar() >= selectionFlagD0bar && candidate1.flagMCMatchRec() == -(1 << DecayType::D0ToPiK)) { //only reco and matched as D0bar registry.fill(HIST("hMassD0barMCRec"), InvMassD0bar(candidate1), candidate1.pt()); } registry.fill(HIST("hPtCandMCRec"), candidate1.pt()); @@ -245,7 +245,7 @@ struct HfCorrelatorD0D0barMcRec { if (candidate2.isSelD0bar() < selectionFlagD0bar) { //discard candidates not selected as D0bar in inner loop continue; } - flagD0barSignal = candidate2.flagMCMatchRec() == -1 << DecayType::D0ToPiK; //flagD0barSignal 'true' if candidate2 matched to D0 (particle) + flagD0barSignal = candidate2.flagMCMatchRec() == -(1 << DecayType::D0ToPiK); //flagD0barSignal 'true' if candidate2 matched to D0 (particle) if (cutYCandMax >= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { continue; } @@ -560,7 +560,7 @@ struct HfCorrelatorD0D0barMcRecLs { continue; } bool conditionLSForD0 = (candidate1.isSelD0() >= selectionFlagD0bar && candidate1.flagMCMatchRec() == 1 << DecayType::D0ToPiK) && (candidate2.isSelD0() >= selectionFlagD0bar && candidate2.flagMCMatchRec() == 1 << DecayType::D0ToPiK); - bool conditionLSForD0bar = (candidate1.isSelD0bar() >= selectionFlagD0bar && candidate1.flagMCMatchRec() == -1 << DecayType::D0ToPiK) && (candidate2.isSelD0bar() >= selectionFlagD0bar && candidate2.flagMCMatchRec() == -1 << DecayType::D0ToPiK); + bool conditionLSForD0bar = (candidate1.isSelD0bar() >= selectionFlagD0bar && candidate1.flagMCMatchRec() == -(1 << DecayType::D0ToPiK)) && (candidate2.isSelD0bar() >= selectionFlagD0bar && candidate2.flagMCMatchRec() == -(1 << DecayType::D0ToPiK)); if (conditionLSForD0 || conditionLSForD0bar) { //LS pair (of D0 or of D0bar) + pt2= 0. && std::abs(YD0(candidate2)) > cutYCandMax) { continue; diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx index c59e1543299db..0d27c1e641714 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx @@ -578,7 +578,7 @@ struct HfCorrelatorDplusDminusMcRecLs { if (innerSecondTrack.sign() == 1) { innerParticleSign = -1; //Dminus (second daughter track is positive) } - if (!std::abs(candidate2.flagMCMatchRec()) == 1 << DecayType::DPlusToPiKPi) { //reject fake candidates + if (std::abs(candidate2.flagMCMatchRec()) != 1 << DecayType::DPlusToPiKPi) { //reject fake candidates continue; } if (outerParticleSign == innerParticleSign) { //LS pair (of Dplus or Dminus) + pt2 Date: Mon, 7 Jun 2021 10:22:49 +0200 Subject: [PATCH 14/14] Fixed readability-braces-around-statements --- Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx | 6 ++++-- Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx index 5caada8f1090d..c2f2bf08ff7aa 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorD0D0bar.cxx @@ -153,8 +153,9 @@ struct HfCorrelatorD0D0bar { ptCut = 0.; etaCut += incrementEtaCut; do { //fill pairs vs etaCut plot - if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) + if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) { registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + } ptCut += incrementPtThreshold; } while (ptCut < ptThresholdForMaxEtaCut - epsilon); } while (etaCut < maxEtaCut - epsilon); @@ -277,8 +278,9 @@ struct HfCorrelatorD0D0barMcRec { ptCut = 0.; etaCut += incrementEtaCut; do { //fill pairs vs etaCut plot - if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) + if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) { registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + } ptCut += incrementPtThreshold; } while (ptCut < ptThresholdForMaxEtaCut - epsilon); } while (etaCut < maxEtaCut - epsilon); diff --git a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx index 0d27c1e641714..2a52f4d3bebf0 100644 --- a/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx +++ b/Analysis/Tasks/PWGHF/HFCorrelatorDplusDminus.cxx @@ -156,8 +156,9 @@ struct HfCorrelatorDplusDminus { ptCut = 0.; etaCut += incrementEtaCut; do { //fill pairs vs etaCut plot - if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) + if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) { registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + } ptCut += incrementPtThreshold; } while (ptCut < ptThresholdForMaxEtaCut - epsilon); } while (etaCut < maxEtaCut - epsilon); @@ -276,8 +277,9 @@ struct HfCorrelatorDplusDminusMcRec { ptCut = 0.; etaCut += incrementEtaCut; do { //fill pairs vs etaCut plot - if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) + if (std::abs(candidate1.eta()) < etaCut && std::abs(candidate2.eta()) < etaCut && candidate1.pt() > ptCut && candidate2.pt() > ptCut) { registry.fill(HIST("hDDbarVsEtaCut"), etaCut - epsilon, ptCut + epsilon); + } ptCut += incrementPtThreshold; } while (ptCut < ptThresholdForMaxEtaCut - epsilon); } while (etaCut < maxEtaCut - epsilon);