From 783465cc40458376d46b0c3f13b4339bab8d1fc1 Mon Sep 17 00:00:00 2001 From: Luca Aglietta Date: Wed, 13 Mar 2024 17:05:07 +0100 Subject: [PATCH 01/19] candidate creator for charmed resonances --- PWGHF/D2H/DataModel/ReducedDataModel.h | 29 +- PWGHF/D2H/TableProducer/CMakeLists.txt | 7 +- .../candidateCreatorDV0Reduced.cxx | 254 ++++++++++++++++++ .../TableProducer/dataCreatorDV0Reduced.cxx | 57 ++-- 4 files changed, 312 insertions(+), 35 deletions(-) create mode 100644 PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 66ec55a161c..9943bbea452 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -382,18 +382,24 @@ DECLARE_SOA_TABLE(HfCandBpConfigs, "AOD", "HFCANDBPCONFIG", //! Table with confi // Charm resonances analysis namespace hf_reso_cand_reduced { -DECLARE_SOA_COLUMN(InvMass, invMass, float); //! Invariant mass of 3 prong candidate in GeV/c2 +DECLARE_SOA_COLUMN(InvMass, invMass, float); //! Invariant mass in GeV/c2 DECLARE_SOA_COLUMN(InvMassK0s, invMassK0s, float); //! Invariant mass of V0 candidate in GeV/c2, under K0s mass assumption DECLARE_SOA_COLUMN(InvMassLambda, invMassLambda, float); //! Invariant mass of V0 candidate in GeV/c2, under Lambda mass assumption DECLARE_SOA_COLUMN(InvMassAntiLambda, invMassAntiLambda, float); //! Invariant mass of V0 candidate in GeV/c2, under AntiLambda mass assumption DECLARE_SOA_COLUMN(Px, px, float); //! Momentum of V0/3 prong candidate in GeV/c DECLARE_SOA_COLUMN(Py, py, float); DECLARE_SOA_COLUMN(Pz, pz, float); -DECLARE_SOA_COLUMN(CosP, cosp, float); //! Cos PA of V0 candidate -DECLARE_SOA_COLUMN(DCA, dca, float); //! DCA of V0 candidate +DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine of Pointing Angle of V0 candidate +DECLARE_SOA_COLUMN(Dca, dca, float); //! DCA of V0 candidate DECLARE_SOA_COLUMN(Radius, radius, float); //! Radius of V0 candidate DECLARE_SOA_COLUMN(V0Type, v0Type, uint8_t); //! Bitmap with mass hypothesis of the V0 DECLARE_SOA_COLUMN(DType, dType, int8_t); //! Integer with selected D candidate type: 1 = Dplus, -1 = Dminus, 2 = DstarPlus, -2 = DstarMinus +DECLARE_SOA_COLUMN(Pt, pt, float); //! Pt of Resonance candidate in GeV/c +DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Pt of D daughter in GeV/c +DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Pt of V0 daughter in GeV/c +DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c +DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c + } // namespace hf_reso_cand_reduced DECLARE_SOA_TABLE(HfRedVzeros, "AOD", "HFREDVZERO", //! Table with V0 candidate information for resonances reduced workflow @@ -405,8 +411,8 @@ DECLARE_SOA_TABLE(HfRedVzeros, "AOD", "HFREDVZERO", //! Table with V0 candidate hf_reso_cand_reduced::Px, hf_reso_cand_reduced::Py, hf_reso_cand_reduced::Pz, - hf_reso_cand_reduced::CosP, - hf_reso_cand_reduced::DCA, + hf_reso_cand_reduced::Cpa, + hf_reso_cand_reduced::Dca, hf_reso_cand_reduced::Radius, hf_reso_cand_reduced::V0Type); @@ -420,6 +426,19 @@ DECLARE_SOA_TABLE(HfRed3PrNoTrks, "AOD", "HFRED3PRNOTRK", //! Table with 3 prong hf_reso_cand_reduced::Py, hf_reso_cand_reduced::Pz, hf_reso_cand_reduced::DType); + +DECLARE_SOA_TABLE(HfCandCharmReso, "AOD", "HFCANDCHARMRESO", //! Table with Resonance candidate information for resonances reduced workflow + o2::soa::Index<>, + hf_track_index_reduced::HfRedCollisionId, + hf_reso_cand_reduced::InvMass, + hf_reso_cand_reduced::Pt, + hf_reso_cand_reduced::InvMassProng0, + hf_reso_cand_reduced::PtProng0, + hf_reso_cand_reduced::InvMassProng1, + hf_reso_cand_reduced::PtProng1, + hf_reso_cand_reduced::Cpa, + hf_reso_cand_reduced::Dca, + hf_reso_cand_reduced::Radius); } // namespace aod namespace soa diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index 3d3e2103fd3..6f3ae2f13cd 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -21,6 +21,11 @@ o2physics_add_dpl_workflow(candidate-creator-bplus-reduced PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(candidate-creator-d-v0-reduced + SOURCES candidateCreatorDV0Reduced.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + # Candidate selectors o2physics_add_dpl_workflow(candidate-selector-b0-to-d-pi-reduced @@ -42,6 +47,6 @@ o2physics_add_dpl_workflow(data-creator-charm-had-pi-reduced o2physics_add_dpl_workflow(data-creator-d-v0-reduced SOURCES dataCreatorDV0Reduced.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx new file mode 100644 index 00000000000..ff0366138f3 --- /dev/null +++ b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx @@ -0,0 +1,254 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file candidateCreatorCharmResoReduced.cxx +/// \brief Reconstruction of Resonance candidates +/// +/// \author Luca Aglietta , Università degli Studi di Torino +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" +#include "ReconstructionDataFormats/V0.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" + +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; + +enum Selections : uint8_t{ + NoSel = 0, + DSel, + V0Sel, + NSelSteps +}; +enum DecayChannel : uint8_t { + Ds1toDstarK0s = 0, + Dstar2toDplusK0s, + XctoDplusLambda + }; +enum V0Type : uint8_t { + K0s = 0, + Lambda, + AntiLambda +}; +const int nBins = 7; +constexpr double binsPt[nBins + 1] = { + 1., + 2., + 4., + 6., + 8., + 12., + 24., + 50.}; +auto vecBins = std::vector{binsPt, binsPt + nBins + 1}; + +struct HfCandidateCreatorDV0Reduced { + // Produces: Tables with resonance info + Produces rowCandidateReso; + // Configurables + Configurable invMassWindowD{"invMassWindowD", 0.5, "invariant-mass window for D candidates (GeV/c2)"}; + Configurable invMassWindowV0{"invMassWindowV0", 0.5, "invariant-mass window for V0 candidates (GeV/c2)"}; + // QA switch + Configurable activateQA{"activateQA", false, "Flag to enable QA histogram"}; + // Hist Axis + Configurable> binsPt{"binsPt", std::vector{vecBins}, "pT bin limits"}; + + // Partition of V0 candidates based on v0Type + Partition candidatesK0s = aod::hf_reso_cand_reduced::v0Type == (uint8_t)1 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)3 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)5; + Partition candidatesLambda = aod::hf_reso_cand_reduced::v0Type == (uint8_t)2 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)4; + + // Useful constants + double massK0{0.}; + double massLambda{0.}; + double massDplus{0.}; + double massDstar{0.}; + + // Histogram registry: if task make it with a THNsparse with all variables you want to save + HistogramRegistry registry{"registry"}; + + void init(InitContext const&) + { + for (const auto& value : vecBins){ + LOGF(info, "bin limit %f",value ); + } + const AxisSpec axisPt{(std::vector)vecBins,"#it{p}_{T} (GeV/#it{c})"}; + // histograms + registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 2.4, 2.7},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + if (activateQA) { + constexpr int kNBinsSelections = Selections::NSelSteps; + std::string labels[kNBinsSelections]; + labels[Selections::NoSel] = "No selection"; + labels[Selections::DSel] = "D Candidates Selection"; + labels[Selections::V0Sel] = "D & V0 candidate Selection"; + static const AxisSpec axisSelections = {kNBinsSelections, 0.5, kNBinsSelections + 0.5, ""}; + registry.add("hSelections", "Selections", {HistType::kTH1F, {axisSelections}}); + for (int iBin = 0; iBin < kNBinsSelections; ++iBin) { + registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); + } + } + + massK0 = o2::constants::physics::MassK0Short; + massLambda = o2::constants::physics::MassLambda; + massDplus = o2::constants::physics::MassDPlus; + massDstar = o2::constants::physics::MassDStar; + } + + template + bool isDSelected(D const& candD) + { + float massD{0.}; + //slection on D candidate mass + if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::XctoDplusLambda ){ + massD = massDplus; + } else if (DecayChannel == DecayChannel::Ds1toDstarK0s){ + massD = massDstar; + } + if (std::fabs(candD.invMass() - massD) > invMassWindowD){ + return false; + } + return true; + } + + template + bool isV0Selected(V const& candV0, D const& candD) + { + float massV0{0.}; + float invMassV0{0.}; + //slection on V0 candidate mass + if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::Ds1toDstarK0s){ + massV0 = massK0; + invMassV0 = candV0.invMassK0s(); + } else if (DecayChannel == DecayChannel::XctoDplusLambda){ + massV0 = massLambda; + if (candD.dType() > 0){ + invMassV0 = candV0.invMassLambda(); + } else { + invMassV0 = candV0.invMassAntiLambda(); + } + } + if (std::fabs(invMassV0 - massV0) > invMassWindowV0 ){ + return false; + } + return true; + } + + template + void runCandidateCreation(C const& collisions, + D const& candsD, + V const& candsV0) + { + // loop on D candidates + for (const auto& candD : candsD) { + // selection of D candidates + if (activateQA) { + registry.fill(HIST("hSelections"), 1); + } + if(!isDSelected(candD)){ + continue; + } + if (activateQA) { + registry.fill(HIST("hSelections"), 1 + Selections::DSel); + } + float invMassD = candD.invMass(); + std::array pVecD = {candD.px(),candD.py(),candD.pz()}; + float ptD = RecoDecay::pt(pVecD);; + // loop on V0 candidates + bool already_counted{false}; + for (const auto& candV0 : candsV0){ + if(!isV0Selected(candV0, candD)){ + continue; + } + if (activateQA && !already_counted) { + registry.fill(HIST("hSelections"), 1 + Selections::V0Sel); + already_counted = true; + } + float invMass2Reso{0.}; + float invMassV0{0.}; + std::array pVecV0 = {candV0.px(),candV0.py(),candV0.pz()}; + float ptV0 = RecoDecay::pt(pVecV0); + float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0,pVecD)); + switch (DecayChannel) { + case DecayChannel::Ds1toDstarK0s: + invMassV0 = candV0.invMassK0s(); + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); + registry.fill(HIST("hMassDs1"), sqrt(invMass2Reso), ptReso); + break; + case DecayChannel::Dstar2toDplusK0s: + invMassV0 = candV0.invMassK0s(); + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); + registry.fill(HIST("hMassDsStar2"), sqrt(invMass2Reso), ptReso); + break; + case DecayChannel::XctoDplusLambda: + if (candD.dType() > 0){ + invMassV0 = candV0.invMassLambda(); + } else { + invMassV0 = candV0.invMassAntiLambda(); + } + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); + registry.fill(HIST("hMassXcRes"), sqrt(invMass2Reso), ptReso); + break; + default: + break; + } + //Filling Output table + rowCandidateReso(collisions.globalIndex(), + sqrt(invMass2Reso), + ptReso, + invMassD, + ptD, + invMassV0, + ptV0, + candV0.cpa(), + candV0.dca(), + candV0.radius()); + } + + } + }//main function + + void processDstar2toDplusK0s(aod::HfRedCollisions::iterator const& collision, + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) + { + runCandidateCreation(collision, candsD, candidatesK0s); + } + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDstar2toDplusK0s, "Process Dplus candidates without MC info and without ML info", true); + + void processDs1toDstarK0s(aod::HfRedCollisions::iterator const& collision, + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) + { + runCandidateCreation(collision, candsD, candidatesK0s); + } + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDs1toDstarK0s, "Process Dplus candidates without MC info and without ML info", false); + + void processXctoDplusLambda(aod::HfRedCollisions::iterator const& collision, + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) + { + runCandidateCreation(collision, candsD, candidatesLambda); + } + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processXctoDplusLambda, "Process Dplus candidates without MC info and without ML info", false); +}; // struct + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx index cc89b6beb5d..86607b6ad11 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx @@ -56,13 +56,13 @@ enum DecayChannel : uint8_t { DplusV0 }; -enum V0_type : uint8_t { +enum V0Type : uint8_t { K0s = 0, Lambda, AntiLambda }; -enum TypeD : uint8_t { +enum DType : uint8_t { Dplus = 1, Dstar }; @@ -133,17 +133,17 @@ struct HfDataCreatorDV0Reduced { registry.get(HIST("hEvents"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } registry.add("hMassDplus", "Dplus candidates;inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 1.7, 2}}}); - registry.add("hMassDstar", "Dstar candidates;inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0.05, 0.25}}}); + registry.add("hMassDstar", "Dstar candidates;inv. mass (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0.14, 0.17}}}); registry.add("hMassK0s", "K0^{s} candidates;inv. mass (#pi^{#plus}#pi^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0.35, 0.65}}}); registry.add("hMassLambda", "Lambda candidates;inv. mass (p #pi^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 1.05, 1.35}}}); registry.add("hPtDplus", "D^{#minus} candidates;D^{#minus} candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}); registry.add("hPtDstar", "D^{*} candidates;D^{*} candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}); registry.add("hPtV0", "V0 candidates;V0 candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}); - registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0.45, 0.7}}}); - registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0.4, 1}}}); - registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 1., 1.4}}}); - registry.add("hV0_type", "V0 selection flag", {HistType::kTH1F, {{8, -0.5, 7.5}}}); - registry.add("hD_type", "D selection flag", {HistType::kTH1F, {{5, -2.5, 2.5}}}); + registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 2.4, 2.7}}}); + registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 2.4, 2.7}}}); + registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 2.9, 3.3}}}); + registry.add("hV0Type", "V0 selection flag", {HistType::kTH1F, {{8, -0.5, 7.5}}}); + registry.add("hDType", "D selection flag", {HistType::kTH1F, {{5, -2.5, 2.5}}}); ccdb->setURL(url.value); ccdb->setCaching(true); @@ -158,7 +158,7 @@ struct HfDataCreatorDV0Reduced { /// \param collision is the current collision /// \return a bitmap with mass hypotesis if passes all cuts template - inline uint8_t isSelectedV0(const V0& v0, const Coll& collision, const std::array& dauTracks, const std::array& dDaughtersIDs) + inline uint8_t getSelectionMapV0(const V0& v0, const Coll& collision, const std::array& dauTracks, const std::array& dDaughtersIDs) { uint8_t isSelected{BIT(K0s) | BIT(Lambda) | BIT(AntiLambda)}; // reject VOs that share daughters with D @@ -239,12 +239,12 @@ struct HfDataCreatorDV0Reduced { std::array pVecD; std::array secondaryVertexD; std::array prongIdsD; - uint8_t v0_type; - int8_t d_type; + uint8_t v0type; + int8_t dtype; if constexpr (std::is_same::value) { if (candD.signSoftPi() > 0) - invMassD = candD.invMassDstar() - candD.invMassD0(); + invMassD = candD.invMassDstar(); else invMassD = candD.invMassAntiDstar() - candD.invMassD0Bar(); massD = MassDStar; @@ -255,7 +255,7 @@ struct HfDataCreatorDV0Reduced { prongIdsD[0] = candD.prong0Id(); prongIdsD[1] = candD.prong1Id(); prongIdsD[2] = candD.prongPiId(); - d_type = candD.signSoftPi() * TypeD::Dstar; + dtype = candD.signSoftPi() * DType::Dstar; //needs fixing } else if constexpr (std::is_same::value) { auto prong0 = candD.template prong0_as(); invMassD = hfHelper.invMassDplusToPiKPi(candD); @@ -267,7 +267,7 @@ struct HfDataCreatorDV0Reduced { prongIdsD[0] = candD.prong0Id(); prongIdsD[1] = candD.prong1Id(); prongIdsD[2] = candD.prong2Id(); - d_type = prong0.sign() * TypeD::Dplus; + dtype = (int8_t)(prong0.sign() * DType::Dplus); //needs fixing } // else if // Loop on V0 candidates @@ -275,8 +275,8 @@ struct HfDataCreatorDV0Reduced { auto posTrack = v0.posTrack_as(); auto negTrack = v0.negTrack_as(); // Apply selsection - v0_type = isSelectedV0(v0, collision, std::array{posTrack, negTrack}, prongIdsD); - if (v0_type == 0) { + v0type = getSelectionMapV0(v0, collision, std::array{posTrack, negTrack}, prongIdsD); + if (v0type == 0) { continue; } // propagate V0 to primary vertex (if enabled) @@ -291,38 +291,38 @@ struct HfDataCreatorDV0Reduced { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParK0, 2.f, matCorr, &dcaInfo); getPxPyPz(trackParK0, pVecV0); } - float ptV0 = sqrt(pVecV0[0] * pVecV0[0] + pVecV0[1] * pVecV0[1]); // fill histos + float ptV0 = RecoDecay::pt(pVecV0); // fill histos registry.fill(HIST("hPtV0"), ptV0); - registry.fill(HIST("hV0_type"), v0_type); - if (TESTBIT(v0_type, K0s)) { + registry.fill(HIST("hV0Type"), v0type); + if (TESTBIT(v0type, K0s)) { massV0 = MassK0; auto invMass2DV0 = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massD, massV0}); registry.fill(HIST("hMassK0s"), v0.mK0Short()); switch (DecayChannel) { case DecayChannel::DstarV0: - registry.fill(HIST("hMassDs1"), sqrt(invMass2DV0) - massD); + registry.fill(HIST("hMassDs1"), sqrt(invMass2DV0)); break; case DecayChannel::DplusV0: - registry.fill(HIST("hMassDsStar2"), sqrt(invMass2DV0) - massD); + registry.fill(HIST("hMassDsStar2"), sqrt(invMass2DV0)); break; default: break; } } - if (TESTBIT(v0_type, Lambda)) { + if (TESTBIT(v0type, Lambda)) { massV0 = MassLambda0; auto invMass2DV0 = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massD, massV0}); registry.fill(HIST("hMassLambda"), v0.mLambda()); if (DecayChannel == DecayChannel::DplusV0) { - registry.fill(HIST("hMassXcRes"), sqrt(invMass2DV0) - massD); + registry.fill(HIST("hMassXcRes"), sqrt(invMass2DV0)); } } - if (TESTBIT(v0_type, AntiLambda)) { + if (TESTBIT(v0type, AntiLambda)) { massV0 = MassLambda0; auto invMass2DV0 = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massD, massV0}); registry.fill(HIST("hMassLambda"), v0.mAntiLambda()); if (DecayChannel == DecayChannel::DplusV0) { - registry.fill(HIST("hMassXcRes"), sqrt(invMass2DV0) - massD); + registry.fill(HIST("hMassXcRes"), sqrt(invMass2DV0)); } } // fill V0 table @@ -336,7 +336,7 @@ struct HfDataCreatorDV0Reduced { v0.v0cosPA(), v0.dcav0topv(), v0.v0radius(), - v0_type); + v0type); selectedV0s[v0.globalIndex()] = hfCandV0.lastIndex(); } fillHfCandD = true; @@ -348,7 +348,7 @@ struct HfDataCreatorDV0Reduced { secondaryVertexD[0], secondaryVertexD[1], secondaryVertexD[2], invMassD, pVecD[0], pVecD[1], pVecD[2], - d_type); + dtype); fillHfReducedCollision = true; switch (DecayChannel) { case DecayChannel::DstarV0: @@ -362,8 +362,7 @@ struct HfDataCreatorDV0Reduced { default: break; } - registry.fill(HIST("hPtDplus"), candD.pt()); - registry.fill(HIST("hD_type"), d_type); + registry.fill(HIST("hDType"), dtype); } } // candsD loop registry.fill(HIST("hEvents"), 1 + Event::Processed); From 01a0c6fcff61213728652d261f0ef20f2db3be40 Mon Sep 17 00:00:00 2001 From: Luca Aglietta Date: Wed, 13 Mar 2024 18:46:27 +0100 Subject: [PATCH 02/19] minor fix --- PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx index 86607b6ad11..f2ac273a378 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx @@ -255,7 +255,7 @@ struct HfDataCreatorDV0Reduced { prongIdsD[0] = candD.prong0Id(); prongIdsD[1] = candD.prong1Id(); prongIdsD[2] = candD.prongPiId(); - dtype = candD.signSoftPi() * DType::Dstar; //needs fixing + dtype = candD.signSoftPi() * DType::Dstar; } else if constexpr (std::is_same::value) { auto prong0 = candD.template prong0_as(); invMassD = hfHelper.invMassDplusToPiKPi(candD); @@ -267,7 +267,7 @@ struct HfDataCreatorDV0Reduced { prongIdsD[0] = candD.prong0Id(); prongIdsD[1] = candD.prong1Id(); prongIdsD[2] = candD.prong2Id(); - dtype = (int8_t)(prong0.sign() * DType::Dplus); //needs fixing + dtype = (int8_t)(prong0.sign() * DType::Dplus); } // else if // Loop on V0 candidates From 5ee7cc9dfc89c43283851b4df7a5ec0c2f19ce0c Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 13 Mar 2024 17:52:22 +0000 Subject: [PATCH 03/19] Please consider the following formatting changes --- PWGHF/D2H/DataModel/ReducedDataModel.h | 10 +- .../candidateCreatorDV0Reduced.cxx | 202 +++++++++--------- .../TableProducer/dataCreatorDV0Reduced.cxx | 4 +- 3 files changed, 108 insertions(+), 108 deletions(-) diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 9943bbea452..6e3f2da1da7 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -394,11 +394,11 @@ DECLARE_SOA_COLUMN(Dca, dca, float); //! DCA of V0 candidate DECLARE_SOA_COLUMN(Radius, radius, float); //! Radius of V0 candidate DECLARE_SOA_COLUMN(V0Type, v0Type, uint8_t); //! Bitmap with mass hypothesis of the V0 DECLARE_SOA_COLUMN(DType, dType, int8_t); //! Integer with selected D candidate type: 1 = Dplus, -1 = Dminus, 2 = DstarPlus, -2 = DstarMinus -DECLARE_SOA_COLUMN(Pt, pt, float); //! Pt of Resonance candidate in GeV/c -DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Pt of D daughter in GeV/c -DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Pt of V0 daughter in GeV/c -DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c -DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c +DECLARE_SOA_COLUMN(Pt, pt, float); //! Pt of Resonance candidate in GeV/c +DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Pt of D daughter in GeV/c +DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Pt of V0 daughter in GeV/c +DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c +DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c } // namespace hf_reso_cand_reduced diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx index ff0366138f3..a9f5dec216d 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx @@ -29,7 +29,7 @@ using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; -enum Selections : uint8_t{ +enum Selections : uint8_t { NoSel = 0, DSel, V0Sel, @@ -39,7 +39,7 @@ enum DecayChannel : uint8_t { Ds1toDstarK0s = 0, Dstar2toDplusK0s, XctoDplusLambda - }; +}; enum V0Type : uint8_t { K0s = 0, Lambda, @@ -82,15 +82,15 @@ struct HfCandidateCreatorDV0Reduced { HistogramRegistry registry{"registry"}; void init(InitContext const&) - { - for (const auto& value : vecBins){ - LOGF(info, "bin limit %f",value ); + { + for (const auto& value : vecBins) { + LOGF(info, "bin limit %f", value); } - const AxisSpec axisPt{(std::vector)vecBins,"#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisPt{(std::vector)vecBins, "#it{p}_{T} (GeV/#it{c})"}; // histograms - registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 2.4, 2.7},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); if (activateQA) { constexpr int kNBinsSelections = Selections::NSelSteps; std::string labels[kNBinsSelections]; @@ -103,27 +103,27 @@ struct HfCandidateCreatorDV0Reduced { registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } } - + massK0 = o2::constants::physics::MassK0Short; massLambda = o2::constants::physics::MassLambda; massDplus = o2::constants::physics::MassDPlus; massDstar = o2::constants::physics::MassDStar; } - + template bool isDSelected(D const& candD) { float massD{0.}; - //slection on D candidate mass - if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::XctoDplusLambda ){ - massD = massDplus; - } else if (DecayChannel == DecayChannel::Ds1toDstarK0s){ - massD = massDstar; + // slection on D candidate mass + if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::XctoDplusLambda) { + massD = massDplus; + } else if (DecayChannel == DecayChannel::Ds1toDstarK0s) { + massD = massDstar; } - if (std::fabs(candD.invMass() - massD) > invMassWindowD){ - return false; + if (std::fabs(candD.invMass() - massD) > invMassWindowD) { + return false; } - return true; + return true; } template @@ -131,22 +131,22 @@ struct HfCandidateCreatorDV0Reduced { { float massV0{0.}; float invMassV0{0.}; - //slection on V0 candidate mass - if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::Ds1toDstarK0s){ - massV0 = massK0; - invMassV0 = candV0.invMassK0s(); - } else if (DecayChannel == DecayChannel::XctoDplusLambda){ - massV0 = massLambda; - if (candD.dType() > 0){ - invMassV0 = candV0.invMassLambda(); - } else { - invMassV0 = candV0.invMassAntiLambda(); - } + // slection on V0 candidate mass + if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::Ds1toDstarK0s) { + massV0 = massK0; + invMassV0 = candV0.invMassK0s(); + } else if (DecayChannel == DecayChannel::XctoDplusLambda) { + massV0 = massLambda; + if (candD.dType() > 0) { + invMassV0 = candV0.invMassLambda(); + } else { + invMassV0 = candV0.invMassAntiLambda(); + } } - if (std::fabs(invMassV0 - massV0) > invMassWindowV0 ){ + if (std::fabs(invMassV0 - massV0) > invMassWindowV0) { return false; } - return true; + return true; } template @@ -156,94 +156,94 @@ struct HfCandidateCreatorDV0Reduced { { // loop on D candidates for (const auto& candD : candsD) { - // selection of D candidates - if (activateQA) { - registry.fill(HIST("hSelections"), 1); - } - if(!isDSelected(candD)){ - continue; + // selection of D candidates + if (activateQA) { + registry.fill(HIST("hSelections"), 1); + } + if (!isDSelected(candD)) { + continue; + } + if (activateQA) { + registry.fill(HIST("hSelections"), 1 + Selections::DSel); + } + float invMassD = candD.invMass(); + std::array pVecD = {candD.px(), candD.py(), candD.pz()}; + float ptD = RecoDecay::pt(pVecD); + ; + // loop on V0 candidates + bool already_counted{false}; + for (const auto& candV0 : candsV0) { + if (!isV0Selected(candV0, candD)) { + continue; } - if (activateQA) { - registry.fill(HIST("hSelections"), 1 + Selections::DSel); + if (activateQA && !already_counted) { + registry.fill(HIST("hSelections"), 1 + Selections::V0Sel); + already_counted = true; } - float invMassD = candD.invMass(); - std::array pVecD = {candD.px(),candD.py(),candD.pz()}; - float ptD = RecoDecay::pt(pVecD);; - // loop on V0 candidates - bool already_counted{false}; - for (const auto& candV0 : candsV0){ - if(!isV0Selected(candV0, candD)){ - continue; - } - if (activateQA && !already_counted) { - registry.fill(HIST("hSelections"), 1 + Selections::V0Sel); - already_counted = true; - } - float invMass2Reso{0.}; - float invMassV0{0.}; - std::array pVecV0 = {candV0.px(),candV0.py(),candV0.pz()}; - float ptV0 = RecoDecay::pt(pVecV0); - float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0,pVecD)); - switch (DecayChannel) { - case DecayChannel::Ds1toDstarK0s: - invMassV0 = candV0.invMassK0s(); - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); - registry.fill(HIST("hMassDs1"), sqrt(invMass2Reso), ptReso); - break; - case DecayChannel::Dstar2toDplusK0s: - invMassV0 = candV0.invMassK0s(); - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); - registry.fill(HIST("hMassDsStar2"), sqrt(invMass2Reso), ptReso); - break; - case DecayChannel::XctoDplusLambda: - if (candD.dType() > 0){ - invMassV0 = candV0.invMassLambda(); - } else { - invMassV0 = candV0.invMassAntiLambda(); - } - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); - registry.fill(HIST("hMassXcRes"), sqrt(invMass2Reso), ptReso); - break; - default: - break; + float invMass2Reso{0.}; + float invMassV0{0.}; + std::array pVecV0 = {candV0.px(), candV0.py(), candV0.pz()}; + float ptV0 = RecoDecay::pt(pVecV0); + float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0, pVecD)); + switch (DecayChannel) { + case DecayChannel::Ds1toDstarK0s: + invMassV0 = candV0.invMassK0s(); + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); + registry.fill(HIST("hMassDs1"), sqrt(invMass2Reso), ptReso); + break; + case DecayChannel::Dstar2toDplusK0s: + invMassV0 = candV0.invMassK0s(); + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); + registry.fill(HIST("hMassDsStar2"), sqrt(invMass2Reso), ptReso); + break; + case DecayChannel::XctoDplusLambda: + if (candD.dType() > 0) { + invMassV0 = candV0.invMassLambda(); + } else { + invMassV0 = candV0.invMassAntiLambda(); } - //Filling Output table - rowCandidateReso(collisions.globalIndex(), - sqrt(invMass2Reso), - ptReso, - invMassD, - ptD, - invMassV0, - ptV0, - candV0.cpa(), - candV0.dca(), - candV0.radius()); + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); + registry.fill(HIST("hMassXcRes"), sqrt(invMass2Reso), ptReso); + break; + default: + break; } - + // Filling Output table + rowCandidateReso(collisions.globalIndex(), + sqrt(invMass2Reso), + ptReso, + invMassD, + ptD, + invMassV0, + ptV0, + candV0.cpa(), + candV0.dca(), + candV0.radius()); + } } - }//main function + } // main function void processDstar2toDplusK0s(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { - runCandidateCreation(collision, candsD, candidatesK0s); + runCandidateCreation(collision, candsD, candidatesK0s); } PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDstar2toDplusK0s, "Process Dplus candidates without MC info and without ML info", true); - + void processDs1toDstarK0s(aod::HfRedCollisions::iterator const& collision, - aod::HfRed3PrNoTrks const& candsD, - aod::HfRedVzeros const& candsV0) + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) { - runCandidateCreation(collision, candsD, candidatesK0s); + runCandidateCreation(collision, candsD, candidatesK0s); } PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDs1toDstarK0s, "Process Dplus candidates without MC info and without ML info", false); void processXctoDplusLambda(aod::HfRedCollisions::iterator const& collision, - aod::HfRed3PrNoTrks const& candsD, - aod::HfRedVzeros const& candsV0) + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) { - runCandidateCreation(collision, candsD, candidatesLambda); + runCandidateCreation(collision, candsD, candidatesLambda); } PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processXctoDplusLambda, "Process Dplus candidates without MC info and without ML info", false); }; // struct diff --git a/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx index f2ac273a378..8580939610f 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx @@ -255,7 +255,7 @@ struct HfDataCreatorDV0Reduced { prongIdsD[0] = candD.prong0Id(); prongIdsD[1] = candD.prong1Id(); prongIdsD[2] = candD.prongPiId(); - dtype = candD.signSoftPi() * DType::Dstar; + dtype = candD.signSoftPi() * DType::Dstar; } else if constexpr (std::is_same::value) { auto prong0 = candD.template prong0_as(); invMassD = hfHelper.invMassDplusToPiKPi(candD); @@ -267,7 +267,7 @@ struct HfDataCreatorDV0Reduced { prongIdsD[0] = candD.prong0Id(); prongIdsD[1] = candD.prong1Id(); prongIdsD[2] = candD.prong2Id(); - dtype = (int8_t)(prong0.sign() * DType::Dplus); + dtype = (int8_t)(prong0.sign() * DType::Dplus); } // else if // Loop on V0 candidates From 9085230262ba9423248f7b71a882c67a0cb1a464 Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Wed, 13 Mar 2024 19:41:14 +0100 Subject: [PATCH 04/19] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx | 6 +++--- PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx index a9f5dec216d..fce83c344c1 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx @@ -110,7 +110,7 @@ struct HfCandidateCreatorDV0Reduced { massDstar = o2::constants::physics::MassDStar; } - template + template bool isDSelected(D const& candD) { float massD{0.}; @@ -149,7 +149,7 @@ struct HfCandidateCreatorDV0Reduced { return true; } - template + template void runCandidateCreation(C const& collisions, D const& candsD, V const& candsV0) @@ -223,7 +223,7 @@ struct HfCandidateCreatorDV0Reduced { } } // main function - void processDstar2toDplusK0s(aod::HfRedCollisions::iterator const& collision, + void processDstar2ToDplusK0s(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { diff --git a/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx index 8580939610f..5c1560b17dd 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx @@ -314,7 +314,7 @@ struct HfDataCreatorDV0Reduced { auto invMass2DV0 = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massD, massV0}); registry.fill(HIST("hMassLambda"), v0.mLambda()); if (DecayChannel == DecayChannel::DplusV0) { - registry.fill(HIST("hMassXcRes"), sqrt(invMass2DV0)); + registry.fill(HIST("hMassXcRes"), std::sqrt(invMass2DV0)); } } if (TESTBIT(v0type, AntiLambda)) { From b9491ac81c27cb0261705c4f5027830ffcbc5b16 Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Wed, 13 Mar 2024 19:57:34 +0100 Subject: [PATCH 05/19] Improving readability with suggested changes --- .../candidateCreatorDV0Reduced.cxx | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx index fce83c344c1..6a7ae0c2792 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx @@ -110,14 +110,14 @@ struct HfCandidateCreatorDV0Reduced { massDstar = o2::constants::physics::MassDStar; } - template - bool isDSelected(D const& candD) + template + bool isDSelected(DRedTable const& candD) { float massD{0.}; // slection on D candidate mass - if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::XctoDplusLambda) { + if (channel == DecayChannel::Dstar2toDplusK0s || channel == DecayChannel::XctoDplusLambda) { massD = massDplus; - } else if (DecayChannel == DecayChannel::Ds1toDstarK0s) { + } else if (channel == DecayChannel::Ds1toDstarK0s) { massD = massDstar; } if (std::fabs(candD.invMass() - massD) > invMassWindowD) { @@ -126,16 +126,16 @@ struct HfCandidateCreatorDV0Reduced { return true; } - template - bool isV0Selected(V const& candV0, D const& candD) + template + bool isV0Selected(V0RedTable const& candV0, DRedTable const& candD) { float massV0{0.}; float invMassV0{0.}; // slection on V0 candidate mass - if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::Ds1toDstarK0s) { + if (channel == DecayChannel::Dstar2toDplusK0s || channel == DecayChannel::Ds1toDstarK0s) { massV0 = massK0; invMassV0 = candV0.invMassK0s(); - } else if (DecayChannel == DecayChannel::XctoDplusLambda) { + } else if (channel == DecayChannel::XctoDplusLambda) { massV0 = massLambda; if (candD.dType() > 0) { invMassV0 = candV0.invMassLambda(); @@ -149,10 +149,10 @@ struct HfCandidateCreatorDV0Reduced { return true; } - template - void runCandidateCreation(C const& collisions, - D const& candsD, - V const& candsV0) + template + void runCandidateCreation(Coll const& collisions, + DRedTable const& candsD, + V0RedTable const& candsV0) { // loop on D candidates for (const auto& candD : candsD) { @@ -160,7 +160,7 @@ struct HfCandidateCreatorDV0Reduced { if (activateQA) { registry.fill(HIST("hSelections"), 1); } - if (!isDSelected(candD)) { + if (!isDSelected(candD)) { continue; } if (activateQA) { @@ -173,7 +173,7 @@ struct HfCandidateCreatorDV0Reduced { // loop on V0 candidates bool already_counted{false}; for (const auto& candV0 : candsV0) { - if (!isV0Selected(candV0, candD)) { + if (!isV0Selected(candV0, candD)) { continue; } if (activateQA && !already_counted) { @@ -185,16 +185,16 @@ struct HfCandidateCreatorDV0Reduced { std::array pVecV0 = {candV0.px(), candV0.py(), candV0.pz()}; float ptV0 = RecoDecay::pt(pVecV0); float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0, pVecD)); - switch (DecayChannel) { + switch (channel) { case DecayChannel::Ds1toDstarK0s: invMassV0 = candV0.invMassK0s(); invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); - registry.fill(HIST("hMassDs1"), sqrt(invMass2Reso), ptReso); + registry.fill(HIST("hMassDs1"), std::sqrt(invMass2Reso), ptReso); break; case DecayChannel::Dstar2toDplusK0s: invMassV0 = candV0.invMassK0s(); invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); - registry.fill(HIST("hMassDsStar2"), sqrt(invMass2Reso), ptReso); + registry.fill(HIST("hMassDsStar2"), std::sqrt(invMass2Reso), ptReso); break; case DecayChannel::XctoDplusLambda: if (candD.dType() > 0) { @@ -203,14 +203,14 @@ struct HfCandidateCreatorDV0Reduced { invMassV0 = candV0.invMassAntiLambda(); } invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); - registry.fill(HIST("hMassXcRes"), sqrt(invMass2Reso), ptReso); + registry.fill(HIST("hMassXcRes"), std::sqrt(invMass2Reso), ptReso); break; default: break; } // Filling Output table rowCandidateReso(collisions.globalIndex(), - sqrt(invMass2Reso), + std::sqrt(invMass2Reso), ptReso, invMassD, ptD, @@ -229,23 +229,23 @@ struct HfCandidateCreatorDV0Reduced { { runCandidateCreation(collision, candsD, candidatesK0s); } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDstar2toDplusK0s, "Process Dplus candidates without MC info and without ML info", true); + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDstar2toDplusK0s, "Process Dstar2 candidates without MC info and without ML info", true); - void processDs1toDstarK0s(aod::HfRedCollisions::iterator const& collision, + void processDs1ToDstarK0s(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { runCandidateCreation(collision, candsD, candidatesK0s); } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDs1toDstarK0s, "Process Dplus candidates without MC info and without ML info", false); + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDs1toDstarK0s, "Process Ds1 candidates without MC info and without ML info", false); - void processXctoDplusLambda(aod::HfRedCollisions::iterator const& collision, + void processXcToDplusLambda(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { runCandidateCreation(collision, candsD, candidatesLambda); } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processXctoDplusLambda, "Process Dplus candidates without MC info and without ML info", false); + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processXctoDplusLambda, "Process Xc candidates without MC info and without ML info", false); }; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 4a55b1c52c6d435f0fddfe859170251b63c6617f Mon Sep 17 00:00:00 2001 From: Luca Aglietta Date: Thu, 14 Mar 2024 17:06:14 +0100 Subject: [PATCH 06/19] fixed typo --- .../candidateCreatorDV0Reduced.cxx | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx index 6a7ae0c2792..bd7326b51e9 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx @@ -36,9 +36,9 @@ enum Selections : uint8_t { NSelSteps }; enum DecayChannel : uint8_t { - Ds1toDstarK0s = 0, - Dstar2toDplusK0s, - XctoDplusLambda + Ds1ToDstarK0s = 0, + Dstar2ToDplusK0s, + XcToDplusLambda }; enum V0Type : uint8_t { K0s = 0, @@ -115,9 +115,9 @@ struct HfCandidateCreatorDV0Reduced { { float massD{0.}; // slection on D candidate mass - if (channel == DecayChannel::Dstar2toDplusK0s || channel == DecayChannel::XctoDplusLambda) { + if (channel == DecayChannel::Dstar2ToDplusK0s || channel == DecayChannel::XcToDplusLambda) { massD = massDplus; - } else if (channel == DecayChannel::Ds1toDstarK0s) { + } else if (channel == DecayChannel::Ds1ToDstarK0s) { massD = massDstar; } if (std::fabs(candD.invMass() - massD) > invMassWindowD) { @@ -132,10 +132,10 @@ struct HfCandidateCreatorDV0Reduced { float massV0{0.}; float invMassV0{0.}; // slection on V0 candidate mass - if (channel == DecayChannel::Dstar2toDplusK0s || channel == DecayChannel::Ds1toDstarK0s) { + if (channel == DecayChannel::Dstar2ToDplusK0s || channel == DecayChannel::Ds1ToDstarK0s) { massV0 = massK0; invMassV0 = candV0.invMassK0s(); - } else if (channel == DecayChannel::XctoDplusLambda) { + } else if (channel == DecayChannel::XcToDplusLambda) { massV0 = massLambda; if (candD.dType() > 0) { invMassV0 = candV0.invMassLambda(); @@ -186,17 +186,17 @@ struct HfCandidateCreatorDV0Reduced { float ptV0 = RecoDecay::pt(pVecV0); float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0, pVecD)); switch (channel) { - case DecayChannel::Ds1toDstarK0s: + case DecayChannel::Ds1ToDstarK0s: invMassV0 = candV0.invMassK0s(); invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); registry.fill(HIST("hMassDs1"), std::sqrt(invMass2Reso), ptReso); break; - case DecayChannel::Dstar2toDplusK0s: + case DecayChannel::Dstar2ToDplusK0s: invMassV0 = candV0.invMassK0s(); invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); registry.fill(HIST("hMassDsStar2"), std::sqrt(invMass2Reso), ptReso); break; - case DecayChannel::XctoDplusLambda: + case DecayChannel::XcToDplusLambda: if (candD.dType() > 0) { invMassV0 = candV0.invMassLambda(); } else { @@ -227,25 +227,25 @@ struct HfCandidateCreatorDV0Reduced { aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { - runCandidateCreation(collision, candsD, candidatesK0s); + runCandidateCreation(collision, candsD, candidatesK0s); } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDstar2toDplusK0s, "Process Dstar2 candidates without MC info and without ML info", true); + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDstar2ToDplusK0s, "Process Dstar2 candidates without MC info and without ML info", true); void processDs1ToDstarK0s(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { - runCandidateCreation(collision, candsD, candidatesK0s); + runCandidateCreation(collision, candsD, candidatesK0s); } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDs1toDstarK0s, "Process Ds1 candidates without MC info and without ML info", false); + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDs1ToDstarK0s, "Process Ds1 candidates without MC info and without ML info", false); void processXcToDplusLambda(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { - runCandidateCreation(collision, candsD, candidatesLambda); + runCandidateCreation(collision, candsD, candidatesLambda); } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processXctoDplusLambda, "Process Xc candidates without MC info and without ML info", false); + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processXcToDplusLambda, "Process Xc candidates without MC info and without ML info", false); }; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 9d9bbc2ae5df488b7f66d0b577aa7bba239c07e6 Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:31:32 +0100 Subject: [PATCH 07/19] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera Co-authored-by: Fabrizio --- .../candidateCreatorDV0Reduced.cxx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx index bd7326b51e9..2cd01e63407 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx @@ -13,6 +13,7 @@ /// \brief Reconstruction of Resonance candidates /// /// \author Luca Aglietta , Università degli Studi di Torino + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" @@ -37,7 +38,7 @@ enum Selections : uint8_t { }; enum DecayChannel : uint8_t { Ds1ToDstarK0s = 0, - Dstar2ToDplusK0s, + Ds2StarToDplusK0s, XcToDplusLambda }; enum V0Type : uint8_t { @@ -60,7 +61,8 @@ auto vecBins = std::vector{binsPt, binsPt + nBins + 1}; struct HfCandidateCreatorDV0Reduced { // Produces: Tables with resonance info Produces rowCandidateReso; - // Configurables + + // Configurables Configurable invMassWindowD{"invMassWindowD", 0.5, "invariant-mass window for D candidates (GeV/c2)"}; Configurable invMassWindowV0{"invMassWindowV0", 0.5, "invariant-mass window for V0 candidates (GeV/c2)"}; // QA switch @@ -89,7 +91,7 @@ struct HfCandidateCreatorDV0Reduced { const AxisSpec axisPt{(std::vector)vecBins, "#it{p}_{T} (GeV/#it{c})"}; // histograms registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDs2Star", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); if (activateQA) { constexpr int kNBinsSelections = Selections::NSelSteps; @@ -115,7 +117,7 @@ struct HfCandidateCreatorDV0Reduced { { float massD{0.}; // slection on D candidate mass - if (channel == DecayChannel::Dstar2ToDplusK0s || channel == DecayChannel::XcToDplusLambda) { + if (channel == DecayChannel::Ds2StarToDplusK0s || channel == DecayChannel::XcToDplusLambda) { massD = massDplus; } else if (channel == DecayChannel::Ds1ToDstarK0s) { massD = massDstar; @@ -171,7 +173,7 @@ struct HfCandidateCreatorDV0Reduced { float ptD = RecoDecay::pt(pVecD); ; // loop on V0 candidates - bool already_counted{false}; + bool alreadyCounted{false}; for (const auto& candV0 : candsV0) { if (!isV0Selected(candV0, candD)) { continue; @@ -188,13 +190,13 @@ struct HfCandidateCreatorDV0Reduced { switch (channel) { case DecayChannel::Ds1ToDstarK0s: invMassV0 = candV0.invMassK0s(); - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); - registry.fill(HIST("hMassDs1"), std::sqrt(invMass2Reso), ptReso); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); + registry.fill(HIST("hMassDs1"), invMassReso, ptReso); break; - case DecayChannel::Dstar2ToDplusK0s: + case DecayChannel::Ds2StarToDplusK0s: invMassV0 = candV0.invMassK0s(); invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); - registry.fill(HIST("hMassDsStar2"), std::sqrt(invMass2Reso), ptReso); + registry.fill(HIST("hMassDs2Star"), std::sqrt(invMass2Reso), ptReso); break; case DecayChannel::XcToDplusLambda: if (candD.dType() > 0) { From 4fba39f5ea68590b481247fcd381b7ecc3a3b219 Mon Sep 17 00:00:00 2001 From: Luca Aglietta Date: Fri, 15 Mar 2024 13:54:51 +0100 Subject: [PATCH 08/19] changed task names and implemented suggested changes --- PWGHF/D2H/TableProducer/CMakeLists.txt | 8 ++-- ...x => candidateCreatorCharmResoReduced.cxx} | 38 +++++++++++-------- ...ed.cxx => dataCreatorCharmResoReduced.cxx} | 24 ++++++------ 3 files changed, 38 insertions(+), 32 deletions(-) rename PWGHF/D2H/TableProducer/{candidateCreatorDV0Reduced.cxx => candidateCreatorCharmResoReduced.cxx} (85%) rename PWGHF/D2H/TableProducer/{dataCreatorDV0Reduced.cxx => dataCreatorCharmResoReduced.cxx} (95%) diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index 6f3ae2f13cd..19cf1d44e5f 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -21,8 +21,8 @@ o2physics_add_dpl_workflow(candidate-creator-bplus-reduced PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(candidate-creator-d-v0-reduced - SOURCES candidateCreatorDV0Reduced.cxx +o2physics_add_dpl_workflow(candidate-creator-charm-reso-reduced + SOURCES candidateCreatorCharmResoReduced.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) @@ -45,8 +45,8 @@ o2physics_add_dpl_workflow(data-creator-charm-had-pi-reduced PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(data-creator-d-v0-reduced - SOURCES dataCreatorDV0Reduced.cxx +o2physics_add_dpl_workflow(data-creator-charm-reso-reduced + SOURCES dataCreatorCharmResoReduced.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx similarity index 85% rename from PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx rename to PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index 2cd01e63407..ff8b8fb1436 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx @@ -58,7 +58,7 @@ constexpr double binsPt[nBins + 1] = { 50.}; auto vecBins = std::vector{binsPt, binsPt + nBins + 1}; -struct HfCandidateCreatorDV0Reduced { +struct HfCandidateCreatorCharmResoReduced { // Produces: Tables with resonance info Produces rowCandidateReso; @@ -134,15 +134,21 @@ struct HfCandidateCreatorDV0Reduced { float massV0{0.}; float invMassV0{0.}; // slection on V0 candidate mass - if (channel == DecayChannel::Dstar2ToDplusK0s || channel == DecayChannel::Ds1ToDstarK0s) { + if (channel == DecayChannel::Ds2StarToDplusK0s || channel == DecayChannel::Ds1ToDstarK0s) { massV0 = massK0; invMassV0 = candV0.invMassK0s(); } else if (channel == DecayChannel::XcToDplusLambda) { massV0 = massLambda; + uint8_t targetV0Type{0}; if (candD.dType() > 0) { invMassV0 = candV0.invMassLambda(); + targetV0Type = V0Type::Lambda; } else { invMassV0 = candV0.invMassAntiLambda(); + targetV0Type = V0Type::AntiLambda; + } + if (!TESTBIT(candV0.v0Type(),targetV0Type)) { + return false; } } if (std::fabs(invMassV0 - massV0) > invMassWindowV0) { @@ -178,11 +184,11 @@ struct HfCandidateCreatorDV0Reduced { if (!isV0Selected(candV0, candD)) { continue; } - if (activateQA && !already_counted) { + if (activateQA && !alreadyCounted) { registry.fill(HIST("hSelections"), 1 + Selections::V0Sel); - already_counted = true; + alreadyCounted = true; } - float invMass2Reso{0.}; + float invMassReso{0.}; float invMassV0{0.}; std::array pVecV0 = {candV0.px(), candV0.py(), candV0.pz()}; float ptV0 = RecoDecay::pt(pVecV0); @@ -195,8 +201,8 @@ struct HfCandidateCreatorDV0Reduced { break; case DecayChannel::Ds2StarToDplusK0s: invMassV0 = candV0.invMassK0s(); - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); - registry.fill(HIST("hMassDs2Star"), std::sqrt(invMass2Reso), ptReso); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); + registry.fill(HIST("hMassDs2Star"), invMassReso, ptReso); break; case DecayChannel::XcToDplusLambda: if (candD.dType() > 0) { @@ -204,15 +210,15 @@ struct HfCandidateCreatorDV0Reduced { } else { invMassV0 = candV0.invMassAntiLambda(); } - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); - registry.fill(HIST("hMassXcRes"), std::sqrt(invMass2Reso), ptReso); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); + registry.fill(HIST("hMassXcRes"), invMassReso, ptReso); break; default: break; } // Filling Output table rowCandidateReso(collisions.globalIndex(), - std::sqrt(invMass2Reso), + invMassReso, ptReso, invMassD, ptD, @@ -225,13 +231,13 @@ struct HfCandidateCreatorDV0Reduced { } } // main function - void processDstar2ToDplusK0s(aod::HfRedCollisions::iterator const& collision, + void processDs2StarToDplusK0s(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { - runCandidateCreation(collision, candsD, candidatesK0s); + runCandidateCreation(collision, candsD, candidatesK0s); } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDstar2ToDplusK0s, "Process Dstar2 candidates without MC info and without ML info", true); + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs2StarToDplusK0s, "Process Ds2* candidates without MC info and without ML info", true); void processDs1ToDstarK0s(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, @@ -239,7 +245,7 @@ struct HfCandidateCreatorDV0Reduced { { runCandidateCreation(collision, candsD, candidatesK0s); } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDs1ToDstarK0s, "Process Ds1 candidates without MC info and without ML info", false); + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0s, "Process Ds1 candidates without MC info and without ML info", false); void processXcToDplusLambda(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, @@ -247,10 +253,10 @@ struct HfCandidateCreatorDV0Reduced { { runCandidateCreation(collision, candsD, candidatesLambda); } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processXcToDplusLambda, "Process Xc candidates without MC info and without ML info", false); + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processXcToDplusLambda, "Process Xc candidates without MC info and without ML info", false); }; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx similarity index 95% rename from PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx rename to PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index 5c1560b17dd..8a136b10437 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file dataCreatorDV0Reduced.cxx +/// \file dataCreatorCharmResoReduced.cxx /// \brief Creation of D-V0 pairs /// /// \author Luca Aglietta , UniTO Turin @@ -68,7 +68,7 @@ enum DType : uint8_t { }; /// Creation of D-V0 pairs -struct HfDataCreatorDV0Reduced { +struct HfDataCreatorCharmResoReduced { // Produces AOD tables to store track information Produces hfReducedCollision; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h Produces hfCollisionCounter; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h @@ -296,14 +296,14 @@ struct HfDataCreatorDV0Reduced { registry.fill(HIST("hV0Type"), v0type); if (TESTBIT(v0type, K0s)) { massV0 = MassK0; - auto invMass2DV0 = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massD, massV0}); + auto invMassDV0 = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massD, massV0}); registry.fill(HIST("hMassK0s"), v0.mK0Short()); switch (DecayChannel) { case DecayChannel::DstarV0: - registry.fill(HIST("hMassDs1"), sqrt(invMass2DV0)); + registry.fill(HIST("hMassDs1"), invMassDV0); break; case DecayChannel::DplusV0: - registry.fill(HIST("hMassDsStar2"), sqrt(invMass2DV0)); + registry.fill(HIST("hMassDsStar2"), invMassDV0); break; default: break; @@ -311,18 +311,18 @@ struct HfDataCreatorDV0Reduced { } if (TESTBIT(v0type, Lambda)) { massV0 = MassLambda0; - auto invMass2DV0 = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massD, massV0}); + auto invMassDV0 = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massD, massV0}); registry.fill(HIST("hMassLambda"), v0.mLambda()); if (DecayChannel == DecayChannel::DplusV0) { - registry.fill(HIST("hMassXcRes"), std::sqrt(invMass2DV0)); + registry.fill(HIST("hMassXcRes"), invMassDV0); } } if (TESTBIT(v0type, AntiLambda)) { massV0 = MassLambda0; - auto invMass2DV0 = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massD, massV0}); + auto invMassDV0 = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massD, massV0}); registry.fill(HIST("hMassLambda"), v0.mAntiLambda()); if (DecayChannel == DecayChannel::DplusV0) { - registry.fill(HIST("hMassXcRes"), sqrt(invMass2DV0)); + registry.fill(HIST("hMassXcRes"), invMassDV0); } } // fill V0 table @@ -392,7 +392,7 @@ struct HfDataCreatorDV0Reduced { runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); } } - PROCESS_SWITCH(HfDataCreatorDV0Reduced, processDplusV0, "Process Dplus candidates without MC info and without ML info", true); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0, "Process Dplus candidates without MC info and without ML info", true); void processDstarV0(aod::Collisions const& collisions, CandDstarFiltered const& candsDstar, @@ -411,10 +411,10 @@ struct HfDataCreatorDV0Reduced { runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); } } - PROCESS_SWITCH(HfDataCreatorDV0Reduced, processDstarV0, "Process DStar candidates without MC info and without ML info", false); + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0, "Process DStar candidates without MC info and without ML info", false); }; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From deae9e58d125660164d48999217097cab8041da1 Mon Sep 17 00:00:00 2001 From: Luca Aglietta Date: Mon, 18 Mar 2024 17:06:19 +0100 Subject: [PATCH 09/19] implemented suggested changes on dataCreatorCharmResoReduced --- .../dataCreatorCharmResoReduced.cxx | 43 ++++++++----------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index 8a136b10437..5ce026316b4 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -156,11 +156,13 @@ struct HfDataCreatorCharmResoReduced { /// Basic selection of V0 candidates /// \param v0 is the v0 candidate /// \param collision is the current collision + /// \param dauTracks are the v0 daughter tracks + /// \param dDaughtersIDs are the IDs of the D meson daughter tracks /// \return a bitmap with mass hypotesis if passes all cuts template inline uint8_t getSelectionMapV0(const V0& v0, const Coll& collision, const std::array& dauTracks, const std::array& dDaughtersIDs) { - uint8_t isSelected{BIT(K0s) | BIT(Lambda) | BIT(AntiLambda)}; + uint8_t selMap{BIT(K0s) | BIT(Lambda) | BIT(AntiLambda)}; // reject VOs that share daughters with D if (std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), v0.posTrackId()) != dDaughtersIDs.end() || std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), v0.negTrackId()) != dDaughtersIDs.end()) { return 0; @@ -183,25 +185,25 @@ struct HfDataCreatorCharmResoReduced { return 0; } // mass hypotesis - if (TESTBIT(isSelected, K0s) && std::fabs(v0.mK0Short() - MassK0) > deltaMassK0s) { - CLRBIT(isSelected, K0s); + if (std::fabs(v0.mK0Short() - MassK0) > deltaMassK0s) { + CLRBIT(selMap, K0s); } - if (TESTBIT(isSelected, Lambda) && std::fabs(v0.mLambda() - MassLambda0) > deltaMassLambda) { - CLRBIT(isSelected, Lambda); + if (std::fabs(v0.mLambda() - MassLambda0) > deltaMassLambda) { + CLRBIT(selMap, Lambda); } - if (TESTBIT(isSelected, AntiLambda) && std::fabs(v0.mAntiLambda() - MassLambda0) > deltaMassLambda) { - CLRBIT(isSelected, AntiLambda); + if (std::fabs(v0.mAntiLambda() - MassLambda0) > deltaMassLambda) { + CLRBIT(selMap, AntiLambda); } // PID (Lambda/AntiLambda only) float nSigmaPrTpc[2] = {dauTracks[0].tpcNSigmaPr(), dauTracks[1].tpcNSigmaPr()}; float nSigmaPrTof[2] = {dauTracks[0].tofNSigmaPr(), dauTracks[1].tofNSigmaPr()}; - if (TESTBIT(isSelected, Lambda) && ((dauTracks[0].hasTPC() && std::fabs(nSigmaPrTpc[0]) > maxNsigmaPrForLambda) || (dauTracks[0].hasTOF() && std::fabs(nSigmaPrTof[0]) > maxNsigmaPrForLambda))) { - CLRBIT(isSelected, Lambda); + if (TESTBIT(selMap, Lambda) && ((dauTracks[0].hasTPC() && std::fabs(nSigmaPrTpc[0]) > maxNsigmaPrForLambda) || (dauTracks[0].hasTOF() && std::fabs(nSigmaPrTof[0]) > maxNsigmaPrForLambda))) { + CLRBIT(selMap, Lambda); } - if (TESTBIT(isSelected, AntiLambda) && ((dauTracks[1].hasTPC() && std::fabs(nSigmaPrTpc[1]) > maxNsigmaPrForLambda) || (dauTracks[1].hasTOF() && std::fabs(nSigmaPrTof[1]) > maxNsigmaPrForLambda))) { - CLRBIT(isSelected, AntiLambda); + if (TESTBIT(selMap, AntiLambda) && ((dauTracks[1].hasTPC() && std::fabs(nSigmaPrTpc[1]) > maxNsigmaPrForLambda) || (dauTracks[1].hasTOF() && std::fabs(nSigmaPrTof[1]) > maxNsigmaPrForLambda))) { + CLRBIT(selMap, AntiLambda); } - return isSelected; + return selMap; } template @@ -218,18 +220,8 @@ struct HfDataCreatorCharmResoReduced { std::map selectedV0s; bool fillHfReducedCollision = false; auto bc = collision.bc_as(); - if (runNumber != bc.runNumber()) { - LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; - o2::parameters::GRPMagField* grpo = ccdb->getForTimeStamp(ccdbPathGrpMag, bc.timestamp()); - if (grpo == nullptr) { - LOGF(fatal, "Run 3 GRP object (type o2::parameters::GRPMagField) is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp()); - } - o2::base::Propagator::initFieldFromGRP(grpo); - // setMatLUT only after magfield has been initalized - o2::base::Propagator::Instance()->setMatLUT(lut); - runNumber = bc.runNumber(); - } - + initCCDB(bc, runNumber, ccdb, ccdbPathGrpMag, lut, false); + // loop on D candidates for (const auto& candD : candsD) { // initialize variables depending on decay channel bool fillHfCandD = false; @@ -241,7 +233,6 @@ struct HfDataCreatorCharmResoReduced { std::array prongIdsD; uint8_t v0type; int8_t dtype; - if constexpr (std::is_same::value) { if (candD.signSoftPi() > 0) invMassD = candD.invMassDstar(); @@ -267,7 +258,7 @@ struct HfDataCreatorCharmResoReduced { prongIdsD[0] = candD.prong0Id(); prongIdsD[1] = candD.prong1Id(); prongIdsD[2] = candD.prong2Id(); - dtype = (int8_t)(prong0.sign() * DType::Dplus); + dtype = static_cast(prong0.sign() * DType::Dplus); } // else if // Loop on V0 candidates From 3649d98482658ced49662024fb2eb52815caffa3 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 18 Mar 2024 16:07:42 +0000 Subject: [PATCH 10/19] Please consider the following formatting changes --- .../TableProducer/candidateCreatorCharmResoReduced.cxx | 8 ++++---- PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index ff8b8fb1436..f4ce8254687 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx @@ -62,7 +62,7 @@ struct HfCandidateCreatorCharmResoReduced { // Produces: Tables with resonance info Produces rowCandidateReso; - // Configurables + // Configurables Configurable invMassWindowD{"invMassWindowD", 0.5, "invariant-mass window for D candidates (GeV/c2)"}; Configurable invMassWindowV0{"invMassWindowV0", 0.5, "invariant-mass window for V0 candidates (GeV/c2)"}; // QA switch @@ -147,7 +147,7 @@ struct HfCandidateCreatorCharmResoReduced { invMassV0 = candV0.invMassAntiLambda(); targetV0Type = V0Type::AntiLambda; } - if (!TESTBIT(candV0.v0Type(),targetV0Type)) { + if (!TESTBIT(candV0.v0Type(), targetV0Type)) { return false; } } @@ -232,8 +232,8 @@ struct HfCandidateCreatorCharmResoReduced { } // main function void processDs2StarToDplusK0s(aod::HfRedCollisions::iterator const& collision, - aod::HfRed3PrNoTrks const& candsD, - aod::HfRedVzeros const& candsV0) + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) { runCandidateCreation(collision, candsD, candidatesK0s); } diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index 5ce026316b4..a1e9defaa17 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -157,7 +157,7 @@ struct HfDataCreatorCharmResoReduced { /// \param v0 is the v0 candidate /// \param collision is the current collision /// \param dauTracks are the v0 daughter tracks - /// \param dDaughtersIDs are the IDs of the D meson daughter tracks + /// \param dDaughtersIDs are the IDs of the D meson daughter tracks /// \return a bitmap with mass hypotesis if passes all cuts template inline uint8_t getSelectionMapV0(const V0& v0, const Coll& collision, const std::array& dauTracks, const std::array& dDaughtersIDs) From 5ab1c7139f2a391b4ff976ea9bc8615b51d0f107 Mon Sep 17 00:00:00 2001 From: luagliet Date: Fri, 22 Mar 2024 14:28:56 +0100 Subject: [PATCH 11/19] changed PID logic in Dplus Candidate Creator from TPC and TOF to TPC or TOF, added nSigmaCombined to Dplus Tree creator --- .../candidateSelectorDplusToPiKPi.cxx | 10 ++---- .../TableProducer/treeCreatorDplusToPiKPi.cxx | 32 ++++++++++++++++++- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx index fc20e740b00..390c29e573f 100644 --- a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx @@ -43,12 +43,10 @@ struct HfCandidateSelectorDplusToPiKPi { Configurable ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"}; Configurable ptPidTpcMax{"ptPidTpcMax", 20., "Upper bound of track pT for TPC PID"}; Configurable nSigmaTpcMax{"nSigmaTpcMax", 3., "Nsigma cut on TPC"}; - Configurable nSigmaTpcCombinedMax{"nSigmaTpcCombinedMax", 3., "Nsigma cut on TPC combined with TOF"}; // TOF PID Configurable ptPidTofMin{"ptPidTofMin", 0.15, "Lower bound of track pT for TOF PID"}; Configurable ptPidTofMax{"ptPidTofMax", 20., "Upper bound of track pT for TOF PID"}; Configurable nSigmaTofMax{"nSigmaTofMax", 3., "Nsigma cut on TOF"}; - Configurable nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 3., "Nsigma cut on TOF combined with TPC"}; // topological cuts Configurable> binsPt{"binsPt", std::vector{hf_cuts_dplus_to_pi_k_pi::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_dplus_to_pi_k_pi::cuts[0], hf_cuts_dplus_to_pi_k_pi::nBinsPt, hf_cuts_dplus_to_pi_k_pi::nCutVars, hf_cuts_dplus_to_pi_k_pi::labelsPt, hf_cuts_dplus_to_pi_k_pi::labelsCutVar}, "Dplus candidate selection per pT bin"}; @@ -84,10 +82,8 @@ struct HfCandidateSelectorDplusToPiKPi { { selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax); selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax); - selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax); selectorPion.setRangePtTof(ptPidTofMin, ptPidTofMax); selectorPion.setRangeNSigmaTof(-nSigmaTofMax, nSigmaTofMax); - selectorPion.setRangeNSigmaTofCondTpc(-nSigmaTofCombinedMax, nSigmaTofCombinedMax); selectorKaon = selectorPion; if (activateQA) { @@ -230,9 +226,9 @@ struct HfCandidateSelectorDplusToPiKPi { } // track-level PID selection - int pidTrackPos1Pion = selectorPion.statusTpcAndTof(trackPos1); - int pidTrackNegKaon = selectorKaon.statusTpcAndTof(trackNeg); - int pidTrackPos2Pion = selectorPion.statusTpcAndTof(trackPos2); + int pidTrackPos1Pion = selectorPion.statusTpcOrTof(trackPos1); + int pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg); + int pidTrackPos2Pion = selectorPion.statusTpcOrTof(trackPos2); if (!selectionPID(pidTrackPos1Pion, pidTrackNegKaon, pidTrackPos2Pion)) { // exclude D± hfSelDplusToPiKPiCandidate(statusDplusToPiKPi); diff --git a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx index 90cc819e9ea..b5c72dfaa1c 100644 --- a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx @@ -62,6 +62,12 @@ DECLARE_SOA_COLUMN(NSigTpcPi2, nSigTpcPi2, float); DECLARE_SOA_COLUMN(NSigTpcKa2, nSigTpcKa2, float); //! TPC Nsigma separation for prong2 with kaon mass hypothesis DECLARE_SOA_COLUMN(NSigTofPi2, nSigTofPi2, float); //! TOF Nsigma separation for prong2 with pion mass hypothesis DECLARE_SOA_COLUMN(NSigTofKa2, nSigTofKa2, float); //! TOF Nsigma separation for prong2 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPi0, nSigTpcTofPi0, float); //! TPC and TOF combined Nsigma separation for prong0 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKa0, nSigTpcTofKa0, float); //! TPC and TOF combined Nsigma separation for prong0 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPi1, nSigTpcTofPi1, float); //! TPC and TOF combined Nsigma separation for prong1 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKa1, nSigTpcTofKa1, float); //! TPC and TOF combined Nsigma separation for prong1 with kaon mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofPi2, nSigTpcTofPi2, float); //! TPC and TOF combined Nsigma separation for prong2 with pion mass hypothesis +DECLARE_SOA_COLUMN(NSigTpcTofKa2, nSigTpcTofKa2, float); //! TPC and TOF combined Nsigma separation for prong2 with kaon mass hypothesis DECLARE_SOA_COLUMN(DecayLength, decayLength, float); //! Decay length of candidate (cm) DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); //! Transverse decay length of candidate (cm) DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float); //! Normalised decay length of candidate @@ -91,14 +97,20 @@ DECLARE_SOA_TABLE(HfCandDpLites, "AOD", "HFCANDDPLITE", full::NSigTpcKa0, full::NSigTofPi0, full::NSigTofKa0, + full::NSigTpcTofPi0, + full::NSigTpcTofKa0, full::NSigTpcPi1, full::NSigTpcKa1, full::NSigTofPi1, full::NSigTofKa1, + full::NSigTpcTofPi1, + full::NSigTpcTofKa1, full::NSigTpcPi2, full::NSigTpcKa2, full::NSigTofPi2, full::NSigTofKa2, + full::NSigTpcTofPi2, + full::NSigTpcTofKa2, full::CandidateSelFlag, full::M, full::Pt, @@ -156,14 +168,20 @@ DECLARE_SOA_TABLE(HfCandDpFulls, "AOD", "HFCANDDPFULL", full::NSigTpcKa0, full::NSigTofPi0, full::NSigTofKa0, + full::NSigTpcTofPi0, + full::NSigTpcTofKa0, full::NSigTpcPi1, full::NSigTpcKa1, full::NSigTofPi1, full::NSigTofKa1, + full::NSigTpcTofPi1, + full::NSigTpcTofKa1, full::NSigTpcPi2, full::NSigTpcKa2, full::NSigTofPi2, full::NSigTofKa2, + full::NSigTpcTofPi2, + full::NSigTpcTofKa2, full::CandidateSelFlag, full::M, full::Pt, @@ -217,7 +235,7 @@ struct HfTreeCreatorDplusToPiKPi { using SelectedCandidatesMc = soa::Filtered>; using MatchedGenCandidatesMc = soa::Filtered>; - using TracksWPid = soa::Join; + using TracksWPid = soa::Join; Filter filterSelectCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus; Filter filterMcGenMatching = nabs(o2::aod::hf_cand_3prong::flagMcMatchGen) == static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi)); @@ -273,14 +291,20 @@ struct HfTreeCreatorDplusToPiKPi { prong0.tpcNSigmaKa(), prong0.tofNSigmaPi(), prong0.tofNSigmaKa(), + prong0.tpcTofNSigmaPi(), + prong0.tpcTofNSigmaKa(), prong1.tpcNSigmaPi(), prong1.tpcNSigmaKa(), prong1.tofNSigmaPi(), prong1.tofNSigmaKa(), + prong1.tpcTofNSigmaPi(), + prong1.tpcTofNSigmaKa(), prong2.tpcNSigmaPi(), prong2.tpcNSigmaKa(), prong2.tofNSigmaPi(), prong2.tofNSigmaKa(), + prong2.tpcTofNSigmaPi(), + prong2.tpcTofNSigmaKa(), candidate.isSelDplusToPiKPi(), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), @@ -338,14 +362,20 @@ struct HfTreeCreatorDplusToPiKPi { prong0.tpcNSigmaKa(), prong0.tofNSigmaPi(), prong0.tofNSigmaKa(), + prong0.tpcTofNSigmaPi(), + prong0.tpcTofNSigmaKa(), prong1.tpcNSigmaPi(), prong1.tpcNSigmaKa(), prong1.tofNSigmaPi(), prong1.tofNSigmaKa(), + prong1.tpcTofNSigmaPi(), + prong1.tpcTofNSigmaKa(), prong2.tpcNSigmaPi(), prong2.tpcNSigmaKa(), prong2.tofNSigmaPi(), prong2.tofNSigmaKa(), + prong2.tpcTofNSigmaPi(), + prong2.tpcTofNSigmaKa(), candidate.isSelDplusToPiKPi(), hfHelper.invMassDplusToPiKPi(candidate), candidate.pt(), From 6d01e7595436be0cf99c28e5e79f5d8bb38ff831 Mon Sep 17 00:00:00 2001 From: Luca Aglietta Date: Wed, 13 Mar 2024 17:05:07 +0100 Subject: [PATCH 12/19] candidate creator for charmed resonances --- PWGHF/D2H/DataModel/ReducedDataModel.h | 10 +- .../candidateCreatorDV0Reduced.cxx | 254 ++++++++++++++++++ 2 files changed, 259 insertions(+), 5 deletions(-) create mode 100644 PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 6e3f2da1da7..9943bbea452 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -394,11 +394,11 @@ DECLARE_SOA_COLUMN(Dca, dca, float); //! DCA of V0 candidate DECLARE_SOA_COLUMN(Radius, radius, float); //! Radius of V0 candidate DECLARE_SOA_COLUMN(V0Type, v0Type, uint8_t); //! Bitmap with mass hypothesis of the V0 DECLARE_SOA_COLUMN(DType, dType, int8_t); //! Integer with selected D candidate type: 1 = Dplus, -1 = Dminus, 2 = DstarPlus, -2 = DstarMinus -DECLARE_SOA_COLUMN(Pt, pt, float); //! Pt of Resonance candidate in GeV/c -DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Pt of D daughter in GeV/c -DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Pt of V0 daughter in GeV/c -DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c -DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c +DECLARE_SOA_COLUMN(Pt, pt, float); //! Pt of Resonance candidate in GeV/c +DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Pt of D daughter in GeV/c +DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Pt of V0 daughter in GeV/c +DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c +DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c } // namespace hf_reso_cand_reduced diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx new file mode 100644 index 00000000000..ff0366138f3 --- /dev/null +++ b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx @@ -0,0 +1,254 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file candidateCreatorCharmResoReduced.cxx +/// \brief Reconstruction of Resonance candidates +/// +/// \author Luca Aglietta , Università degli Studi di Torino +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" +#include "ReconstructionDataFormats/V0.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" + +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; + +enum Selections : uint8_t{ + NoSel = 0, + DSel, + V0Sel, + NSelSteps +}; +enum DecayChannel : uint8_t { + Ds1toDstarK0s = 0, + Dstar2toDplusK0s, + XctoDplusLambda + }; +enum V0Type : uint8_t { + K0s = 0, + Lambda, + AntiLambda +}; +const int nBins = 7; +constexpr double binsPt[nBins + 1] = { + 1., + 2., + 4., + 6., + 8., + 12., + 24., + 50.}; +auto vecBins = std::vector{binsPt, binsPt + nBins + 1}; + +struct HfCandidateCreatorDV0Reduced { + // Produces: Tables with resonance info + Produces rowCandidateReso; + // Configurables + Configurable invMassWindowD{"invMassWindowD", 0.5, "invariant-mass window for D candidates (GeV/c2)"}; + Configurable invMassWindowV0{"invMassWindowV0", 0.5, "invariant-mass window for V0 candidates (GeV/c2)"}; + // QA switch + Configurable activateQA{"activateQA", false, "Flag to enable QA histogram"}; + // Hist Axis + Configurable> binsPt{"binsPt", std::vector{vecBins}, "pT bin limits"}; + + // Partition of V0 candidates based on v0Type + Partition candidatesK0s = aod::hf_reso_cand_reduced::v0Type == (uint8_t)1 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)3 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)5; + Partition candidatesLambda = aod::hf_reso_cand_reduced::v0Type == (uint8_t)2 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)4; + + // Useful constants + double massK0{0.}; + double massLambda{0.}; + double massDplus{0.}; + double massDstar{0.}; + + // Histogram registry: if task make it with a THNsparse with all variables you want to save + HistogramRegistry registry{"registry"}; + + void init(InitContext const&) + { + for (const auto& value : vecBins){ + LOGF(info, "bin limit %f",value ); + } + const AxisSpec axisPt{(std::vector)vecBins,"#it{p}_{T} (GeV/#it{c})"}; + // histograms + registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 2.4, 2.7},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + if (activateQA) { + constexpr int kNBinsSelections = Selections::NSelSteps; + std::string labels[kNBinsSelections]; + labels[Selections::NoSel] = "No selection"; + labels[Selections::DSel] = "D Candidates Selection"; + labels[Selections::V0Sel] = "D & V0 candidate Selection"; + static const AxisSpec axisSelections = {kNBinsSelections, 0.5, kNBinsSelections + 0.5, ""}; + registry.add("hSelections", "Selections", {HistType::kTH1F, {axisSelections}}); + for (int iBin = 0; iBin < kNBinsSelections; ++iBin) { + registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); + } + } + + massK0 = o2::constants::physics::MassK0Short; + massLambda = o2::constants::physics::MassLambda; + massDplus = o2::constants::physics::MassDPlus; + massDstar = o2::constants::physics::MassDStar; + } + + template + bool isDSelected(D const& candD) + { + float massD{0.}; + //slection on D candidate mass + if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::XctoDplusLambda ){ + massD = massDplus; + } else if (DecayChannel == DecayChannel::Ds1toDstarK0s){ + massD = massDstar; + } + if (std::fabs(candD.invMass() - massD) > invMassWindowD){ + return false; + } + return true; + } + + template + bool isV0Selected(V const& candV0, D const& candD) + { + float massV0{0.}; + float invMassV0{0.}; + //slection on V0 candidate mass + if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::Ds1toDstarK0s){ + massV0 = massK0; + invMassV0 = candV0.invMassK0s(); + } else if (DecayChannel == DecayChannel::XctoDplusLambda){ + massV0 = massLambda; + if (candD.dType() > 0){ + invMassV0 = candV0.invMassLambda(); + } else { + invMassV0 = candV0.invMassAntiLambda(); + } + } + if (std::fabs(invMassV0 - massV0) > invMassWindowV0 ){ + return false; + } + return true; + } + + template + void runCandidateCreation(C const& collisions, + D const& candsD, + V const& candsV0) + { + // loop on D candidates + for (const auto& candD : candsD) { + // selection of D candidates + if (activateQA) { + registry.fill(HIST("hSelections"), 1); + } + if(!isDSelected(candD)){ + continue; + } + if (activateQA) { + registry.fill(HIST("hSelections"), 1 + Selections::DSel); + } + float invMassD = candD.invMass(); + std::array pVecD = {candD.px(),candD.py(),candD.pz()}; + float ptD = RecoDecay::pt(pVecD);; + // loop on V0 candidates + bool already_counted{false}; + for (const auto& candV0 : candsV0){ + if(!isV0Selected(candV0, candD)){ + continue; + } + if (activateQA && !already_counted) { + registry.fill(HIST("hSelections"), 1 + Selections::V0Sel); + already_counted = true; + } + float invMass2Reso{0.}; + float invMassV0{0.}; + std::array pVecV0 = {candV0.px(),candV0.py(),candV0.pz()}; + float ptV0 = RecoDecay::pt(pVecV0); + float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0,pVecD)); + switch (DecayChannel) { + case DecayChannel::Ds1toDstarK0s: + invMassV0 = candV0.invMassK0s(); + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); + registry.fill(HIST("hMassDs1"), sqrt(invMass2Reso), ptReso); + break; + case DecayChannel::Dstar2toDplusK0s: + invMassV0 = candV0.invMassK0s(); + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); + registry.fill(HIST("hMassDsStar2"), sqrt(invMass2Reso), ptReso); + break; + case DecayChannel::XctoDplusLambda: + if (candD.dType() > 0){ + invMassV0 = candV0.invMassLambda(); + } else { + invMassV0 = candV0.invMassAntiLambda(); + } + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); + registry.fill(HIST("hMassXcRes"), sqrt(invMass2Reso), ptReso); + break; + default: + break; + } + //Filling Output table + rowCandidateReso(collisions.globalIndex(), + sqrt(invMass2Reso), + ptReso, + invMassD, + ptD, + invMassV0, + ptV0, + candV0.cpa(), + candV0.dca(), + candV0.radius()); + } + + } + }//main function + + void processDstar2toDplusK0s(aod::HfRedCollisions::iterator const& collision, + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) + { + runCandidateCreation(collision, candsD, candidatesK0s); + } + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDstar2toDplusK0s, "Process Dplus candidates without MC info and without ML info", true); + + void processDs1toDstarK0s(aod::HfRedCollisions::iterator const& collision, + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) + { + runCandidateCreation(collision, candsD, candidatesK0s); + } + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDs1toDstarK0s, "Process Dplus candidates without MC info and without ML info", false); + + void processXctoDplusLambda(aod::HfRedCollisions::iterator const& collision, + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) + { + runCandidateCreation(collision, candsD, candidatesLambda); + } + PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processXctoDplusLambda, "Process Dplus candidates without MC info and without ML info", false); +}; // struct + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From d3d026e5cb23c487d5372da9a3c7bb5c66218520 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 13 Mar 2024 17:52:22 +0000 Subject: [PATCH 13/19] Please consider the following formatting changes --- PWGHF/D2H/DataModel/ReducedDataModel.h | 10 +- .../candidateCreatorDV0Reduced.cxx | 202 +++++++++--------- 2 files changed, 106 insertions(+), 106 deletions(-) diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 9943bbea452..6e3f2da1da7 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -394,11 +394,11 @@ DECLARE_SOA_COLUMN(Dca, dca, float); //! DCA of V0 candidate DECLARE_SOA_COLUMN(Radius, radius, float); //! Radius of V0 candidate DECLARE_SOA_COLUMN(V0Type, v0Type, uint8_t); //! Bitmap with mass hypothesis of the V0 DECLARE_SOA_COLUMN(DType, dType, int8_t); //! Integer with selected D candidate type: 1 = Dplus, -1 = Dminus, 2 = DstarPlus, -2 = DstarMinus -DECLARE_SOA_COLUMN(Pt, pt, float); //! Pt of Resonance candidate in GeV/c -DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Pt of D daughter in GeV/c -DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Pt of V0 daughter in GeV/c -DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c -DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c +DECLARE_SOA_COLUMN(Pt, pt, float); //! Pt of Resonance candidate in GeV/c +DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Pt of D daughter in GeV/c +DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Pt of V0 daughter in GeV/c +DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c +DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c } // namespace hf_reso_cand_reduced diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx index ff0366138f3..a9f5dec216d 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx @@ -29,7 +29,7 @@ using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; -enum Selections : uint8_t{ +enum Selections : uint8_t { NoSel = 0, DSel, V0Sel, @@ -39,7 +39,7 @@ enum DecayChannel : uint8_t { Ds1toDstarK0s = 0, Dstar2toDplusK0s, XctoDplusLambda - }; +}; enum V0Type : uint8_t { K0s = 0, Lambda, @@ -82,15 +82,15 @@ struct HfCandidateCreatorDV0Reduced { HistogramRegistry registry{"registry"}; void init(InitContext const&) - { - for (const auto& value : vecBins){ - LOGF(info, "bin limit %f",value ); + { + for (const auto& value : vecBins) { + LOGF(info, "bin limit %f", value); } - const AxisSpec axisPt{(std::vector)vecBins,"#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec axisPt{(std::vector)vecBins, "#it{p}_{T} (GeV/#it{c})"}; // histograms - registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 2.4, 2.7},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3},{(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); if (activateQA) { constexpr int kNBinsSelections = Selections::NSelSteps; std::string labels[kNBinsSelections]; @@ -103,27 +103,27 @@ struct HfCandidateCreatorDV0Reduced { registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } } - + massK0 = o2::constants::physics::MassK0Short; massLambda = o2::constants::physics::MassLambda; massDplus = o2::constants::physics::MassDPlus; massDstar = o2::constants::physics::MassDStar; } - + template bool isDSelected(D const& candD) { float massD{0.}; - //slection on D candidate mass - if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::XctoDplusLambda ){ - massD = massDplus; - } else if (DecayChannel == DecayChannel::Ds1toDstarK0s){ - massD = massDstar; + // slection on D candidate mass + if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::XctoDplusLambda) { + massD = massDplus; + } else if (DecayChannel == DecayChannel::Ds1toDstarK0s) { + massD = massDstar; } - if (std::fabs(candD.invMass() - massD) > invMassWindowD){ - return false; + if (std::fabs(candD.invMass() - massD) > invMassWindowD) { + return false; } - return true; + return true; } template @@ -131,22 +131,22 @@ struct HfCandidateCreatorDV0Reduced { { float massV0{0.}; float invMassV0{0.}; - //slection on V0 candidate mass - if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::Ds1toDstarK0s){ - massV0 = massK0; - invMassV0 = candV0.invMassK0s(); - } else if (DecayChannel == DecayChannel::XctoDplusLambda){ - massV0 = massLambda; - if (candD.dType() > 0){ - invMassV0 = candV0.invMassLambda(); - } else { - invMassV0 = candV0.invMassAntiLambda(); - } + // slection on V0 candidate mass + if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::Ds1toDstarK0s) { + massV0 = massK0; + invMassV0 = candV0.invMassK0s(); + } else if (DecayChannel == DecayChannel::XctoDplusLambda) { + massV0 = massLambda; + if (candD.dType() > 0) { + invMassV0 = candV0.invMassLambda(); + } else { + invMassV0 = candV0.invMassAntiLambda(); + } } - if (std::fabs(invMassV0 - massV0) > invMassWindowV0 ){ + if (std::fabs(invMassV0 - massV0) > invMassWindowV0) { return false; } - return true; + return true; } template @@ -156,94 +156,94 @@ struct HfCandidateCreatorDV0Reduced { { // loop on D candidates for (const auto& candD : candsD) { - // selection of D candidates - if (activateQA) { - registry.fill(HIST("hSelections"), 1); - } - if(!isDSelected(candD)){ - continue; + // selection of D candidates + if (activateQA) { + registry.fill(HIST("hSelections"), 1); + } + if (!isDSelected(candD)) { + continue; + } + if (activateQA) { + registry.fill(HIST("hSelections"), 1 + Selections::DSel); + } + float invMassD = candD.invMass(); + std::array pVecD = {candD.px(), candD.py(), candD.pz()}; + float ptD = RecoDecay::pt(pVecD); + ; + // loop on V0 candidates + bool already_counted{false}; + for (const auto& candV0 : candsV0) { + if (!isV0Selected(candV0, candD)) { + continue; } - if (activateQA) { - registry.fill(HIST("hSelections"), 1 + Selections::DSel); + if (activateQA && !already_counted) { + registry.fill(HIST("hSelections"), 1 + Selections::V0Sel); + already_counted = true; } - float invMassD = candD.invMass(); - std::array pVecD = {candD.px(),candD.py(),candD.pz()}; - float ptD = RecoDecay::pt(pVecD);; - // loop on V0 candidates - bool already_counted{false}; - for (const auto& candV0 : candsV0){ - if(!isV0Selected(candV0, candD)){ - continue; - } - if (activateQA && !already_counted) { - registry.fill(HIST("hSelections"), 1 + Selections::V0Sel); - already_counted = true; - } - float invMass2Reso{0.}; - float invMassV0{0.}; - std::array pVecV0 = {candV0.px(),candV0.py(),candV0.pz()}; - float ptV0 = RecoDecay::pt(pVecV0); - float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0,pVecD)); - switch (DecayChannel) { - case DecayChannel::Ds1toDstarK0s: - invMassV0 = candV0.invMassK0s(); - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); - registry.fill(HIST("hMassDs1"), sqrt(invMass2Reso), ptReso); - break; - case DecayChannel::Dstar2toDplusK0s: - invMassV0 = candV0.invMassK0s(); - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); - registry.fill(HIST("hMassDsStar2"), sqrt(invMass2Reso), ptReso); - break; - case DecayChannel::XctoDplusLambda: - if (candD.dType() > 0){ - invMassV0 = candV0.invMassLambda(); - } else { - invMassV0 = candV0.invMassAntiLambda(); - } - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); - registry.fill(HIST("hMassXcRes"), sqrt(invMass2Reso), ptReso); - break; - default: - break; + float invMass2Reso{0.}; + float invMassV0{0.}; + std::array pVecV0 = {candV0.px(), candV0.py(), candV0.pz()}; + float ptV0 = RecoDecay::pt(pVecV0); + float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0, pVecD)); + switch (DecayChannel) { + case DecayChannel::Ds1toDstarK0s: + invMassV0 = candV0.invMassK0s(); + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); + registry.fill(HIST("hMassDs1"), sqrt(invMass2Reso), ptReso); + break; + case DecayChannel::Dstar2toDplusK0s: + invMassV0 = candV0.invMassK0s(); + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); + registry.fill(HIST("hMassDsStar2"), sqrt(invMass2Reso), ptReso); + break; + case DecayChannel::XctoDplusLambda: + if (candD.dType() > 0) { + invMassV0 = candV0.invMassLambda(); + } else { + invMassV0 = candV0.invMassAntiLambda(); } - //Filling Output table - rowCandidateReso(collisions.globalIndex(), - sqrt(invMass2Reso), - ptReso, - invMassD, - ptD, - invMassV0, - ptV0, - candV0.cpa(), - candV0.dca(), - candV0.radius()); + invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); + registry.fill(HIST("hMassXcRes"), sqrt(invMass2Reso), ptReso); + break; + default: + break; } - + // Filling Output table + rowCandidateReso(collisions.globalIndex(), + sqrt(invMass2Reso), + ptReso, + invMassD, + ptD, + invMassV0, + ptV0, + candV0.cpa(), + candV0.dca(), + candV0.radius()); + } } - }//main function + } // main function void processDstar2toDplusK0s(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { - runCandidateCreation(collision, candsD, candidatesK0s); + runCandidateCreation(collision, candsD, candidatesK0s); } PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDstar2toDplusK0s, "Process Dplus candidates without MC info and without ML info", true); - + void processDs1toDstarK0s(aod::HfRedCollisions::iterator const& collision, - aod::HfRed3PrNoTrks const& candsD, - aod::HfRedVzeros const& candsV0) + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) { - runCandidateCreation(collision, candsD, candidatesK0s); + runCandidateCreation(collision, candsD, candidatesK0s); } PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDs1toDstarK0s, "Process Dplus candidates without MC info and without ML info", false); void processXctoDplusLambda(aod::HfRedCollisions::iterator const& collision, - aod::HfRed3PrNoTrks const& candsD, - aod::HfRedVzeros const& candsV0) + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const& candsV0) { - runCandidateCreation(collision, candsD, candidatesLambda); + runCandidateCreation(collision, candsD, candidatesLambda); } PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processXctoDplusLambda, "Process Dplus candidates without MC info and without ML info", false); }; // struct From eda1944496b9951251cbefe2fda2ca408f3d81e0 Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Wed, 13 Mar 2024 19:41:14 +0100 Subject: [PATCH 14/19] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera --- PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx index a9f5dec216d..fce83c344c1 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx @@ -110,7 +110,7 @@ struct HfCandidateCreatorDV0Reduced { massDstar = o2::constants::physics::MassDStar; } - template + template bool isDSelected(D const& candD) { float massD{0.}; @@ -149,7 +149,7 @@ struct HfCandidateCreatorDV0Reduced { return true; } - template + template void runCandidateCreation(C const& collisions, D const& candsD, V const& candsV0) @@ -223,7 +223,7 @@ struct HfCandidateCreatorDV0Reduced { } } // main function - void processDstar2toDplusK0s(aod::HfRedCollisions::iterator const& collision, + void processDstar2ToDplusK0s(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const& candsV0) { From 9e8409b8768cf4bd1732b8f174180bd95e96cc26 Mon Sep 17 00:00:00 2001 From: luagliet Date: Fri, 22 Mar 2024 17:33:42 +0100 Subject: [PATCH 15/19] added configurable to select PID logic in Dplus and Ds candidate selector --- .../candidateSelectorDplusToPiKPi.cxx | 32 ++++++++++---- .../candidateSelectorDsToKKPi.cxx | 44 ++++++++++++++----- 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx index 390c29e573f..b45ba8783e9 100644 --- a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx @@ -41,12 +41,16 @@ struct HfCandidateSelectorDplusToPiKPi { Configurable acceptPIDNotApplicable{"acceptPIDNotApplicable", true, "Switch to accept Status::NotApplicable [(NotApplicable for one detector) and (NotApplicable or Conditional for the other)] in PID selection"}; // TPC PID Configurable ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"}; - Configurable ptPidTpcMax{"ptPidTpcMax", 20., "Upper bound of track pT for TPC PID"}; - Configurable nSigmaTpcMax{"nSigmaTpcMax", 3., "Nsigma cut on TPC"}; + Configurable ptPidTpcMax{"ptPidTpcMax", 5., "Upper bound of track pT for TPC PID"}; + Configurable nSigmaTpcMax{"nSigmaTpcMax", 3., "Nsigma cut on TPC only"}; + Configurable nSigmaTpcCombinedMax{"nSigmaTpcCombinedMax", 5., "Nsigma cut on TPC combined with TOF"}; // TOF PID Configurable ptPidTofMin{"ptPidTofMin", 0.15, "Lower bound of track pT for TOF PID"}; - Configurable ptPidTofMax{"ptPidTofMax", 20., "Upper bound of track pT for TOF PID"}; - Configurable nSigmaTofMax{"nSigmaTofMax", 3., "Nsigma cut on TOF"}; + Configurable ptPidTofMax{"ptPidTofMax", 5., "Upper bound of track pT for TOF PID"}; + Configurable nSigmaTofMax{"nSigmaTofMax", 3., "Nsigma cut on TOF only"}; + Configurable nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 5., "Nsigma cut on TOF combined with TPC"}; + // AND logic for TOF+TPC PID (as in Run2) + Configurable usePidTpcAndTof{"usePidTpcAndTof", false, "Use AND logic for TPC and TOF PID"}; // topological cuts Configurable> binsPt{"binsPt", std::vector{hf_cuts_dplus_to_pi_k_pi::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_dplus_to_pi_k_pi::cuts[0], hf_cuts_dplus_to_pi_k_pi::nBinsPt, hf_cuts_dplus_to_pi_k_pi::nCutVars, hf_cuts_dplus_to_pi_k_pi::labelsPt, hf_cuts_dplus_to_pi_k_pi::labelsCutVar}, "Dplus candidate selection per pT bin"}; @@ -82,8 +86,10 @@ struct HfCandidateSelectorDplusToPiKPi { { selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax); selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax); + selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax); selectorPion.setRangePtTof(ptPidTofMin, ptPidTofMax); selectorPion.setRangeNSigmaTof(-nSigmaTofMax, nSigmaTofMax); + selectorPion.setRangeNSigmaTofCondTpc(-nSigmaTofCombinedMax, nSigmaTofCombinedMax); selectorKaon = selectorPion; if (activateQA) { @@ -226,10 +232,20 @@ struct HfCandidateSelectorDplusToPiKPi { } // track-level PID selection - int pidTrackPos1Pion = selectorPion.statusTpcOrTof(trackPos1); - int pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg); - int pidTrackPos2Pion = selectorPion.statusTpcOrTof(trackPos2); - + int pidTrackPos1Pion = -1; + int pidTrackNegKaon = -1; + int pidTrackPos2Pion = -1; + + if (usePidTpcAndTof) { + pidTrackPos1Pion = selectorPion.statusTpcAndTof(trackPos1); + pidTrackNegKaon = selectorKaon.statusTpcAndTof(trackNeg); + pidTrackPos2Pion = selectorPion.statusTpcAndTof(trackPos2); + } else{ + pidTrackPos1Pion = selectorPion.statusTpcOrTof(trackPos1); + pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg); + pidTrackPos2Pion = selectorPion.statusTpcOrTof(trackPos2); + } + if (!selectionPID(pidTrackPos1Pion, pidTrackNegKaon, pidTrackPos2Pion)) { // exclude D± hfSelDplusToPiKPiCandidate(statusDplusToPiKPi); if (applyMl) { diff --git a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx index bc480650fa2..89bdf492560 100644 --- a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx @@ -37,14 +37,18 @@ struct HfCandidateSelectorDsToKKPi { Configurable ptCandMin{"ptCandMin", 1., "Lower bound of candidate pT"}; Configurable ptCandMax{"ptCandMax", 36., "Upper bound of candidate pT"}; - // TPC PID + // TPC PID Configurable ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"}; - Configurable ptPidTpcMax{"ptPidTpcMax", 20., "Upper bound of track pT for TPC PID"}; - Configurable nSigmaTpcMax{"nSigmaTpcMax", 3., "Nsigma cut on TPC"}; - // TOF PID + Configurable ptPidTpcMax{"ptPidTpcMax", 5., "Upper bound of track pT for TPC PID"}; + Configurable nSigmaTpcMax{"nSigmaTpcMax", 3., "Nsigma cut on TPC only"}; + Configurable nSigmaTpcCombinedMax{"nSigmaTpcCombinedMax", 5., "Nsigma cut on TPC combined with TOF"}; + // TOF PID Configurable ptPidTofMin{"ptPidTofMin", 0.15, "Lower bound of track pT for TOF PID"}; - Configurable ptPidTofMax{"ptPidTofMax", 20., "Upper bound of track pT for TOF PID"}; - Configurable nSigmaTofMax{"nSigmaTofMax", 3., "Nsigma cut on TOF"}; + Configurable ptPidTofMax{"ptPidTofMax", 5., "Upper bound of track pT for TOF PID"}; + Configurable nSigmaTofMax{"nSigmaTofMax", 3., "Nsigma cut on TOF only"}; + Configurable nSigmaTofCombinedMax{"nSigmaTofCombinedMax", 5., "Nsigma cut on TOF combined with TPC"}; + // AND logic for TOF+TPC PID (as in Run2) + Configurable usePidTpcAndTof{"usePidTpcAndTof", false, "Use AND logic for TPC and TOF PID"}; // topological cuts Configurable> binsPt{"binsPt", std::vector{hf_cuts_ds_to_k_k_pi::vecBinsPt}, "pT bin limits"}; Configurable> cuts{"cuts", {hf_cuts_ds_to_k_k_pi::cuts[0], hf_cuts_ds_to_k_k_pi::nBinsPt, hf_cuts_ds_to_k_k_pi::nCutVars, hf_cuts_ds_to_k_k_pi::labelsPt, hf_cuts_ds_to_k_k_pi::labelsCutVar}, "Ds candidate selection per pT bin"}; @@ -76,7 +80,7 @@ struct HfCandidateSelectorDsToKKPi { TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; - using TracksSel = soa::Join; + using TracksSel = soa::Join; HistogramRegistry registry{"registry"}; @@ -84,8 +88,10 @@ struct HfCandidateSelectorDsToKKPi { { selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax); selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax); + selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax); selectorPion.setRangePtTof(ptPidTofMin, ptPidTofMax); selectorPion.setRangeNSigmaTof(-nSigmaTofMax, nSigmaTofMax); + selectorPion.setRangeNSigmaTofCondTpc(-nSigmaTofCombinedMax, nSigmaTofCombinedMax); selectorKaon = selectorPion; if (activateQA) { @@ -309,11 +315,25 @@ struct HfCandidateSelectorDsToKKPi { } // track-level PID selection - int pidTrackPos1Pion = selectorPion.statusTpcOrTof(trackPos1); - int pidTrackPos1Kaon = selectorKaon.statusTpcOrTof(trackPos1); - int pidTrackPos2Pion = selectorPion.statusTpcOrTof(trackPos2); - int pidTrackPos2Kaon = selectorKaon.statusTpcOrTof(trackPos2); - int pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg); + int pidTrackPos1Pion = -1; + int pidTrackPos1Kaon = -1; + int pidTrackPos2Pion = -1; + int pidTrackPos2Kaon = -1; + int pidTrackNegKaon = -1; + + if (usePidTpcAndTof) { + selectorPion.statusTpcAndTof(trackPos1); + selectorKaon.statusTpcAndTof(trackPos1); + selectorPion.statusTpcAndTof(trackPos2); + selectorKaon.statusTpcAndTof(trackPos2); + selectorKaon.statusTpcAndTof(trackNeg); + } else{ + selectorPion.statusTpcOrTof(trackPos1); + selectorKaon.statusTpcOrTof(trackPos1); + selectorPion.statusTpcOrTof(trackPos2); + selectorKaon.statusTpcOrTof(trackPos2); + selectorKaon.statusTpcOrTof(trackNeg); + } bool pidDsToKKPi = !(pidTrackPos1Kaon == TrackSelectorPID::Rejected || pidTrackNegKaon == TrackSelectorPID::Rejected || From 4d7d590a0a68d0fa06aee4242dd88d928984be84 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Fri, 22 Mar 2024 16:36:15 +0000 Subject: [PATCH 16/19] Please consider the following formatting changes --- PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx | 6 +++--- PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx index b45ba8783e9..c478281ca21 100644 --- a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx @@ -235,17 +235,17 @@ struct HfCandidateSelectorDplusToPiKPi { int pidTrackPos1Pion = -1; int pidTrackNegKaon = -1; int pidTrackPos2Pion = -1; - + if (usePidTpcAndTof) { pidTrackPos1Pion = selectorPion.statusTpcAndTof(trackPos1); pidTrackNegKaon = selectorKaon.statusTpcAndTof(trackNeg); pidTrackPos2Pion = selectorPion.statusTpcAndTof(trackPos2); - } else{ + } else { pidTrackPos1Pion = selectorPion.statusTpcOrTof(trackPos1); pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg); pidTrackPos2Pion = selectorPion.statusTpcOrTof(trackPos2); } - + if (!selectionPID(pidTrackPos1Pion, pidTrackNegKaon, pidTrackPos2Pion)) { // exclude D± hfSelDplusToPiKPiCandidate(statusDplusToPiKPi); if (applyMl) { diff --git a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx index 89bdf492560..15c341aa191 100644 --- a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx @@ -37,7 +37,7 @@ struct HfCandidateSelectorDsToKKPi { Configurable ptCandMin{"ptCandMin", 1., "Lower bound of candidate pT"}; Configurable ptCandMax{"ptCandMax", 36., "Upper bound of candidate pT"}; - // TPC PID + // TPC PID Configurable ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"}; Configurable ptPidTpcMax{"ptPidTpcMax", 5., "Upper bound of track pT for TPC PID"}; Configurable nSigmaTpcMax{"nSigmaTpcMax", 3., "Nsigma cut on TPC only"}; @@ -320,14 +320,14 @@ struct HfCandidateSelectorDsToKKPi { int pidTrackPos2Pion = -1; int pidTrackPos2Kaon = -1; int pidTrackNegKaon = -1; - + if (usePidTpcAndTof) { selectorPion.statusTpcAndTof(trackPos1); selectorKaon.statusTpcAndTof(trackPos1); selectorPion.statusTpcAndTof(trackPos2); selectorKaon.statusTpcAndTof(trackPos2); selectorKaon.statusTpcAndTof(trackNeg); - } else{ + } else { selectorPion.statusTpcOrTof(trackPos1); selectorKaon.statusTpcOrTof(trackPos1); selectorPion.statusTpcOrTof(trackPos2); From b4ae81e64db1c29265019742c349d45ea3613ce8 Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Mon, 25 Mar 2024 13:58:55 +0100 Subject: [PATCH 17/19] Delete PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx --- .../candidateCreatorDV0Reduced.cxx | 254 ------------------ 1 file changed, 254 deletions(-) delete mode 100644 PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx diff --git a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx deleted file mode 100644 index fce83c344c1..00000000000 --- a/PWGHF/D2H/TableProducer/candidateCreatorDV0Reduced.cxx +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file candidateCreatorCharmResoReduced.cxx -/// \brief Reconstruction of Resonance candidates -/// -/// \author Luca Aglietta , Università degli Studi di Torino -#include "CommonConstants/PhysicsConstants.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/DCA.h" -#include "ReconstructionDataFormats/V0.h" - -#include "Common/Core/trackUtilities.h" -#include "Common/DataModel/CollisionAssociationTables.h" - -#include "PWGHF/D2H/DataModel/ReducedDataModel.h" - -using namespace o2; -using namespace o2::aod; -using namespace o2::framework; -using namespace o2::framework::expressions; - -enum Selections : uint8_t { - NoSel = 0, - DSel, - V0Sel, - NSelSteps -}; -enum DecayChannel : uint8_t { - Ds1toDstarK0s = 0, - Dstar2toDplusK0s, - XctoDplusLambda -}; -enum V0Type : uint8_t { - K0s = 0, - Lambda, - AntiLambda -}; -const int nBins = 7; -constexpr double binsPt[nBins + 1] = { - 1., - 2., - 4., - 6., - 8., - 12., - 24., - 50.}; -auto vecBins = std::vector{binsPt, binsPt + nBins + 1}; - -struct HfCandidateCreatorDV0Reduced { - // Produces: Tables with resonance info - Produces rowCandidateReso; - // Configurables - Configurable invMassWindowD{"invMassWindowD", 0.5, "invariant-mass window for D candidates (GeV/c2)"}; - Configurable invMassWindowV0{"invMassWindowV0", 0.5, "invariant-mass window for V0 candidates (GeV/c2)"}; - // QA switch - Configurable activateQA{"activateQA", false, "Flag to enable QA histogram"}; - // Hist Axis - Configurable> binsPt{"binsPt", std::vector{vecBins}, "pT bin limits"}; - - // Partition of V0 candidates based on v0Type - Partition candidatesK0s = aod::hf_reso_cand_reduced::v0Type == (uint8_t)1 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)3 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)5; - Partition candidatesLambda = aod::hf_reso_cand_reduced::v0Type == (uint8_t)2 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)4; - - // Useful constants - double massK0{0.}; - double massLambda{0.}; - double massDplus{0.}; - double massDstar{0.}; - - // Histogram registry: if task make it with a THNsparse with all variables you want to save - HistogramRegistry registry{"registry"}; - - void init(InitContext const&) - { - for (const auto& value : vecBins) { - LOGF(info, "bin limit %f", value); - } - const AxisSpec axisPt{(std::vector)vecBins, "#it{p}_{T} (GeV/#it{c})"}; - // histograms - registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassDsStar2", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - if (activateQA) { - constexpr int kNBinsSelections = Selections::NSelSteps; - std::string labels[kNBinsSelections]; - labels[Selections::NoSel] = "No selection"; - labels[Selections::DSel] = "D Candidates Selection"; - labels[Selections::V0Sel] = "D & V0 candidate Selection"; - static const AxisSpec axisSelections = {kNBinsSelections, 0.5, kNBinsSelections + 0.5, ""}; - registry.add("hSelections", "Selections", {HistType::kTH1F, {axisSelections}}); - for (int iBin = 0; iBin < kNBinsSelections; ++iBin) { - registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); - } - } - - massK0 = o2::constants::physics::MassK0Short; - massLambda = o2::constants::physics::MassLambda; - massDplus = o2::constants::physics::MassDPlus; - massDstar = o2::constants::physics::MassDStar; - } - - template - bool isDSelected(D const& candD) - { - float massD{0.}; - // slection on D candidate mass - if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::XctoDplusLambda) { - massD = massDplus; - } else if (DecayChannel == DecayChannel::Ds1toDstarK0s) { - massD = massDstar; - } - if (std::fabs(candD.invMass() - massD) > invMassWindowD) { - return false; - } - return true; - } - - template - bool isV0Selected(V const& candV0, D const& candD) - { - float massV0{0.}; - float invMassV0{0.}; - // slection on V0 candidate mass - if (DecayChannel == DecayChannel::Dstar2toDplusK0s || DecayChannel == DecayChannel::Ds1toDstarK0s) { - massV0 = massK0; - invMassV0 = candV0.invMassK0s(); - } else if (DecayChannel == DecayChannel::XctoDplusLambda) { - massV0 = massLambda; - if (candD.dType() > 0) { - invMassV0 = candV0.invMassLambda(); - } else { - invMassV0 = candV0.invMassAntiLambda(); - } - } - if (std::fabs(invMassV0 - massV0) > invMassWindowV0) { - return false; - } - return true; - } - - template - void runCandidateCreation(C const& collisions, - D const& candsD, - V const& candsV0) - { - // loop on D candidates - for (const auto& candD : candsD) { - // selection of D candidates - if (activateQA) { - registry.fill(HIST("hSelections"), 1); - } - if (!isDSelected(candD)) { - continue; - } - if (activateQA) { - registry.fill(HIST("hSelections"), 1 + Selections::DSel); - } - float invMassD = candD.invMass(); - std::array pVecD = {candD.px(), candD.py(), candD.pz()}; - float ptD = RecoDecay::pt(pVecD); - ; - // loop on V0 candidates - bool already_counted{false}; - for (const auto& candV0 : candsV0) { - if (!isV0Selected(candV0, candD)) { - continue; - } - if (activateQA && !already_counted) { - registry.fill(HIST("hSelections"), 1 + Selections::V0Sel); - already_counted = true; - } - float invMass2Reso{0.}; - float invMassV0{0.}; - std::array pVecV0 = {candV0.px(), candV0.py(), candV0.pz()}; - float ptV0 = RecoDecay::pt(pVecV0); - float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0, pVecD)); - switch (DecayChannel) { - case DecayChannel::Ds1toDstarK0s: - invMassV0 = candV0.invMassK0s(); - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); - registry.fill(HIST("hMassDs1"), sqrt(invMass2Reso), ptReso); - break; - case DecayChannel::Dstar2toDplusK0s: - invMassV0 = candV0.invMassK0s(); - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); - registry.fill(HIST("hMassDsStar2"), sqrt(invMass2Reso), ptReso); - break; - case DecayChannel::XctoDplusLambda: - if (candD.dType() > 0) { - invMassV0 = candV0.invMassLambda(); - } else { - invMassV0 = candV0.invMassAntiLambda(); - } - invMass2Reso = RecoDecay::m2(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); - registry.fill(HIST("hMassXcRes"), sqrt(invMass2Reso), ptReso); - break; - default: - break; - } - // Filling Output table - rowCandidateReso(collisions.globalIndex(), - sqrt(invMass2Reso), - ptReso, - invMassD, - ptD, - invMassV0, - ptV0, - candV0.cpa(), - candV0.dca(), - candV0.radius()); - } - } - } // main function - - void processDstar2ToDplusK0s(aod::HfRedCollisions::iterator const& collision, - aod::HfRed3PrNoTrks const& candsD, - aod::HfRedVzeros const& candsV0) - { - runCandidateCreation(collision, candsD, candidatesK0s); - } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDstar2toDplusK0s, "Process Dplus candidates without MC info and without ML info", true); - - void processDs1toDstarK0s(aod::HfRedCollisions::iterator const& collision, - aod::HfRed3PrNoTrks const& candsD, - aod::HfRedVzeros const& candsV0) - { - runCandidateCreation(collision, candsD, candidatesK0s); - } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processDs1toDstarK0s, "Process Dplus candidates without MC info and without ML info", false); - - void processXctoDplusLambda(aod::HfRedCollisions::iterator const& collision, - aod::HfRed3PrNoTrks const& candsD, - aod::HfRedVzeros const& candsV0) - { - runCandidateCreation(collision, candsD, candidatesLambda); - } - PROCESS_SWITCH(HfCandidateCreatorDV0Reduced, processXctoDplusLambda, "Process Dplus candidates without MC info and without ML info", false); -}; // struct - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} From a5717adec3797b03a4ad04ec4a2b7cf958628739 Mon Sep 17 00:00:00 2001 From: luagliet Date: Mon, 25 Mar 2024 14:48:11 +0100 Subject: [PATCH 18/19] fixed error --- .../candidateSelectorDsToKKPi.cxx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx index 15c341aa191..09b8247a448 100644 --- a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx @@ -322,17 +322,17 @@ struct HfCandidateSelectorDsToKKPi { int pidTrackNegKaon = -1; if (usePidTpcAndTof) { - selectorPion.statusTpcAndTof(trackPos1); - selectorKaon.statusTpcAndTof(trackPos1); - selectorPion.statusTpcAndTof(trackPos2); - selectorKaon.statusTpcAndTof(trackPos2); - selectorKaon.statusTpcAndTof(trackNeg); - } else { - selectorPion.statusTpcOrTof(trackPos1); - selectorKaon.statusTpcOrTof(trackPos1); - selectorPion.statusTpcOrTof(trackPos2); - selectorKaon.statusTpcOrTof(trackPos2); - selectorKaon.statusTpcOrTof(trackNeg); + pidTrackPos1Pion = selectorPion.statusTpcAndTof(trackPos1); + pidTrackPos1Kaon = selectorKaon.statusTpcAndTof(trackPos1); + pidTrackPos2Pion = selectorPion.statusTpcAndTof(trackPos2); + pidTrackPos2Kaon = selectorKaon.statusTpcAndTof(trackPos2); + pidTrackNegKaon = selectorKaon.statusTpcAndTof(trackNeg); + } else{ + pidTrackPos1Pion = selectorPion.statusTpcOrTof(trackPos1); + pidTrackPos1Kaon = selectorKaon.statusTpcOrTof(trackPos1); + pidTrackPos2Pion = selectorPion.statusTpcOrTof(trackPos2); + pidTrackPos2Kaon = selectorKaon.statusTpcOrTof(trackPos2); + pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg); } bool pidDsToKKPi = !(pidTrackPos1Kaon == TrackSelectorPID::Rejected || From 3e356b98a22e192e8fe19ea40022102b554fa493 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 25 Mar 2024 13:51:57 +0000 Subject: [PATCH 19/19] Please consider the following formatting changes --- PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx index 09b8247a448..c96d5216c24 100644 --- a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx @@ -327,7 +327,7 @@ struct HfCandidateSelectorDsToKKPi { pidTrackPos2Pion = selectorPion.statusTpcAndTof(trackPos2); pidTrackPos2Kaon = selectorKaon.statusTpcAndTof(trackPos2); pidTrackNegKaon = selectorKaon.statusTpcAndTof(trackNeg); - } else{ + } else { pidTrackPos1Pion = selectorPion.statusTpcOrTof(trackPos1); pidTrackPos1Kaon = selectorKaon.statusTpcOrTof(trackPos1); pidTrackPos2Pion = selectorPion.statusTpcOrTof(trackPos2);