From c29613ec899004e3d894059aafbe93e0e5bfec1f Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Mon, 4 Aug 2025 10:13:08 +0200 Subject: [PATCH 01/26] first try --- PWGHF/HFJ/CMakeLists.txt | 4 +- PWGHF/HFJ/Tasks/CMakeLists.txt | 17 + .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 1129 +++++++++++++++++ 3 files changed, 1149 insertions(+), 1 deletion(-) create mode 100644 PWGHF/HFJ/Tasks/CMakeLists.txt create mode 100644 PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx diff --git a/PWGHF/HFJ/CMakeLists.txt b/PWGHF/HFJ/CMakeLists.txt index 62f88c324cf..d1ccd071b54 100644 --- a/PWGHF/HFJ/CMakeLists.txt +++ b/PWGHF/HFJ/CMakeLists.txt @@ -7,4 +7,6 @@ # # 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. \ No newline at end of file +# or submit itself to any jurisdiction. + +add_subdirectory(Tasks) \ No newline at end of file diff --git a/PWGHF/HFJ/Tasks/CMakeLists.txt b/PWGHF/HFJ/Tasks/CMakeLists.txt new file mode 100644 index 00000000000..acdf2c92eb1 --- /dev/null +++ b/PWGHF/HFJ/Tasks/CMakeLists.txt @@ -0,0 +1,17 @@ +# 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. + +o2physics_add_dpl_workflow(task-dstar-polarisation-in-jet + SOURCES taskDstarPolarisationInJet.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/PWGJE/Core) \ No newline at end of file diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx new file mode 100644 index 00000000000..fac4db45cae --- /dev/null +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -0,0 +1,1129 @@ +// 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 taskDstarPolarisationInJet.cxx +/// \brief Analysis task for Dstar spin alignment in jet (rho00 vs. z||) +/// +/// \author F. Grosa (CERN) fabrizio.grosa@cern.ch +/// \author Mingze Li (CCNU) Mingze.li@cern.ch + +#include + +#include "TRandom3.h" +#include "TVector3.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "Math/GenVector/Boost.h" + +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" + +#include "PWGHF/Core/DecayChannels.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetHFUtilities.h" +#include "PWGJE/Core/JetUtilities.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2::aod +{ +namespace charm_polarisation +{ +enum CosThetaStarType : uint8_t { + Helicity = 0, + JetAxis, + Production, + Beam, + Random, + NTypes +}; +enum DecayChannel : uint8_t { + DstarToDzeroPi = 0, + NChannels +}; +} // namespace charm_polarisation +} // namespace o2::aod + +struct TaskPolarisationDstarInJet { + + float massPi{0.f}; + float massProton{0.f}; + float massKaon{0.f}; + float massDstar{0.f}; + float bkgRotationAngleStep{0.f}; + + uint8_t nMassHypos{0u}; + + Configurable selectionFlagDstarToD0Pi{"selectionFlagDstarToD0Pi", true, "Selection Flag for D* decay to D0 Pi"}; + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + + ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {200, 0.139f, 0.179f}, "#it{M} (GeV/#it{c}^{2})"}; + ConfigurableAxis configThnAxisPt{"configThnAxisPt", {100, 0.f, 100.f}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis configThnAxisY{"configThnAxisY", {20, -1.f, 1.f}, "#it{y}"}; + ConfigurableAxis configThnAxisCosThetaStar{"configThnAxisCosThetaStar", {20, -1.f, 1.f}, "cos(#vartheta_{helicity})"}; + ConfigurableAxis configThnAxisMlBkg{"configThnAxisMlBkg", {100, 0.f, 1.f}, "ML bkg"}; + ConfigurableAxis configThnAxisInvMassD0{"configThnAxisInvMassD0", {250, 1.65f, 2.15f}, "#it{M}(D^{0}) (GeV/#it{c}^{2})"}; // only for D*+ + // ConfigurableAxis configThnAxisMlPrompt{"configThnAxisMlPrompt", {100, 0.f, 1.f}, "ML prompt"}; + ConfigurableAxis configThnAxisMlNonPrompt{"configThnAxisMlNonPrompt", {100, 0.f, 1.f}, "ML non-prompt"}; + ConfigurableAxis configThnAxisNumCandidates{"configThnAxisNumCandidates", {1, -0.5f, 0.5f}, "num candidates"}; + ConfigurableAxis configThnAxisPtB{"configThnAxisPtB", {3000, 0.f, 300.f}, "#it{p}_{T}(B mother) (GeV/#it{c})"}; + ConfigurableAxis configThnAxisAbsEtaTrackMin{"configThnAxisEtaTrackMin", {3, 0.f, 0.3f}, "min |#it{#eta_{track}}|"}; + ConfigurableAxis configThnAxisNumItsClsMin{"configThnAxisNumItsClsMin", {4, 3.5f, 7.5f}, "min #it{N}_{cls ITS}"}; + ConfigurableAxis configThnAxisNumTpcClsMin{"configThnAxisNumTpcClsMin", {3, 79.5f, 140.5f}, "min #it{N}_{cls TPC}"}; + ConfigurableAxis configThnAxisCharge{"configThnAxisCharge", {2, -2.f, 2.f}, "electric charge"}; + ConfigurableAxis configThnAxisProjection{"configThnAxisProjection", {300, 0.f, 10.f}, "z^{D^{*+},jet}_{||}"}; + ConfigurableAxis configThnAxisJetPt{"configThnAxisJetPt", {100, 0.f, 100.f}, "#it{p}_{T} (GeV/#it{c})"}; + + /// activate rotational background + Configurable nBkgRotations{"nBkgRotations", 0, "Number of rotated copies (background) per each original candidate"}; + Configurable minRotAngleMultByPi{"minRotAngleMultByPi", 5. / 6, "Minimum angle rotation for track rotation, to be multiplied by pi"}; + Configurable maxRotAngleMultByPi{"maxRotAngleMultByPi", 7. / 6, "Maximum angle rotation for track rotation, to be multiplied by pi"}; + + // activate study of systematic uncertainties of tracking + Configurable activateTrackingSys{"activateTrackingSys", false, "Activate the study of systematic uncertainties of tracking"}; + + /// output THnSparses + Configurable activateTHnSparseCosThStarHelicity{"activateTHnSparseCosThStarHelicity", true, "Activate the THnSparse with cosThStar w.r.t. helicity axis"}; + Configurable activateTHnSparseCosThStarJetAxis{"activateTHnSparseCosThStarJetAxis", true, "Activate the THnSparse with cosThStar w.r.t. production axis"}; + Configurable activateTHnSparseCosThStarProduction{"activateTHnSparseCosThStarProduction", true, "Activate the THnSparse with cosThStar w.r.t. production axis"}; + Configurable activatePartRecoDstar{"activatePartRecoDstar", false, "Activate the study of partly reconstructed D*+ -> D0 (-> KPiPi0) Pi decays"}; + float minInvMass{0.f}; + float maxInvMass{1000.f}; + + /// Application of rapidity cut for reconstructed candidates + Configurable rapidityCut{"rapidityCut", 999.f, "Max. value of reconstructed candidate rapidity (abs. value)"}; + + // Tables for MC jet matching + using DstarJets = soa::Join; + using JetMCDTable = soa::Join; + using JetMCPTable = soa::Join; + using TracksWithExtra = soa::Join; + + // slices for accessing proper HF mcdjets collision associated to mccollisions + PresliceUnsorted collisionsPerMCCollisionPreslice = aod::jmccollisionlb::mcCollisionId; + Preslice dstarMCDJetsPerCollisionPreslice = aod::jet::collisionId; + Preslice dstarMCPJetsPerMCCollisionPreslice = aod::jet::mcCollisionId; + Preslice dstarJetsPerCollision = aod::jet::collisionId; + + HistogramRegistry registry{"registry", {}}; + + std::vector eventSelectionBits; + + void init(InitContext&) + { + // initialise event selection: + eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); + + /// check process functions + std::array processes = {doprocessDstar, doprocessDstarWithMl, doprocessDstarMc, doprocessDstarMcWithMl}; + const int nProcesses = std::accumulate(processes.begin(), processes.end(), 0); + if (nProcesses > 1) { + LOGP(fatal, "Only one process function should be enabled at a time, please check your configuration"); + } else if (nProcesses == 0) { + LOGP(fatal, "No process function enabled"); + } + + /// check output THnSparses + std::array sparses = {activateTHnSparseCosThStarHelicity, activateTHnSparseCosThStarJetAxis, activateTHnSparseCosThStarProduction}; + if (std::accumulate(sparses.begin(), sparses.end(), 0) == 0) { + LOGP(fatal, "No output THnSparses enabled"); + } else { + if (activateTHnSparseCosThStarHelicity) { + LOGP(info, "THnSparse with cosThStar w.r.t. helicity axis active."); + } + if (activateTHnSparseCosThStarJetAxis) { + LOGP(info, "THnSparse with cosThStar w.r.t. jet axis active."); + } + if (activateTHnSparseCosThStarProduction) { + LOGP(info, "THnSparse with cosThStar w.r.t. production axis active."); + } + } + + if (activatePartRecoDstar && !(doprocessDstarMc || doprocessDstarMcWithMl)) { + LOGP(fatal, "Check on partly reconstructed D* mesons only possible for processDstarMc and processDstarMcWithMl"); + } + + // check bkg rotation for MC (not supported currently) + if (nBkgRotations > 0 && (doprocessDstarMc || doprocessDstarMcWithMl)) { + LOGP(fatal, "No background rotation supported for MC."); + } + + massPi = o2::constants::physics::MassPiPlus; + massProton = o2::constants::physics::MassProton; + massKaon = o2::constants::physics::MassKaonCharged; + massDstar = o2::constants::physics::MassDStar; + bkgRotationAngleStep = (nBkgRotations > 1) ? (maxRotAngleMultByPi - minRotAngleMultByPi) * constants::math::PI / (nBkgRotations - 1) : 0.; + + const AxisSpec thnAxisInvMass{configThnAxisInvMass, "#it{M} (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisInvMassD0{configThnAxisInvMassD0, "#it{M}(D^{0}) (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisPt{configThnAxisPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec thnAxisY{configThnAxisY, "#it{y}"}; + const AxisSpec thnAxisCosThetaStar{configThnAxisCosThetaStar, "cos(#vartheta)"}; + const AxisSpec thnAxisMlBkg{configThnAxisMlBkg, "ML bkg"}; + const AxisSpec thnAxisMlNonPrompt{configThnAxisMlNonPrompt, "ML non-prompt"}; + const AxisSpec thnAxisIsRotatedCandidate{2, -0.5f, 1.5f, "rotated bkg"}; + const AxisSpec thnAxisNumcandidates{configThnAxisNumCandidates, "num candidates"}; + const AxisSpec thnAxisPtB{configThnAxisPtB, "#it{p}_{T}(B mother) (GeV/#it{c})"}; + const AxisSpec thnAxisDausAcc{2, -0.5f, 1.5f, "daughters in acceptance"}; + const AxisSpec thnAxisDauToMuons{4, -0.5f, 3.5f, "daughters decayed to muons"}; + const AxisSpec thnAxisAbsEtaTrackMin{configThnAxisAbsEtaTrackMin, "min |#it{#eta_{track}}|"}; + const AxisSpec thnAxisNumItsClsMin{configThnAxisNumItsClsMin, "min #it{N}_{cls ITS}"}; + const AxisSpec thnAxisNumTpcClsMin{configThnAxisNumTpcClsMin, "min #it{N}_{cls TPC}"}; + const AxisSpec thnAxisCharge{configThnAxisCharge, "charge"}; + const AxisSpec thnAxisProjection{configThnAxisProjection, "z_{||}"}; + const AxisSpec thnAxisJetPt{configThnAxisJetPt, "#it{p}_{T} (GeV/#it{c})"}; + + auto invMassBins = thnAxisInvMass.binEdges; + minInvMass = invMassBins.front(); + maxInvMass = invMassBins.back(); + + std::vector thnRecDataAxes = {thnAxisInvMass, thnAxisPt, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStar}; + if (activateTrackingSys) { + thnRecDataAxes.insert(thnRecDataAxes.end(), {thnAxisAbsEtaTrackMin, thnAxisNumItsClsMin, thnAxisNumTpcClsMin}); + } + if (nBkgRotations > 0) { + thnRecDataAxes.push_back(thnAxisIsRotatedCandidate); + } + if (doprocessDstarWithMl || doprocessDstarMcWithMl) { + thnRecDataAxes.insert(thnRecDataAxes.end(), {thnAxisMlBkg, thnAxisMlNonPrompt}); + } + std::vector thnRecPromptAxes = thnRecDataAxes; + std::vector thnRecNonPromptAxes = thnRecDataAxes; + + // Data histos + if (activateTHnSparseCosThStarHelicity) { + registry.add("hHelicity", "THn for polarisation studies with cosThStar ", HistType::kTHnSparseF, thnRecDataAxes); + } + if (activateTHnSparseCosThStarProduction) { + registry.add("hProduction", "THn for polarisation studies with cosThStar w.r.t. production axis", HistType::kTHnSparseF, thnRecDataAxes); + } + if (activateTHnSparseCosThStarJetAxis) { + thnRecDataAxes.insert(thnRecDataAxes.end(), {thnAxisProjection, thnAxisJetPt}); + registry.add("hJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis", HistType::kTHnSparseF, thnRecDataAxes); + } + + // MC Reco histos + thnRecPromptAxes.push_back(thnAxisDauToMuons); + thnRecNonPromptAxes.insert(thnRecNonPromptAxes.end(), {thnAxisPtB, thnAxisDauToMuons}); + if (activateTHnSparseCosThStarHelicity) { + registry.add("hRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + if (activatePartRecoDstar) { + registry.add("hPartRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hPartRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- partially reco non-prompt signal" , HistType::kTHnSparseF, thnRecNonPromptAxes); + } + } + if (activateTHnSparseCosThStarProduction) { + registry.add("hRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + if (activatePartRecoDstar) { + registry.add("hPartRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hPartRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- partially reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + } + } + if (activateTHnSparseCosThStarJetAxis) { + thnRecPromptAxes.insert(thnRecPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); + thnRecNonPromptAxes.insert(thnRecNonPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); + registry.add("hRecoPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hRecoNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + if (activatePartRecoDstar) { + registry.add("hPartRecoPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hPartRecoNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- partially reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + } + } + + // MC Gen histos + if (doprocessDstarMc || doprocessDstarMcWithMl) { + std::vector thnGenPromptAxes = {thnAxisPt, thnAxisY, thnAxisCosThetaStar, thnAxisDausAcc, thnAxisCharge}; + std::vector thnGenNonPromptAxes = {thnAxisPt, thnAxisY, thnAxisCosThetaStar, thnAxisPtB, thnAxisDausAcc, thnAxisCharge}; + + if (activateTHnSparseCosThStarHelicity) { + registry.add("hGenPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis -- gen prompt signal", HistType::kTHnSparseF, thnGenPromptAxes); + registry.add("hGenNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis -- gen non-prompt signal", HistType::kTHnSparseF, thnGenNonPromptAxes); + if (activatePartRecoDstar && (doprocessDstarMc || doprocessDstarMcWithMl)) { + registry.add("hGenPartRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis -- gen prompt partly reco signal", HistType::kTHnSparseF, thnGenPromptAxes); + registry.add("hGenPartRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis -- gen non-prompt partly reco signal", HistType::kTHnSparseF, thnGenNonPromptAxes); + } + } + if (activateTHnSparseCosThStarProduction) { + registry.add("hGenPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis -- gen prompt signal", HistType::kTHnSparseF, thnGenPromptAxes); + registry.add("hGenNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis -- gen non-prompt signal", HistType::kTHnSparseF, thnGenNonPromptAxes); + if (activatePartRecoDstar && (doprocessDstarMc || doprocessDstarMcWithMl)) { + registry.add("hGenPartRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis -- gen prompt partly reco signal", HistType::kTHnSparseF, thnGenPromptAxes); + registry.add("hGenPartRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis -- gen non-prompt partly reco signal", HistType::kTHnSparseF, thnGenNonPromptAxes); + } + } + if (activateTHnSparseCosThStarJetAxis) { + thnGenPromptAxes.insert(thnGenPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); + thnGenNonPromptAxes.insert(thnGenNonPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); + registry.add("hGenPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis -- gen prompt signal", HistType::kTHnSparseF, thnGenPromptAxes); + registry.add("hGenNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis -- gen non-prompt signal", HistType::kTHnSparseF, thnGenNonPromptAxes); + if (activatePartRecoDstar && (doprocessDstarMc || doprocessDstarMcWithMl)) { + registry.add("hGenPartRecoPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis -- gen prompt partly reco signal", HistType::kTHnSparseF, thnGenPromptAxes); + registry.add("hGenPartRecoNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis -- gen non-prompt partly reco signal", HistType::kTHnSparseF, thnGenNonPromptAxes); + } + } + } + // inv. mass hypothesis to loop over + nMassHypos = 1; + }; // end init + + /// \param invMassCharmHad is the invariant-mass of the candidate + /// \param ptCharmHad is the pt of the candidate + /// \param rapCharmHad is the rapidity of the candidate + /// \param invMassD0 is the invariant-mass of the D0 daugher (only for D*+) + /// \param cosThetaStar is the cosThetaStar of the candidate + /// \param outputMl is the array with ML output scores + /// \param isRotatedCandidate is a flag that keeps the info of the rotation of the candidate for bkg studies + /// \param origin is the MC origin + /// \param ptBhadMother is the pt of the b-hadron mother (only in case of non-prompt) + /// \param absEtaMin is the minimum absolute eta of the daughter tracks + /// \param numItsClsMin is the minimum number of ITS clusters of the daughter tracks + /// \param numTpcClsMin is the minimum number of TPC clusters of the daughter tracks + /// \param nMuons is the number of muons from daughter decays + /// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar meson (MC only) + template + void fillRecoHistos(float invMassCharmHad, float ptCharmHad, float rapCharmHad, float invMassD0, float cosThetaStar, std::array outputMl, int isRotatedCandidate, int8_t origin, float ptBhadMother, float absEtaMin, int numItsClsMin, int numTpcClsMin, int8_t nMuons, bool isPartRecoDstar, float zParallel, float jetPt) + { + + if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity + if constexpr (!doMc) { // data + if constexpr (withMl) { // with ML + if (activateTrackingSys) { + if (nBkgRotations > 0) { + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } else { + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } + } else { + if (nBkgRotations > 0) { + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } else { + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } + } + } else { // without ML + if (activateTrackingSys) { + if (nBkgRotations > 0) { + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + } else { + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin); + } + } else { + if (nBkgRotations > 0) { + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate); + } else { + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar); + } + } + } + } else { // MC --> no distinction among channels, since rotational bkg not supported + if constexpr (withMl) { // with ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + } else { + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + } else { + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + } + } + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + } else { + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + } else { + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + } + } + } + } else { // without ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); + } else { + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons); + } else { + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons); + } + } + + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons); + } else { + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons); + } else { + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons); + } + } + + } + } + } + } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production + if constexpr (!doMc) { // data + if constexpr (withMl) { // with ML + if (activateTrackingSys) { + if (nBkgRotations > 0) { + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } else { + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } + } else { + if (nBkgRotations > 0) { + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } else { + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } + } + } else { // without ML + if (activateTrackingSys) { + if (nBkgRotations > 0) { + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + } else { + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin); + } + } else { + if (nBkgRotations > 0) { + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate); + } else { + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar); + } + } + } + } else { // MC --> no distinction among channels, since rotational bkg not supported + if constexpr (withMl) { // with ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + } else { + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + } else { + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + } + } + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + } else { + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + } else { + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + } + } + } + } else { // without ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); + } else { + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons); + } else { + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons); + } + } + + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons); + } else { + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons); + } else { + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons); + } + } + + } + } + } + } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis + if constexpr (!doMc) { // data + if constexpr (withMl) { // with ML + if (activateTrackingSys) { + if (nBkgRotations > 0) { + registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + } else { + registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + } + } else { + if (nBkgRotations > 0) { + registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + } else { + registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + } + } + } else { // without ML + if (activateTrackingSys) { + if (nBkgRotations > 0) { + registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, zParallel, jetPt); + } else { + registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, zParallel, jetPt); + } + } else { + if (nBkgRotations > 0) { + registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, zParallel, jetPt); + } else { + registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, zParallel, jetPt); + } + } + } + } else { // MC --> no distinction among channels, since rotational bkg not supported + if constexpr (withMl) { // with ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } + } + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + } + } + } + } else { // without ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); + } + } + + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + } + } + + } + } + } + } + } + + /// \param ptCharmHad is the pt of the particle + /// \param rapCharmHad is the rapidity of the particle + /// \param cosThetaStar is the cosThetaStar of the particle + /// \param origin is the MC origin + /// \param ptBhadMother is the pt of the b-hadron mother (only in case of non-prompt) + /// \param areDausInAcc is a flag indicating whether the daughters are in acceptance or not + /// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar->D0pi->Kpipipi0 meson (MC only) + template + void fillGenHistos(float ptCharmHad, float rapCharmHad, float cosThetaStar, int8_t origin, float ptBhadMother, bool areDausInAcc, int8_t charge, bool isPartRecoDstar) + { + if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (!isPartRecoDstar) { + registry.fill(HIST("hGenPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + } else { + registry.fill(HIST("hGenPartRecoPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + } + } else { // non-prompt + if (!isPartRecoDstar) { + registry.fill(HIST("hGenNonPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + } else { + registry.fill(HIST("hGenPartRecoNonPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + } + } + } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (!isPartRecoDstar) { + registry.fill(HIST("hGenPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + } else { + registry.fill(HIST("hGenPartRecoPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + } + } else { // non-prompt + if (!isPartRecoDstar) { + registry.fill(HIST("hGenNonPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + } else { + registry.fill(HIST("hGenPartRecoNonPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + } + } + } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (!isPartRecoDstar) { + registry.fill(HIST("hGenPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + } else { + registry.fill(HIST("hGenPartRecoPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + } + } else { // non-prompt + if (!isPartRecoDstar) { + registry.fill(HIST("hGenNonPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + } else { + registry.fill(HIST("hGenPartRecoNonPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + } + } + } + } + + /// \param invMass is the invariant mass + /// \return true if candidate in signal region + template + bool isInSignalRegion(float invMass) + { + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if (0.142f < invMass && invMass < 0.15f) { + return true; + } + } + + return false; + } + + /// \param daughter is the daughter particle + /// \param ptMin is the minimum pt + /// \param etaMax is the maximum eta + /// \return true if daughter is in acceptance + template + bool isDaughterInAcceptance(Part const& daughter, float ptMin, float etaMax) + { + if (daughter.pt() < ptMin) { + return false; + } + if (std::abs(daughter.eta()) > etaMax) { + return false; + } + return true; + } + + /// \param prongTrack is the track we want to find the mother of + /// \param idMothers is the vector containing the mother IDs + /// \param particles are the MC particles + template + void searchFirstLevelMother(Trk const& prongTrack, std::vector& idMothers, Part const& /*particles*/) + { + /// particle associated to the prong track + if (!prongTrack.has_mcParticle()) { + return; + } + auto prongParticle = prongTrack.template mcParticle_as(); + /// leave the vector of mother indices empty if the currect paticle has no mothers + if (!prongParticle.has_mothers()) { + return; + } + // loop over the mother particles of the analysed particle + for (auto iMother = prongParticle.mothersIds().front(); iMother <= prongParticle.mothersIds().back(); ++iMother) { + idMothers.push_back(iMother); + break; // we keep only the first one + } + }; + + /// prongTracks is the vector of daughter tracks + /// etaMin is the minimum eta + /// nItsClsMin is the minumum number of clusters in ITS + /// nTpcClsMin is the minumum number of clusters in TPC + template + void getTrackingInfos(std::vector const& prongTracks, float& etaMin, int& nItsClsMin, int& nTpcClsMin) + { + etaMin = 10.f; + nItsClsMin = 10; + nTpcClsMin = 1000; + + for (const auto& track : prongTracks) { + if (std::abs(track.eta()) < etaMin) { + etaMin = std::abs(track.eta()); + } + if (track.itsNCls() < nItsClsMin) { + nItsClsMin = track.itsNCls(); + } + if (track.tpcNClsCrossedRows() < nTpcClsMin) { + nTpcClsMin = track.tpcNClsCrossedRows(); + } + } + } + + /// \param candidates are the selected candidates + /// \param bkgRotationId is the id for the background rotation + /// \param particles are the generated particles + /// \param tracks are the reconstructed tracks + /// \return true if candidate in signal region + template + bool runPolarisationAnalysis(Jet const& jet, Cand const& candidate, int bkgRotationId, Trk const& /*tracks*/) + { + bool isCandidateInSignalRegion{false}; + int8_t origin{RecoDecay::OriginType::None}; + float ptBhadMother{-1.f}; + bool partRecoDstar{false}; + if constexpr (doMc) { + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + partRecoDstar = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPiPi0 && std::abs(candidate.flagMcMatchRecCharm()) == hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiKPi0; + bool signalDstar = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi && std::abs(candidate.flagMcMatchRecCharm()) == hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; + if (!signalDstar && (!partRecoDstar || !activatePartRecoDstar)) { // this candidate is not signal and not partially reconstructed signal, skip + return isCandidateInSignalRegion; + } + origin = candidate.originMcRec(); + ptBhadMother = candidate.ptBhadMotherPart(); + int pdgBhadMother = candidate.pdgBhadMotherPart(); + // For unknown reasons there are charm hadrons coming directly from beauty diquarks without an intermediate B-hadron which have an unreasonable correlation between the pT of the charm hadron and the beauty mother. We also remove charm hadrons from quarkonia. + if (origin == RecoDecay::OriginType::NonPrompt && (pdgBhadMother == 5101 || pdgBhadMother == 5103 || pdgBhadMother == 5201 || pdgBhadMother == 5203 || pdgBhadMother == 5301 || pdgBhadMother == 5303 || pdgBhadMother == 5401 || pdgBhadMother == 5403 || pdgBhadMother == 5503 || pdgBhadMother == 553 || pdgBhadMother == 555 || pdgBhadMother == 553 || pdgBhadMother == 557)) { + return isCandidateInSignalRegion; + } + } + } + + // loop over mass hypotheses + for (uint8_t iMass = 0u; iMass < nMassHypos; iMass++) { + + // variable definition + float pxDau{-1000.f}, pyDau{-1000.f}, pzDau{-1000.f}; + float pxCharmHad{-1000.f}, pyCharmHad{-1000.f}, pzCharmHad{-1000.f}; + float massDau{0.f}, invMassCharmHad{0.f}, invMassCharmHadForSparse{0.f}, invMassD0{0.f}; + float rapidity{-999.f}; + std::array outputMl{-1.f, -1.f, -1.f}; + int isRotatedCandidate = 0; // currently meaningful only for Lc->pKpi + + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + // Dstar analysis + // polarization measured from the soft-pion daughter (*) + + massDau = massPi; // (*) + const float bkgRotAngle = (bkgRotationId > 0) ? minRotAngleMultByPi * constants::math::PI + bkgRotationAngleStep * (bkgRotationId - 1) : 0; + + std::array threeVecSoftPi{candidate.pxProng1() * std::cos(bkgRotAngle) - candidate.pyProng1() * std::sin(bkgRotAngle), candidate.pxProng1() * std::sin(bkgRotAngle) + candidate.pyProng1() * std::cos(bkgRotAngle), candidate.pzProng1()}; // we rotate the soft pion + std::array threeVecD0Prong0{candidate.pxProng0Charm(), candidate.pyProng0Charm(), candidate.pzProng0Charm()}; + std::array threeVecD0Prong1{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()}; + if (bkgRotationId > 0) { + isRotatedCandidate = 1; + pxDau = threeVecSoftPi[0]; + pyDau = threeVecSoftPi[1]; + pzDau = threeVecSoftPi[2]; + pxCharmHad = threeVecSoftPi[0] + threeVecD0Prong0[0] + threeVecD0Prong1[0]; + pyCharmHad = threeVecSoftPi[1] + threeVecD0Prong0[1] + threeVecD0Prong1[1]; + pzCharmHad = threeVecSoftPi[2] + threeVecD0Prong0[2] + threeVecD0Prong1[2]; + if (candidate.signProng1() > 0) { + invMassCharmHad = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1, threeVecSoftPi}, std::array{massPi, massKaon, massPi}); + invMassD0 = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1}, std::array{massPi, massKaon}); + } else { + invMassCharmHad = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1, threeVecSoftPi}, std::array{massKaon, massPi, massPi}); + invMassD0 = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1}, std::array{massKaon, massPi}); + } + rapidity = RecoDecay::y(std::array{pxCharmHad, pyCharmHad, pzCharmHad}, massDstar); + } else { + isRotatedCandidate = 0; + pxDau = candidate.pxProng1(); + pyDau = candidate.pyProng1(); + pzDau = candidate.pzProng1(); + pxCharmHad = pxDau + candidate.pxProng0Charm() + candidate.pxProng1Charm(); + pyCharmHad = pyDau + candidate.pyProng0Charm() + candidate.pyProng1Charm(); + pzCharmHad = pzDau + candidate.pzProng0Charm() + candidate.pzProng1Charm(); + invMassCharmHad = candidate.m(); + invMassD0 = candidate.invMassCharm(); + rapidity = candidate.y(); + } + invMassCharmHadForSparse = invMassCharmHad - invMassD0; + + if constexpr (withMl) { + outputMl[0] = candidate.mlScores()[0]; + outputMl[1] = candidate.mlScores()[1]; + outputMl[2] = candidate.mlScores()[2]; + } + } + + if (invMassCharmHadForSparse < minInvMass || invMassCharmHadForSparse > maxInvMass) { + continue; + } + + /// apply rapidity selection on the reconstructed candidate + if (std::abs(rapidity) > rapidityCut) { + continue; + } + + ROOT::Math::PxPyPzMVector fourVecDau = ROOT::Math::PxPyPzMVector(pxDau, pyDau, pzDau, massDau); + ROOT::Math::PxPyPzMVector fourVecMother = ROOT::Math::PxPyPzMVector(pxCharmHad, pyCharmHad, pzCharmHad, invMassCharmHad); + ROOT::Math::Boost boost{fourVecMother.BoostToCM()}; + ROOT::Math::PxPyPzMVector fourVecDauCM = boost(fourVecDau); + ROOT::Math::XYZVector threeVecDauCM = fourVecDauCM.Vect(); + ROOT::Math::PxPyPzMVector fourVecJet = ROOT::Math::PxPyPzMVector(jet.px(), jet.py(), jet.pz(), jet.mass()); + ROOT::Math::PxPyPzMVector fourVecJetCM = boost(fourVecJet); + + float ptCharmHad = std::sqrt(pxCharmHad * pxCharmHad + pyCharmHad * pyCharmHad); // this definition is valid for both rotated and original candidates + + if (!isCandidateInSignalRegion) { // it could be that only one mass hypothesis is in signal region + isCandidateInSignalRegion = isInSignalRegion(invMassCharmHadForSparse); + } + + float absEtaTrackMin{-1.f}; + int numItsClsMin{-1}, numTpcClsMin{-1}; + + if (activateTrackingSys) { + // const auto& hfBase = static_cast(candidate); + auto trackProng0 = candidate.template prong0_as(); + auto trackProng1 = candidate.template prong1_as(); + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + auto trackProng2 = candidate.template prong2_as(); + getTrackingInfos(std::vector{trackProng0, trackProng1, trackProng2}, absEtaTrackMin, numItsClsMin, numTpcClsMin); + } + } + + // helicity + ROOT::Math::XYZVector helicityVec = fourVecMother.Vect(); + float cosThetaStarHelicity = -10.f; + // production + ROOT::Math::XYZVector normalVec = ROOT::Math::XYZVector(pyCharmHad, -pxCharmHad, 0.f); + float cosThetaStarProduction = -10.f; + // beam axis + ROOT::Math::XYZVector beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); + // jet axis + ROOT::Math::XYZVector jetaxisVec = fourVecJetCM.Vect(); + float cosThetaStarJet = -10.f; + + float zParallel = helicityVec.Dot(jetaxisVec) / std::sqrt(jetaxisVec.Mag2()); + float jetPt = jet.pt(); + + int8_t nMuons{0u}; + if constexpr (doMc) { + nMuons = candidate.nTracksDecayed(); + } + + if (activateTHnSparseCosThStarHelicity) { + // helicity + cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarHelicity, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + } + if (activateTHnSparseCosThStarProduction) { + // production + cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarProduction, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + } + if (activateTHnSparseCosThStarJetAxis) { + // jet axis + cosThetaStarJet = jetaxisVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(jetaxisVec.Mag2()); + fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarJet, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + } + } /// end loop over mass hypotheses + + return isCandidateInSignalRegion; + } + + /// \param mcParticle is the Mc particle + /// \param mcParticles is the table of Mc particles + template + void runMcGenPolarisationAnalysis(Jet const& jet, Part const& mcParticle, Particles const& mcParticles) + { + int8_t origin{RecoDecay::OriginType::None}; + std::vector listDaughters{}; + float massDau{0.f}, massCharmHad{0.f}; + bool areDauInAcc{true}; + int8_t charge = -99; + bool partRecoDstar{false}; + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + partRecoDstar = TESTBIT(std::abs(mcParticle.flagMcMatchGen()), aod::hf_cand_dstar::DecayType::DstarToD0PiPi0) && TESTBIT(std::abs(mcParticle.flagMcMatchGenCharm()), aod::hf_cand_dstar::DecayType::D0ToPiKPi0); + bool signalDstar = TESTBIT(std::abs(mcParticle.flagMcMatchGen()), aod::hf_cand_dstar::DecayType::DstarToD0Pi) && TESTBIT(std::abs(mcParticle.flagMcMatchGenCharm()), aod::hf_cand_dstar::DecayType::D0ToPiK); + + if (!signalDstar && (!activatePartRecoDstar || !partRecoDstar)) { // this particle is not signal and not partially reconstructed signal, skip + return; + } + origin = mcParticle.originMcGen(); + if (origin == RecoDecay::OriginType::NonPrompt) { + auto bHadMother = mcParticles.rawIteratorAt(mcParticle.idxBhadMotherPart() - mcParticles.offset()); + int pdgBhadMother = std::abs(bHadMother.pdgCode()); + // For unknown reasons there are charm hadrons coming directly from beauty diquarks without an intermediate B-hadron which have an unreasonable correlation between the pT of the charm hadron and the beauty mother. We also remove charm hadrons from quarkonia. + if (pdgBhadMother == 5101 || pdgBhadMother == 5103 || pdgBhadMother == 5201 || pdgBhadMother == 5203 || pdgBhadMother == 5301 || pdgBhadMother == 5303 || pdgBhadMother == 5401 || pdgBhadMother == 5403 || pdgBhadMother == 5503 || pdgBhadMother == 553 || pdgBhadMother == 555 || pdgBhadMother == 553 || pdgBhadMother == 557) { + return; + } + ptBhadMother = bHadMother.pt(); + } + + std::array dauPdgs = {kPiPlus, o2::constants::physics::Pdg::kD0}; + RecoDecay::getDaughters(mcParticle, &listDaughters, dauPdgs, 1); + massDau = massPi; + massCharmHad = massDstar; + } + float rapidity = mcParticle.y(); + if (std::abs(rapidity) > 1.f) { // we do not keep particles with |y| > 1 + return; + } + + float pxCharmHad = mcParticle.px(); + float pyCharmHad = mcParticle.py(); + float pzCharmHad = mcParticle.pz(); + float ptCharmHad = mcParticle.pt(); + + float pxDau{-1000.f}, pyDau{-1000.f}, pzDau{-1000.f}; + for (const auto& dauIdx : listDaughters) { + auto dauPart = mcParticles.rawIteratorAt(dauIdx - mcParticles.offset()); + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + if (std::abs(dauPart.pdgCode()) == kPiPlus) { + pxDau = dauPart.px(); + pyDau = dauPart.py(); + pzDau = dauPart.pz(); + if (areDauInAcc) { + areDauInAcc = isDaughterInAcceptance(dauPart, 0.1, 0.8); + } + } else if (areDauInAcc) { // check also D0 daughters + std::vector listDaughtersD0{}; + std::array dauPdgsD0 = {kPiPlus, -kKPlus}; + RecoDecay::getDaughters(mcParticle, &listDaughtersD0, dauPdgsD0, 1); + for (const auto& dauIdxD0 : listDaughtersD0) { + auto dauPartD0 = mcParticles.rawIteratorAt(dauIdxD0 - mcParticles.offset()); + if (areDauInAcc) { + areDauInAcc = isDaughterInAcceptance(dauPartD0, 0.3, 0.8); + } + } + } + } + } + + ROOT::Math::PxPyPzMVector fourVecDau = ROOT::Math::PxPyPzMVector(pxDau, pyDau, pzDau, massDau); + ROOT::Math::PxPyPzMVector fourVecMother = ROOT::Math::PxPyPzMVector(pxCharmHad, pyCharmHad, pzCharmHad, massCharmHad); + ROOT::Math::Boost boost{fourVecMother.BoostToCM()}; + ROOT::Math::PxPyPzMVector fourVecDauCM = boost(fourVecDau); + ROOT::Math::XYZVector threeVecDauCM = fourVecDauCM.Vect(); + ROOT::Math::PxPyPzMVector fourVecJet = ROOT::Math::PxPyPzMVector(jet.px(), jet.py(), jet.pz(), jet.mass()); + ROOT::Math::PxPyPzMVector fourVecJetCM = boost(fourVecJet); + + if (activateTHnSparseCosThStarHelicity) { + ROOT::Math::XYZVector helicityVec = fourVecMother.Vect(); + float cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); + fillGenHistos(ptCharmHad, rapidity, cosThetaStarHelicity, origin, ptBhadMother, areDauInAcc, charge, partRecoDstar); + } + if (activateTHnSparseCosThStarProduction) { + ROOT::Math::XYZVector normalVec = ROOT::Math::XYZVector(pyCharmHad, -pxCharmHad, 0.f); + float cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); + fillGenHistos(ptCharmHad, rapidity, cosThetaStarProduction, origin, ptBhadMother, areDauInAcc, charge, partRecoDstar); + } + if (activateTHnSparseCosThStarJetAxis) { + ROOT::Math::XYZVector jetaxisVec = fourVecJetCM.Vect(); + float cosThetaStarJet = jetaxisVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(jetaxisVec.Mag2()); + fillGenHistos(ptCharmHad, rapidity, cosThetaStarJet, origin, ptBhadMother, areDauInAcc, charge, partRecoDstar); + } + } + + ///////////////////////// + // Dstar analysis /// + ///////////////////////// + + // Dstar with rectangular cuts + void processDstar(aod::JetCollisions const& collisions, + DstarJets const& jets, + aod::CandidatesDstarData const&, + TracksWithExtra const& tracks) + { + for (const auto& collision : collisions) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; + } + auto thisCollId = collision.globalIndex(); + int nCands{0}, nCandsInSignalRegion{0}; + auto groupedDstarjets = jets.sliceBy(dstarJetsPerCollision, thisCollId); + for (const auto& jet : groupedDstarjets){ + for (const auto& dstarCandidate : jet.candidates_as()){ + nCands++; + if (runPolarisationAnalysis(jet, dstarCandidate, 0, tracks)) { + nCandsInSignalRegion++; + } + for (int iRotation{1}; iRotation <= nBkgRotations; ++iRotation) { + runPolarisationAnalysis(jet, dstarCandidate, iRotation, tracks); + } + break; // hf jet should have only one Dstar candidate but for safety + } + } + } + } + PROCESS_SWITCH(TaskPolarisationDstarInJet, processDstar, "Process Dstar candidates without ML", true); + + // Dstar with ML cuts + void processDstarWithMl(aod::JetCollisions const& collisions, + DstarJets const& jets, + aod::CandidatesDstarData const&, + TracksWithExtra const& tracks) + { + for (const auto& collision : collisions) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; + } + auto thisCollId = collision.globalIndex(); + int nCands{0}, nCandsInSignalRegion{0}; + auto groupedDstarJets = jets.sliceBy(dstarJetsPerCollision, thisCollId); + for (const auto& jet : jets){ + for (const auto& dstarCandidate : jet.candidates_as()){ + nCands++; + if (runPolarisationAnalysis(jet, dstarCandidate, 0, tracks)) { + nCandsInSignalRegion++; + } + for (int iRotation{1}; iRotation <= nBkgRotations; ++iRotation) { + runPolarisationAnalysis(jet, dstarCandidate, iRotation, tracks); + } + break; // hf jet should have only one Dstar candidate but for safety + } + } + } + } + PROCESS_SWITCH(TaskPolarisationDstarInJet, processDstarWithMl, "Process Dstar candidates with ML", false); + + // Dstar in MC with rectangular cuts + void processDstarMc(aod::JetMcCollisions const& mcCollisions, + aod::JetCollisions const& collisions, + JetMCDTable const& mcdJets, + JetMCPTable const& mcpJets, + aod::CandidatesDstarMCD const&, + aod::CandidatesDstarMCP const&, + TracksWithExtra const& tracks) + { + for (const auto& mcCollision : mcCollisions){ + const auto collisionsPerMCCollision = collisions.sliceBy(collisionsPerMCCollisionPreslice, mcCollision.globalIndex()); + for (const auto& collision : collisionsPerMCCollision){ + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + continue; + } + + int nCands{0}, nCandsInSignalRegion{0}; + const auto dstarMcDJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); + for (const auto& mcdJet : dstarMcDJetsPerCollision){ + for (const auto& mcdDstarCand : mcdJet.candidates_as()){ + nCands++; + if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0, tracks)) { + nCandsInSignalRegion++; + } + break; + } + } + } + + const auto dstarMcpJetsPerMcCollision = mcpJets.sliceBy(dstarMCPJetsPerMCCollisionPreslice, collision.globalIndex()); + for (const auto& mcpJet : dstarMcpJetsPerMcCollision){ + const auto mcpDstarCands = mcpJet.candidates_as(); + for (const auto& mcpDstarCand : mcpDstarCands){ + runMcGenPolarisationAnalysis(mcpJet, mcpDstarCand, mcpDstarCands); + break; + } + } + } + } + PROCESS_SWITCH(TaskPolarisationDstarInJet, processDstarMc, "Process Dstar candidates in MC without ML", false); + + // Dstar in MC with ML cuts + void processDstarMcWithMl(aod::JetMcCollisions const& mcCollisions, + aod::JetCollisions const& collisions, + JetMCDTable const& mcdJets, + JetMCPTable const& mcpJets, + aod::CandidatesDstarMCD const&, + aod::CandidatesDstarMCP const&, + TracksWithExtra const& tracks) + { + for (const auto& mcCollision : mcCollisions){ + const auto collisionsPerMCCollision = collisions.sliceBy(collisionsPerMCCollisionPreslice, mcCollision.globalIndex()); + for (const auto& collision : collisionsPerMCCollision){ + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + continue; + } + + int nCands{0}, nCandsInSignalRegion{0}; + + const auto dstarmcdJetsPerCollision = mcdjets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); + for (const auto& mcdjet : dstarmcdJetsPerCollision){ + for (const auto& mcddstarcand : mcdjet.candidates_as()){ + nCands++; + if (runPolarisationAnalysis(mcdjet, mcddstarcand, 0, tracks)) { + nCandsInSignalRegion++; + } + } + } + } + + const auto dstarMcpJetsPerMcCollision = mcpJets.sliceBy(dstarMCPJetsPerMCCollisionPreslice, collision.globalIndex()); + for (const auto& mcpJet : dstarMcpJetsPerMcCollision){ + const auto mcpDstarCands = mcpJet.candidates_as(); + for (const auto& mcpDstarCand : mcpDstarCands){ + runMcGenPolarisationAnalysis(mcpJet, mcpDstarCand, mcpDstarCands); + } + } + } + } + PROCESS_SWITCH(TaskPolarisationDstarInJet, processDstarMcWithMl, "Process Dstar candidates in MC with ML", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 2800c820c9732f17152b4e7c2a6b64554f21464f Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Mon, 4 Aug 2025 16:52:00 +0200 Subject: [PATCH 02/26] data should be fine but mc.... --- PWGHF/DataModel/DerivedTables.h | 6 + .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 277 ++++-------------- .../derivedDataCreatorDstarToD0Pi.cxx | 40 ++- 3 files changed, 95 insertions(+), 228 deletions(-) diff --git a/PWGHF/DataModel/DerivedTables.h b/PWGHF/DataModel/DerivedTables.h index e3602a0ba63..3917627c547 100644 --- a/PWGHF/DataModel/DerivedTables.h +++ b/PWGHF/DataModel/DerivedTables.h @@ -356,6 +356,9 @@ DECLARE_SOA_COLUMN(PtProngPi1, ptProngPi1, float); DECLARE_SOA_COLUMN(RSecondaryVertex, rSecondaryVertex, float); //! distance of the secondary vertex from the z axis // D*± → D0(bar) π± DECLARE_SOA_COLUMN(SignProng1, signProng1, int8_t); +DECLARE_SOA_COLUMN(AbsEtaTrackMin, absEtaTrackMin, float); +DECLARE_SOA_COLUMN(NumItsClsMin, numItsClsMin, int); +DECLARE_SOA_COLUMN(NumTpcClsMin, numTpcClsMin, int); // TOF DECLARE_SOA_COLUMN(NSigTofKa0, nSigTofKa0, float); DECLARE_SOA_COLUMN(NSigTofKa1, nSigTofKa1, float); @@ -963,6 +966,9 @@ DECLARE_SOA_TABLE_STAGED(HfDstarPars, "HFDSTPAR", //! Table with candidate prope hf_cand_par::NSigTpcPi1, hf_cand_par::NSigTofPi1, hf_cand_par::NSigTpcTofPi1, + hf_cand_par::AbsEtaTrackMin, + hf_cand_par::NumItsClsMin, + hf_cand_par::NumTpcClsMin, o2::soa::Marker); DECLARE_SOA_TABLE_STAGED(HfDstarParD0s, "HFDSTPARD0", //! Table with candidate properties used for selection diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index fac4db45cae..7ba850ba4cb 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -186,6 +186,7 @@ struct TaskPolarisationDstarInJet { const AxisSpec thnAxisCharge{configThnAxisCharge, "charge"}; const AxisSpec thnAxisProjection{configThnAxisProjection, "z_{||}"}; const AxisSpec thnAxisJetPt{configThnAxisJetPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec thnAxisSelFlag{2, -0.5f, 1.5f, "Sel flag"}; auto invMassBins = thnAxisInvMass.binEdges; minInvMass = invMassBins.front(); @@ -204,50 +205,50 @@ struct TaskPolarisationDstarInJet { std::vector thnRecPromptAxes = thnRecDataAxes; std::vector thnRecNonPromptAxes = thnRecDataAxes; - // Data histos - if (activateTHnSparseCosThStarHelicity) { - registry.add("hHelicity", "THn for polarisation studies with cosThStar ", HistType::kTHnSparseF, thnRecDataAxes); - } - if (activateTHnSparseCosThStarProduction) { - registry.add("hProduction", "THn for polarisation studies with cosThStar w.r.t. production axis", HistType::kTHnSparseF, thnRecDataAxes); - } - if (activateTHnSparseCosThStarJetAxis) { - thnRecDataAxes.insert(thnRecDataAxes.end(), {thnAxisProjection, thnAxisJetPt}); - registry.add("hJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis", HistType::kTHnSparseF, thnRecDataAxes); - } - - // MC Reco histos - thnRecPromptAxes.push_back(thnAxisDauToMuons); - thnRecNonPromptAxes.insert(thnRecNonPromptAxes.end(), {thnAxisPtB, thnAxisDauToMuons}); - if (activateTHnSparseCosThStarHelicity) { - registry.add("hRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); - registry.add("hRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); - if (activatePartRecoDstar) { - registry.add("hPartRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); - registry.add("hPartRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- partially reco non-prompt signal" , HistType::kTHnSparseF, thnRecNonPromptAxes); + if (doprocessDstar || doprocessDstarWithMl) { + // Data histos + if (activateTHnSparseCosThStarHelicity) { + registry.add("hHelicity", "THn for polarisation studies with cosThStar ", HistType::kTHnSparseF, thnRecDataAxes); } - } - if (activateTHnSparseCosThStarProduction) { - registry.add("hRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); - registry.add("hRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); - if (activatePartRecoDstar) { - registry.add("hPartRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); - registry.add("hPartRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- partially reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + if (activateTHnSparseCosThStarProduction) { + registry.add("hProduction", "THn for polarisation studies with cosThStar w.r.t. production axis", HistType::kTHnSparseF, thnRecDataAxes); } - } - if (activateTHnSparseCosThStarJetAxis) { - thnRecPromptAxes.insert(thnRecPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); - thnRecNonPromptAxes.insert(thnRecNonPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); - registry.add("hRecoPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); - registry.add("hRecoNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); - if (activatePartRecoDstar) { - registry.add("hPartRecoPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); - registry.add("hPartRecoNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- partially reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + if (activateTHnSparseCosThStarJetAxis) { + thnRecDataAxes.insert(thnRecDataAxes.end(), {thnAxisProjection, thnAxisJetPt}); + registry.add("hJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis", HistType::kTHnSparseF, thnRecDataAxes); } - } + } else if (doprocessDstarMc || doprocessDstarMcWithMl) { + // MC Reco histos + thnRecPromptAxes.push_back(thnAxisDauToMuons); + thnRecNonPromptAxes.insert(thnRecNonPromptAxes.end(), {thnAxisPtB, thnAxisDauToMuons}); + if (activateTHnSparseCosThStarHelicity) { + registry.add("hRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + if (activatePartRecoDstar) { + registry.add("hPartRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hPartRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- partially reco non-prompt signal" , HistType::kTHnSparseF, thnRecNonPromptAxes); + } + } + if (activateTHnSparseCosThStarProduction) { + registry.add("hRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + if (activatePartRecoDstar) { + registry.add("hPartRecoPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hPartRecoNonPromptProduction", "THn for polarisation studies with cosThStar w.r.t. production axis and BDT scores -- partially reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + } + } + if (activateTHnSparseCosThStarJetAxis) { + thnRecPromptAxes.insert(thnRecPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); + thnRecNonPromptAxes.insert(thnRecNonPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); + registry.add("hRecoPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hRecoNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + if (activatePartRecoDstar) { + registry.add("hPartRecoPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); + registry.add("hPartRecoNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- partially reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); + } + } - // MC Gen histos - if (doprocessDstarMc || doprocessDstarMcWithMl) { + // MC Gen histos std::vector thnGenPromptAxes = {thnAxisPt, thnAxisY, thnAxisCosThetaStar, thnAxisDausAcc, thnAxisCharge}; std::vector thnGenNonPromptAxes = {thnAxisPt, thnAxisY, thnAxisCosThetaStar, thnAxisPtB, thnAxisDausAcc, thnAxisCharge}; @@ -698,30 +699,6 @@ struct TaskPolarisationDstarInJet { } }; - /// prongTracks is the vector of daughter tracks - /// etaMin is the minimum eta - /// nItsClsMin is the minumum number of clusters in ITS - /// nTpcClsMin is the minumum number of clusters in TPC - template - void getTrackingInfos(std::vector const& prongTracks, float& etaMin, int& nItsClsMin, int& nTpcClsMin) - { - etaMin = 10.f; - nItsClsMin = 10; - nTpcClsMin = 1000; - - for (const auto& track : prongTracks) { - if (std::abs(track.eta()) < etaMin) { - etaMin = std::abs(track.eta()); - } - if (track.itsNCls() < nItsClsMin) { - nItsClsMin = track.itsNCls(); - } - if (track.tpcNClsCrossedRows() < nTpcClsMin) { - nTpcClsMin = track.tpcNClsCrossedRows(); - } - } - } - /// \param candidates are the selected candidates /// \param bkgRotationId is the id for the background rotation /// \param particles are the generated particles @@ -808,7 +785,6 @@ struct TaskPolarisationDstarInJet { outputMl[2] = candidate.mlScores()[2]; } } - if (invMassCharmHadForSparse < minInvMass || invMassCharmHadForSparse > maxInvMass) { continue; } @@ -831,19 +807,9 @@ struct TaskPolarisationDstarInJet { if (!isCandidateInSignalRegion) { // it could be that only one mass hypothesis is in signal region isCandidateInSignalRegion = isInSignalRegion(invMassCharmHadForSparse); } - - float absEtaTrackMin{-1.f}; - int numItsClsMin{-1}, numTpcClsMin{-1}; - - if (activateTrackingSys) { - // const auto& hfBase = static_cast(candidate); - auto trackProng0 = candidate.template prong0_as(); - auto trackProng1 = candidate.template prong1_as(); - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { - auto trackProng2 = candidate.template prong2_as(); - getTrackingInfos(std::vector{trackProng0, trackProng1, trackProng2}, absEtaTrackMin, numItsClsMin, numTpcClsMin); - } - } + float absEtaTrackMin = candidate.absEtaTrackMin(); + int numItsClsMin = candidate.numItsClsMin(); + int numTpcClsMin = candidate.numTpcClsMin(); // helicity ROOT::Math::XYZVector helicityVec = fourVecMother.Vect(); @@ -851,8 +817,6 @@ struct TaskPolarisationDstarInJet { // production ROOT::Math::XYZVector normalVec = ROOT::Math::XYZVector(pyCharmHad, -pxCharmHad, 0.f); float cosThetaStarProduction = -10.f; - // beam axis - ROOT::Math::XYZVector beamVec = ROOT::Math::XYZVector(0.f, 0.f, 1.f); // jet axis ROOT::Math::XYZVector jetaxisVec = fourVecJetCM.Vect(); float cosThetaStarJet = -10.f; @@ -864,7 +828,6 @@ struct TaskPolarisationDstarInJet { if constexpr (doMc) { nMuons = candidate.nTracksDecayed(); } - if (activateTHnSparseCosThStarHelicity) { // helicity cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); @@ -885,100 +848,6 @@ struct TaskPolarisationDstarInJet { return isCandidateInSignalRegion; } - /// \param mcParticle is the Mc particle - /// \param mcParticles is the table of Mc particles - template - void runMcGenPolarisationAnalysis(Jet const& jet, Part const& mcParticle, Particles const& mcParticles) - { - int8_t origin{RecoDecay::OriginType::None}; - std::vector listDaughters{}; - float massDau{0.f}, massCharmHad{0.f}; - bool areDauInAcc{true}; - int8_t charge = -99; - bool partRecoDstar{false}; - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { - partRecoDstar = TESTBIT(std::abs(mcParticle.flagMcMatchGen()), aod::hf_cand_dstar::DecayType::DstarToD0PiPi0) && TESTBIT(std::abs(mcParticle.flagMcMatchGenCharm()), aod::hf_cand_dstar::DecayType::D0ToPiKPi0); - bool signalDstar = TESTBIT(std::abs(mcParticle.flagMcMatchGen()), aod::hf_cand_dstar::DecayType::DstarToD0Pi) && TESTBIT(std::abs(mcParticle.flagMcMatchGenCharm()), aod::hf_cand_dstar::DecayType::D0ToPiK); - - if (!signalDstar && (!activatePartRecoDstar || !partRecoDstar)) { // this particle is not signal and not partially reconstructed signal, skip - return; - } - origin = mcParticle.originMcGen(); - if (origin == RecoDecay::OriginType::NonPrompt) { - auto bHadMother = mcParticles.rawIteratorAt(mcParticle.idxBhadMotherPart() - mcParticles.offset()); - int pdgBhadMother = std::abs(bHadMother.pdgCode()); - // For unknown reasons there are charm hadrons coming directly from beauty diquarks without an intermediate B-hadron which have an unreasonable correlation between the pT of the charm hadron and the beauty mother. We also remove charm hadrons from quarkonia. - if (pdgBhadMother == 5101 || pdgBhadMother == 5103 || pdgBhadMother == 5201 || pdgBhadMother == 5203 || pdgBhadMother == 5301 || pdgBhadMother == 5303 || pdgBhadMother == 5401 || pdgBhadMother == 5403 || pdgBhadMother == 5503 || pdgBhadMother == 553 || pdgBhadMother == 555 || pdgBhadMother == 553 || pdgBhadMother == 557) { - return; - } - ptBhadMother = bHadMother.pt(); - } - - std::array dauPdgs = {kPiPlus, o2::constants::physics::Pdg::kD0}; - RecoDecay::getDaughters(mcParticle, &listDaughters, dauPdgs, 1); - massDau = massPi; - massCharmHad = massDstar; - } - float rapidity = mcParticle.y(); - if (std::abs(rapidity) > 1.f) { // we do not keep particles with |y| > 1 - return; - } - - float pxCharmHad = mcParticle.px(); - float pyCharmHad = mcParticle.py(); - float pzCharmHad = mcParticle.pz(); - float ptCharmHad = mcParticle.pt(); - - float pxDau{-1000.f}, pyDau{-1000.f}, pzDau{-1000.f}; - for (const auto& dauIdx : listDaughters) { - auto dauPart = mcParticles.rawIteratorAt(dauIdx - mcParticles.offset()); - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { - if (std::abs(dauPart.pdgCode()) == kPiPlus) { - pxDau = dauPart.px(); - pyDau = dauPart.py(); - pzDau = dauPart.pz(); - if (areDauInAcc) { - areDauInAcc = isDaughterInAcceptance(dauPart, 0.1, 0.8); - } - } else if (areDauInAcc) { // check also D0 daughters - std::vector listDaughtersD0{}; - std::array dauPdgsD0 = {kPiPlus, -kKPlus}; - RecoDecay::getDaughters(mcParticle, &listDaughtersD0, dauPdgsD0, 1); - for (const auto& dauIdxD0 : listDaughtersD0) { - auto dauPartD0 = mcParticles.rawIteratorAt(dauIdxD0 - mcParticles.offset()); - if (areDauInAcc) { - areDauInAcc = isDaughterInAcceptance(dauPartD0, 0.3, 0.8); - } - } - } - } - } - - ROOT::Math::PxPyPzMVector fourVecDau = ROOT::Math::PxPyPzMVector(pxDau, pyDau, pzDau, massDau); - ROOT::Math::PxPyPzMVector fourVecMother = ROOT::Math::PxPyPzMVector(pxCharmHad, pyCharmHad, pzCharmHad, massCharmHad); - ROOT::Math::Boost boost{fourVecMother.BoostToCM()}; - ROOT::Math::PxPyPzMVector fourVecDauCM = boost(fourVecDau); - ROOT::Math::XYZVector threeVecDauCM = fourVecDauCM.Vect(); - ROOT::Math::PxPyPzMVector fourVecJet = ROOT::Math::PxPyPzMVector(jet.px(), jet.py(), jet.pz(), jet.mass()); - ROOT::Math::PxPyPzMVector fourVecJetCM = boost(fourVecJet); - - if (activateTHnSparseCosThStarHelicity) { - ROOT::Math::XYZVector helicityVec = fourVecMother.Vect(); - float cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); - fillGenHistos(ptCharmHad, rapidity, cosThetaStarHelicity, origin, ptBhadMother, areDauInAcc, charge, partRecoDstar); - } - if (activateTHnSparseCosThStarProduction) { - ROOT::Math::XYZVector normalVec = ROOT::Math::XYZVector(pyCharmHad, -pxCharmHad, 0.f); - float cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); - fillGenHistos(ptCharmHad, rapidity, cosThetaStarProduction, origin, ptBhadMother, areDauInAcc, charge, partRecoDstar); - } - if (activateTHnSparseCosThStarJetAxis) { - ROOT::Math::XYZVector jetaxisVec = fourVecJetCM.Vect(); - float cosThetaStarJet = jetaxisVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(jetaxisVec.Mag2()); - fillGenHistos(ptCharmHad, rapidity, cosThetaStarJet, origin, ptBhadMother, areDauInAcc, charge, partRecoDstar); - } - } - ///////////////////////// // Dstar analysis /// ///////////////////////// @@ -991,17 +860,13 @@ struct TaskPolarisationDstarInJet { { for (const auto& collision : collisions) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { - return; + continue; } auto thisCollId = collision.globalIndex(); - int nCands{0}, nCandsInSignalRegion{0}; auto groupedDstarjets = jets.sliceBy(dstarJetsPerCollision, thisCollId); for (const auto& jet : groupedDstarjets){ for (const auto& dstarCandidate : jet.candidates_as()){ - nCands++; - if (runPolarisationAnalysis(jet, dstarCandidate, 0, tracks)) { - nCandsInSignalRegion++; - } + runPolarisationAnalysis(jet, dstarCandidate, 0, tracks); for (int iRotation{1}; iRotation <= nBkgRotations; ++iRotation) { runPolarisationAnalysis(jet, dstarCandidate, iRotation, tracks); } @@ -1020,19 +885,15 @@ struct TaskPolarisationDstarInJet { { for (const auto& collision : collisions) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { - return; + continue; } auto thisCollId = collision.globalIndex(); - int nCands{0}, nCandsInSignalRegion{0}; auto groupedDstarJets = jets.sliceBy(dstarJetsPerCollision, thisCollId); - for (const auto& jet : jets){ + for (const auto& jet : groupedDstarJets){ for (const auto& dstarCandidate : jet.candidates_as()){ - nCands++; - if (runPolarisationAnalysis(jet, dstarCandidate, 0, tracks)) { - nCandsInSignalRegion++; - } + runPolarisationAnalysis(jet, dstarCandidate, 0, tracks); for (int iRotation{1}; iRotation <= nBkgRotations; ++iRotation) { - runPolarisationAnalysis(jet, dstarCandidate, iRotation, tracks); + runPolarisationAnalysis(jet, dstarCandidate, iRotation, tracks); } break; // hf jet should have only one Dstar candidate but for safety } @@ -1045,7 +906,7 @@ struct TaskPolarisationDstarInJet { void processDstarMc(aod::JetMcCollisions const& mcCollisions, aod::JetCollisions const& collisions, JetMCDTable const& mcdJets, - JetMCPTable const& mcpJets, + JetMCPTable const&, aod::CandidatesDstarMCD const&, aod::CandidatesDstarMCP const&, TracksWithExtra const& tracks) @@ -1056,28 +917,15 @@ struct TaskPolarisationDstarInJet { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { continue; } - - int nCands{0}, nCandsInSignalRegion{0}; const auto dstarMcDJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); for (const auto& mcdJet : dstarMcDJetsPerCollision){ for (const auto& mcdDstarCand : mcdJet.candidates_as()){ - nCands++; if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0, tracks)) { - nCandsInSignalRegion++; } break; } } } - - const auto dstarMcpJetsPerMcCollision = mcpJets.sliceBy(dstarMCPJetsPerMCCollisionPreslice, collision.globalIndex()); - for (const auto& mcpJet : dstarMcpJetsPerMcCollision){ - const auto mcpDstarCands = mcpJet.candidates_as(); - for (const auto& mcpDstarCand : mcpDstarCands){ - runMcGenPolarisationAnalysis(mcpJet, mcpDstarCand, mcpDstarCands); - break; - } - } } } PROCESS_SWITCH(TaskPolarisationDstarInJet, processDstarMc, "Process Dstar candidates in MC without ML", false); @@ -1086,7 +934,7 @@ struct TaskPolarisationDstarInJet { void processDstarMcWithMl(aod::JetMcCollisions const& mcCollisions, aod::JetCollisions const& collisions, JetMCDTable const& mcdJets, - JetMCPTable const& mcpJets, + JetMCPTable const&, aod::CandidatesDstarMCD const&, aod::CandidatesDstarMCP const&, TracksWithExtra const& tracks) @@ -1097,27 +945,14 @@ struct TaskPolarisationDstarInJet { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { continue; } - - int nCands{0}, nCandsInSignalRegion{0}; - - const auto dstarmcdJetsPerCollision = mcdjets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); - for (const auto& mcdjet : dstarmcdJetsPerCollision){ - for (const auto& mcddstarcand : mcdjet.candidates_as()){ - nCands++; - if (runPolarisationAnalysis(mcdjet, mcddstarcand, 0, tracks)) { - nCandsInSignalRegion++; + const auto dstarMcdJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); + for (const auto& mcdJet : dstarMcdJetsPerCollision){ + for (const auto& mcdDstarCand : mcdJet.candidates_as()){ + if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0, tracks)) { } } } } - - const auto dstarMcpJetsPerMcCollision = mcpJets.sliceBy(dstarMCPJetsPerMCCollisionPreslice, collision.globalIndex()); - for (const auto& mcpJet : dstarMcpJetsPerMcCollision){ - const auto mcpDstarCands = mcpJet.candidates_as(); - for (const auto& mcpDstarCand : mcpDstarCands){ - runMcGenPolarisationAnalysis(mcpJet, mcpDstarCand, mcpDstarCands); - } - } } } PROCESS_SWITCH(TaskPolarisationDstarInJet, processDstarMcWithMl, "Process Dstar candidates in MC with ML", false); diff --git a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx index f1b14a5769f..6ec6ee44419 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx @@ -88,7 +88,7 @@ struct HfDerivedDataCreatorDstarToD0Pi { using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; - using TracksWPid = soa::Join; + using TracksWPid = soa::Join; using SelectedCandidates = soa::Filtered>; using SelectedCandidatesMc = soa::Filtered>; using SelectedCandidatesMl = soa::Filtered>; @@ -125,10 +125,38 @@ struct HfDerivedDataCreatorDstarToD0Pi { rowsCommon.init(confDerData); } + /// prongTracks is the vector of daughter tracks + /// etaMin is the minimum eta + /// nItsClsMin is the minumum number of clusters in ITS + /// nTpcClsMin is the minumum number of clusters in TPC + template + void getTrackingInfos(std::vector const& prongTracks, float& etaMin, int& nItsClsMin, int& nTpcClsMin) + { + etaMin = 10.f; + nItsClsMin = 10; + nTpcClsMin = 1000; + + for (const auto& track : prongTracks) { + if (std::abs(track.eta()) < etaMin) { + etaMin = std::abs(track.eta()); + } + if (track.itsNCls() < nItsClsMin) { + nItsClsMin = track.itsNCls(); + } + if (track.tpcNClsCrossedRows() < nTpcClsMin) { + nTpcClsMin = track.tpcNClsCrossedRows(); + } + } + } + template void fillTablesCandidate(const T& candidate, const U& prong0, const U& prong1, const U& prongSoftPi, int candFlag, double invMass, double invMassD0, double y, int8_t flagMc, int8_t flagMcD0, int8_t origin, int8_t nTracksDecayed, double ptBhad, int pdgBhad, const std::vector& mlScores) { + float absEtaTrackMin{-1.f}; + int numItsClsMin{-1}, numTpcClsMin{-1}; + getTrackingInfos(std::vector{prong0, prong1, prongSoftPi}, absEtaTrackMin, numItsClsMin, numTpcClsMin); + rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { rowCandidatePar( @@ -143,7 +171,10 @@ struct HfDerivedDataCreatorDstarToD0Pi { candidate.normalisedImpParamSoftPi(), prongSoftPi.tpcNSigmaPi(), prongSoftPi.tofNSigmaPi(), - prongSoftPi.tpcTofNSigmaPi()); + prongSoftPi.tpcTofNSigmaPi(), + absEtaTrackMin, + numItsClsMin, + numTpcClsMin); } if (fillCandidateParD0) { rowCandidateParD0( @@ -250,11 +281,6 @@ struct HfDerivedDataCreatorDstarToD0Pi { double ptBhadMotherPart = 0; int pdgBhadMotherPart = 0; for (const auto& candidate : candidatesThisColl) { - if constexpr (isMl) { - if (!TESTBIT(candidate.isSelDstarToD0Pi(), aod::SelectionStep::RecoMl)) { - continue; - } - } if constexpr (isMc) { flagMcRec = candidate.flagMcMatchRec(); flagMcRecD0 = candidate.flagMcMatchRecD0(); From c67f9015e92a9a6ecf50b77a0560a567d7db0746 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Tue, 5 Aug 2025 13:23:08 +0200 Subject: [PATCH 03/26] data and Reco Mc only --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 194 +++++++----------- 1 file changed, 79 insertions(+), 115 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 7ba850ba4cb..bc6bf7c274d 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -109,14 +109,12 @@ struct TaskPolarisationDstarInJet { // Tables for MC jet matching using DstarJets = soa::Join; - using JetMCDTable = soa::Join; - using JetMCPTable = soa::Join; + using JetMCDTable = soa::Join; using TracksWithExtra = soa::Join; // slices for accessing proper HF mcdjets collision associated to mccollisions PresliceUnsorted collisionsPerMCCollisionPreslice = aod::jmccollisionlb::mcCollisionId; Preslice dstarMCDJetsPerCollisionPreslice = aod::jet::collisionId; - Preslice dstarMCPJetsPerMCCollisionPreslice = aod::jet::mcCollisionId; Preslice dstarJetsPerCollision = aod::jet::collisionId; HistogramRegistry registry{"registry", {}}; @@ -206,6 +204,7 @@ struct TaskPolarisationDstarInJet { std::vector thnRecNonPromptAxes = thnRecDataAxes; if (doprocessDstar || doprocessDstarWithMl) { + thnRecDataAxes.insert(thnRecDataAxes.end(), {thnAxisProjection, thnAxisJetPt}); // Data histos if (activateTHnSparseCosThStarHelicity) { registry.add("hHelicity", "THn for polarisation studies with cosThStar ", HistType::kTHnSparseF, thnRecDataAxes); @@ -214,13 +213,12 @@ struct TaskPolarisationDstarInJet { registry.add("hProduction", "THn for polarisation studies with cosThStar w.r.t. production axis", HistType::kTHnSparseF, thnRecDataAxes); } if (activateTHnSparseCosThStarJetAxis) { - thnRecDataAxes.insert(thnRecDataAxes.end(), {thnAxisProjection, thnAxisJetPt}); registry.add("hJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis", HistType::kTHnSparseF, thnRecDataAxes); } } else if (doprocessDstarMc || doprocessDstarMcWithMl) { // MC Reco histos - thnRecPromptAxes.push_back(thnAxisDauToMuons); - thnRecNonPromptAxes.insert(thnRecNonPromptAxes.end(), {thnAxisPtB, thnAxisDauToMuons}); + thnRecPromptAxes.insert(thnRecPromptAxes.end(), {thnAxisDauToMuons, thnAxisProjection, thnAxisJetPt}); + thnRecNonPromptAxes.insert(thnRecNonPromptAxes.end(), {thnAxisPtB, thnAxisDauToMuons, thnAxisProjection, thnAxisJetPt}); if (activateTHnSparseCosThStarHelicity) { registry.add("hRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); registry.add("hRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); @@ -238,8 +236,6 @@ struct TaskPolarisationDstarInJet { } } if (activateTHnSparseCosThStarJetAxis) { - thnRecPromptAxes.insert(thnRecPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); - thnRecNonPromptAxes.insert(thnRecNonPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); registry.add("hRecoPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); registry.add("hRecoNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); if (activatePartRecoDstar) { @@ -249,8 +245,8 @@ struct TaskPolarisationDstarInJet { } // MC Gen histos - std::vector thnGenPromptAxes = {thnAxisPt, thnAxisY, thnAxisCosThetaStar, thnAxisDausAcc, thnAxisCharge}; - std::vector thnGenNonPromptAxes = {thnAxisPt, thnAxisY, thnAxisCosThetaStar, thnAxisPtB, thnAxisDausAcc, thnAxisCharge}; + std::vector thnGenPromptAxes = {thnAxisPt, thnAxisY, thnAxisCosThetaStar, thnAxisDausAcc, thnAxisCharge, thnAxisProjection, thnAxisJetPt}; + std::vector thnGenNonPromptAxes = {thnAxisPt, thnAxisY, thnAxisCosThetaStar, thnAxisPtB, thnAxisDausAcc, thnAxisCharge, thnAxisProjection, thnAxisJetPt}; if (activateTHnSparseCosThStarHelicity) { registry.add("hGenPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis -- gen prompt signal", HistType::kTHnSparseF, thnGenPromptAxes); @@ -269,8 +265,6 @@ struct TaskPolarisationDstarInJet { } } if (activateTHnSparseCosThStarJetAxis) { - thnGenPromptAxes.insert(thnGenPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); - thnGenNonPromptAxes.insert(thnGenNonPromptAxes.end(), {thnAxisProjection, thnAxisJetPt}); registry.add("hGenPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis -- gen prompt signal", HistType::kTHnSparseF, thnGenPromptAxes); registry.add("hGenNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis -- gen non-prompt signal", HistType::kTHnSparseF, thnGenNonPromptAxes); if (activatePartRecoDstar && (doprocessDstarMc || doprocessDstarMcWithMl)) { @@ -306,29 +300,29 @@ struct TaskPolarisationDstarInJet { if constexpr (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2]); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } else { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2]); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } } else { if (nBkgRotations > 0) { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2]); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } else { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } } } else { // without ML if (activateTrackingSys) { if (nBkgRotations > 0) { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, zParallel, jetPt); } else { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, zParallel, jetPt); } } else { if (nBkgRotations > 0) { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, zParallel, jetPt); } else { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar); + registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, zParallel, jetPt); } } } @@ -337,29 +331,29 @@ struct TaskPolarisationDstarInJet { if (origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } } } else { // non-prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } } } @@ -367,30 +361,30 @@ struct TaskPolarisationDstarInJet { if (origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons); + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons); + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); } } } else { // non-prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons); + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons); + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons); + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons); + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); } } @@ -402,29 +396,29 @@ struct TaskPolarisationDstarInJet { if constexpr (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2]); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } else { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2]); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } } else { if (nBkgRotations > 0) { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2]); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } else { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } } } else { // without ML if (activateTrackingSys) { if (nBkgRotations > 0) { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, zParallel, jetPt); } else { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, zParallel, jetPt); } } else { if (nBkgRotations > 0) { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, zParallel, jetPt); } else { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar); + registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, zParallel, jetPt); } } } @@ -433,29 +427,29 @@ struct TaskPolarisationDstarInJet { if (origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons); + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } } } else { // non-prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons); + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } } } @@ -463,30 +457,30 @@ struct TaskPolarisationDstarInJet { if (origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons); + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons); + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons); + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); } } } else { // non-prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons); + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons); + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons); + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons); + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); } } @@ -600,48 +594,48 @@ struct TaskPolarisationDstarInJet { /// \param areDausInAcc is a flag indicating whether the daughters are in acceptance or not /// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar->D0pi->Kpipipi0 meson (MC only) template - void fillGenHistos(float ptCharmHad, float rapCharmHad, float cosThetaStar, int8_t origin, float ptBhadMother, bool areDausInAcc, int8_t charge, bool isPartRecoDstar) + void fillGenHistos(float ptCharmHad, float rapCharmHad, float cosThetaStar, int8_t origin, float ptBhadMother, bool areDausInAcc, int8_t charge, bool isPartRecoDstar, float zParallel, float jetPt) { if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { - registry.fill(HIST("hGenPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + registry.fill(HIST("hGenPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } else { - registry.fill(HIST("hGenPartRecoPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + registry.fill(HIST("hGenPartRecoPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } } else { // non-prompt if (!isPartRecoDstar) { - registry.fill(HIST("hGenNonPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + registry.fill(HIST("hGenNonPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge, zParallel, jetPt); } else { - registry.fill(HIST("hGenPartRecoNonPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + registry.fill(HIST("hGenPartRecoNonPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge, zParallel, jetPt); } } } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { - registry.fill(HIST("hGenPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + registry.fill(HIST("hGenPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } else { - registry.fill(HIST("hGenPartRecoPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + registry.fill(HIST("hGenPartRecoPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } } else { // non-prompt if (!isPartRecoDstar) { - registry.fill(HIST("hGenNonPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + registry.fill(HIST("hGenNonPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge, zParallel, jetPt); } else { - registry.fill(HIST("hGenPartRecoNonPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + registry.fill(HIST("hGenPartRecoNonPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge, zParallel, jetPt); } } } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { - registry.fill(HIST("hGenPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + registry.fill(HIST("hGenPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } else { - registry.fill(HIST("hGenPartRecoPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge); + registry.fill(HIST("hGenPartRecoPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } } else { // non-prompt if (!isPartRecoDstar) { - registry.fill(HIST("hGenNonPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + registry.fill(HIST("hGenNonPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge, zParallel, jetPt); } else { - registry.fill(HIST("hGenPartRecoNonPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge); + registry.fill(HIST("hGenPartRecoNonPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge, zParallel, jetPt); } } } @@ -677,35 +671,13 @@ struct TaskPolarisationDstarInJet { return true; } - /// \param prongTrack is the track we want to find the mother of - /// \param idMothers is the vector containing the mother IDs - /// \param particles are the MC particles - template - void searchFirstLevelMother(Trk const& prongTrack, std::vector& idMothers, Part const& /*particles*/) - { - /// particle associated to the prong track - if (!prongTrack.has_mcParticle()) { - return; - } - auto prongParticle = prongTrack.template mcParticle_as(); - /// leave the vector of mother indices empty if the currect paticle has no mothers - if (!prongParticle.has_mothers()) { - return; - } - // loop over the mother particles of the analysed particle - for (auto iMother = prongParticle.mothersIds().front(); iMother <= prongParticle.mothersIds().back(); ++iMother) { - idMothers.push_back(iMother); - break; // we keep only the first one - } - }; - /// \param candidates are the selected candidates /// \param bkgRotationId is the id for the background rotation /// \param particles are the generated particles /// \param tracks are the reconstructed tracks /// \return true if candidate in signal region - template - bool runPolarisationAnalysis(Jet const& jet, Cand const& candidate, int bkgRotationId, Trk const& /*tracks*/) + template + bool runPolarisationAnalysis(Jet const& jet, Cand const& candidate, int bkgRotationId) { bool isCandidateInSignalRegion{false}; int8_t origin{RecoDecay::OriginType::None}; @@ -855,8 +827,7 @@ struct TaskPolarisationDstarInJet { // Dstar with rectangular cuts void processDstar(aod::JetCollisions const& collisions, DstarJets const& jets, - aod::CandidatesDstarData const&, - TracksWithExtra const& tracks) + aod::CandidatesDstarData const&) { for (const auto& collision : collisions) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -866,9 +837,9 @@ struct TaskPolarisationDstarInJet { auto groupedDstarjets = jets.sliceBy(dstarJetsPerCollision, thisCollId); for (const auto& jet : groupedDstarjets){ for (const auto& dstarCandidate : jet.candidates_as()){ - runPolarisationAnalysis(jet, dstarCandidate, 0, tracks); + runPolarisationAnalysis(jet, dstarCandidate, 0); for (int iRotation{1}; iRotation <= nBkgRotations; ++iRotation) { - runPolarisationAnalysis(jet, dstarCandidate, iRotation, tracks); + runPolarisationAnalysis(jet, dstarCandidate, iRotation); } break; // hf jet should have only one Dstar candidate but for safety } @@ -880,8 +851,7 @@ struct TaskPolarisationDstarInJet { // Dstar with ML cuts void processDstarWithMl(aod::JetCollisions const& collisions, DstarJets const& jets, - aod::CandidatesDstarData const&, - TracksWithExtra const& tracks) + aod::CandidatesDstarData const&) { for (const auto& collision : collisions) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { @@ -891,9 +861,9 @@ struct TaskPolarisationDstarInJet { auto groupedDstarJets = jets.sliceBy(dstarJetsPerCollision, thisCollId); for (const auto& jet : groupedDstarJets){ for (const auto& dstarCandidate : jet.candidates_as()){ - runPolarisationAnalysis(jet, dstarCandidate, 0, tracks); + runPolarisationAnalysis(jet, dstarCandidate, 0); for (int iRotation{1}; iRotation <= nBkgRotations; ++iRotation) { - runPolarisationAnalysis(jet, dstarCandidate, iRotation, tracks); + runPolarisationAnalysis(jet, dstarCandidate, iRotation); } break; // hf jet should have only one Dstar candidate but for safety } @@ -906,10 +876,7 @@ struct TaskPolarisationDstarInJet { void processDstarMc(aod::JetMcCollisions const& mcCollisions, aod::JetCollisions const& collisions, JetMCDTable const& mcdJets, - JetMCPTable const&, - aod::CandidatesDstarMCD const&, - aod::CandidatesDstarMCP const&, - TracksWithExtra const& tracks) + aod::CandidatesDstarMCD const&) { for (const auto& mcCollision : mcCollisions){ const auto collisionsPerMCCollision = collisions.sliceBy(collisionsPerMCCollisionPreslice, mcCollision.globalIndex()); @@ -920,7 +887,7 @@ struct TaskPolarisationDstarInJet { const auto dstarMcDJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); for (const auto& mcdJet : dstarMcDJetsPerCollision){ for (const auto& mcdDstarCand : mcdJet.candidates_as()){ - if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0, tracks)) { + if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0)) { } break; } @@ -934,10 +901,7 @@ struct TaskPolarisationDstarInJet { void processDstarMcWithMl(aod::JetMcCollisions const& mcCollisions, aod::JetCollisions const& collisions, JetMCDTable const& mcdJets, - JetMCPTable const&, - aod::CandidatesDstarMCD const&, - aod::CandidatesDstarMCP const&, - TracksWithExtra const& tracks) + aod::CandidatesDstarMCD const&) { for (const auto& mcCollision : mcCollisions){ const auto collisionsPerMCCollision = collisions.sliceBy(collisionsPerMCCollisionPreslice, mcCollision.globalIndex()); @@ -948,7 +912,7 @@ struct TaskPolarisationDstarInJet { const auto dstarMcdJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); for (const auto& mcdJet : dstarMcdJetsPerCollision){ for (const auto& mcdDstarCand : mcdJet.candidates_as()){ - if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0, tracks)) { + if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0)) { } } } From 516243c53b61a59e6c3df22b685dc586c2d46511 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 5 Aug 2025 11:27:11 +0000 Subject: [PATCH 04/26] Please consider the following formatting changes --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 415 +++++++++--------- 1 file changed, 206 insertions(+), 209 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index bc6bf7c274d..5d38df91dd7 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -15,24 +15,24 @@ /// \author F. Grosa (CERN) fabrizio.grosa@cern.ch /// \author Mingze Li (CCNU) Mingze.li@cern.ch -#include - -#include "TRandom3.h" -#include "TVector3.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" -#include "Math/GenVector/Boost.h" +#include "PWGHF/Core/DecayChannels.h" +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetHFUtilities.h" +#include "PWGJE/Core/JetUtilities.h" +#include "PWGJE/DataModel/Jet.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" -#include "PWGHF/Core/DecayChannels.h" -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/Core/JetFinder.h" -#include "PWGJE/Core/FastJetUtilities.h" -#include "PWGJE/Core/JetHFUtilities.h" -#include "PWGJE/Core/JetUtilities.h" +#include "Math/GenVector/Boost.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" +#include "TRandom3.h" +#include "TVector3.h" + +#include using namespace o2; using namespace o2::aod; @@ -76,7 +76,7 @@ struct TaskPolarisationDstarInJet { ConfigurableAxis configThnAxisY{"configThnAxisY", {20, -1.f, 1.f}, "#it{y}"}; ConfigurableAxis configThnAxisCosThetaStar{"configThnAxisCosThetaStar", {20, -1.f, 1.f}, "cos(#vartheta_{helicity})"}; ConfigurableAxis configThnAxisMlBkg{"configThnAxisMlBkg", {100, 0.f, 1.f}, "ML bkg"}; - ConfigurableAxis configThnAxisInvMassD0{"configThnAxisInvMassD0", {250, 1.65f, 2.15f}, "#it{M}(D^{0}) (GeV/#it{c}^{2})"}; // only for D*+ + ConfigurableAxis configThnAxisInvMassD0{"configThnAxisInvMassD0", {250, 1.65f, 2.15f}, "#it{M}(D^{0}) (GeV/#it{c}^{2})"}; // only for D*+ // ConfigurableAxis configThnAxisMlPrompt{"configThnAxisMlPrompt", {100, 0.f, 1.f}, "ML prompt"}; ConfigurableAxis configThnAxisMlNonPrompt{"configThnAxisMlNonPrompt", {100, 0.f, 1.f}, "ML non-prompt"}; ConfigurableAxis configThnAxisNumCandidates{"configThnAxisNumCandidates", {1, -0.5f, 0.5f}, "num candidates"}; @@ -224,7 +224,7 @@ struct TaskPolarisationDstarInJet { registry.add("hRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); if (activatePartRecoDstar) { registry.add("hPartRecoPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); - registry.add("hPartRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- partially reco non-prompt signal" , HistType::kTHnSparseF, thnRecNonPromptAxes); + registry.add("hPartRecoNonPromptHelicity", "THn for polarisation studies with cosThStar w.r.t. helicity axis and BDT scores -- partially reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); } } if (activateTHnSparseCosThStarProduction) { @@ -242,7 +242,7 @@ struct TaskPolarisationDstarInJet { registry.add("hPartRecoPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- partially reco prompt signal", HistType::kTHnSparseF, thnRecPromptAxes); registry.add("hPartRecoNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis and BDT scores -- partially reco non-prompt signal", HistType::kTHnSparseF, thnRecNonPromptAxes); } - } + } // MC Gen histos std::vector thnGenPromptAxes = {thnAxisPt, thnAxisY, thnAxisCosThetaStar, thnAxisDausAcc, thnAxisCharge, thnAxisProjection, thnAxisJetPt}; @@ -271,10 +271,10 @@ struct TaskPolarisationDstarInJet { registry.add("hGenPartRecoPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis -- gen prompt partly reco signal", HistType::kTHnSparseF, thnGenPromptAxes); registry.add("hGenPartRecoNonPromptJetAxis", "THn for polarisation studies with cosThStar w.r.t. jet axis -- gen non-prompt partly reco signal", HistType::kTHnSparseF, thnGenNonPromptAxes); } - } + } } // inv. mass hypothesis to loop over - nMassHypos = 1; + nMassHypos = 1; }; // end init /// \param invMassCharmHad is the invariant-mass of the candidate @@ -310,8 +310,8 @@ struct TaskPolarisationDstarInJet { } else { registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } - } - } else { // without ML + } + } else { // without ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, zParallel, jetPt); @@ -324,76 +324,75 @@ struct TaskPolarisationDstarInJet { } else { registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, zParallel, jetPt); } - } + } } - } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } + } else { // MC --> no distinction among channels, since rotational bkg not supported + if constexpr (withMl) { // with ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } + } + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } - } else { // non-prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } + } } - } else { // without ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); - } + } else { // without ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); } + } - } else { // non-prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); - } + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); } - + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + } + } } } } } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML + if constexpr (!doMc) { // data + if constexpr (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); @@ -406,8 +405,8 @@ struct TaskPolarisationDstarInJet { } else { registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } - } - } else { // without ML + } + } else { // without ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, zParallel, jetPt); @@ -420,76 +419,75 @@ struct TaskPolarisationDstarInJet { } else { registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, zParallel, jetPt); } - } + } } - } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } + } else { // MC --> no distinction among channels, since rotational bkg not supported + if constexpr (withMl) { // with ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + } + } + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } - } else { // non-prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); } + } } - } else { // without ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); - } + } else { // without ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); } + } - } else { // non-prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); - } + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); } - + } } } } } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML + if constexpr (!doMc) { // data + if constexpr (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); @@ -502,8 +500,8 @@ struct TaskPolarisationDstarInJet { } else { registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); } - } - } else { // without ML + } + } else { // without ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, zParallel, jetPt); @@ -516,74 +514,73 @@ struct TaskPolarisationDstarInJet { } else { registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, zParallel, jetPt); } - } + } } - } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } + } else { // MC --> no distinction among channels, since rotational bkg not supported + if constexpr (withMl) { // with ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } - } else { // non-prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); } + } + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + } + } } - } else { // without ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); - } + } else { // without ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); } + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); + } + } - } else { // non-prompt - if (activateTrackingSys) { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); - } + } else { // non-prompt + if (activateTrackingSys) { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); } else { - if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); - } else { - registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); - } + registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); } - + } else { + if (!isPartRecoDstar) { + registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + } else { + registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + } + } } } } - } + } } /// \param ptCharmHad is the pt of the particle @@ -615,7 +612,7 @@ struct TaskPolarisationDstarInJet { if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } else { - registry.fill(HIST("hGenPartRecoPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); + registry.fill(HIST("hGenPartRecoPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } } else { // non-prompt if (!isPartRecoDstar) { @@ -625,7 +622,7 @@ struct TaskPolarisationDstarInJet { } } } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis - if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } else { @@ -650,7 +647,7 @@ struct TaskPolarisationDstarInJet { if (0.142f < invMass && invMass < 0.15f) { return true; } - } + } return false; } @@ -697,7 +694,7 @@ struct TaskPolarisationDstarInJet { if (origin == RecoDecay::OriginType::NonPrompt && (pdgBhadMother == 5101 || pdgBhadMother == 5103 || pdgBhadMother == 5201 || pdgBhadMother == 5203 || pdgBhadMother == 5301 || pdgBhadMother == 5303 || pdgBhadMother == 5401 || pdgBhadMother == 5403 || pdgBhadMother == 5503 || pdgBhadMother == 553 || pdgBhadMother == 555 || pdgBhadMother == 553 || pdgBhadMother == 557)) { return isCandidateInSignalRegion; } - } + } } // loop over mass hypotheses @@ -756,7 +753,7 @@ struct TaskPolarisationDstarInJet { outputMl[1] = candidate.mlScores()[1]; outputMl[2] = candidate.mlScores()[2]; } - } + } if (invMassCharmHadForSparse < minInvMass || invMassCharmHadForSparse > maxInvMass) { continue; } @@ -835,8 +832,8 @@ struct TaskPolarisationDstarInJet { } auto thisCollId = collision.globalIndex(); auto groupedDstarjets = jets.sliceBy(dstarJetsPerCollision, thisCollId); - for (const auto& jet : groupedDstarjets){ - for (const auto& dstarCandidate : jet.candidates_as()){ + for (const auto& jet : groupedDstarjets) { + for (const auto& dstarCandidate : jet.candidates_as()) { runPolarisationAnalysis(jet, dstarCandidate, 0); for (int iRotation{1}; iRotation <= nBkgRotations; ++iRotation) { runPolarisationAnalysis(jet, dstarCandidate, iRotation); @@ -859,8 +856,8 @@ struct TaskPolarisationDstarInJet { } auto thisCollId = collision.globalIndex(); auto groupedDstarJets = jets.sliceBy(dstarJetsPerCollision, thisCollId); - for (const auto& jet : groupedDstarJets){ - for (const auto& dstarCandidate : jet.candidates_as()){ + for (const auto& jet : groupedDstarJets) { + for (const auto& dstarCandidate : jet.candidates_as()) { runPolarisationAnalysis(jet, dstarCandidate, 0); for (int iRotation{1}; iRotation <= nBkgRotations; ++iRotation) { runPolarisationAnalysis(jet, dstarCandidate, iRotation); @@ -878,15 +875,15 @@ struct TaskPolarisationDstarInJet { JetMCDTable const& mcdJets, aod::CandidatesDstarMCD const&) { - for (const auto& mcCollision : mcCollisions){ + for (const auto& mcCollision : mcCollisions) { const auto collisionsPerMCCollision = collisions.sliceBy(collisionsPerMCCollisionPreslice, mcCollision.globalIndex()); - for (const auto& collision : collisionsPerMCCollision){ + for (const auto& collision : collisionsPerMCCollision) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { continue; } const auto dstarMcDJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); - for (const auto& mcdJet : dstarMcDJetsPerCollision){ - for (const auto& mcdDstarCand : mcdJet.candidates_as()){ + for (const auto& mcdJet : dstarMcDJetsPerCollision) { + for (const auto& mcdDstarCand : mcdJet.candidates_as()) { if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0)) { } break; @@ -899,21 +896,21 @@ struct TaskPolarisationDstarInJet { // Dstar in MC with ML cuts void processDstarMcWithMl(aod::JetMcCollisions const& mcCollisions, - aod::JetCollisions const& collisions, - JetMCDTable const& mcdJets, - aod::CandidatesDstarMCD const&) + aod::JetCollisions const& collisions, + JetMCDTable const& mcdJets, + aod::CandidatesDstarMCD const&) { - for (const auto& mcCollision : mcCollisions){ + for (const auto& mcCollision : mcCollisions) { const auto collisionsPerMCCollision = collisions.sliceBy(collisionsPerMCCollisionPreslice, mcCollision.globalIndex()); - for (const auto& collision : collisionsPerMCCollision){ + for (const auto& collision : collisionsPerMCCollision) { if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { continue; } const auto dstarMcdJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); - for (const auto& mcdJet : dstarMcdJetsPerCollision){ - for (const auto& mcdDstarCand : mcdJet.candidates_as()){ + for (const auto& mcdJet : dstarMcdJetsPerCollision) { + for (const auto& mcdDstarCand : mcdJet.candidates_as()) { if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0)) { - } + } } } } From ad676a65f77fcc55999cd9438c7f30464dbe0417 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Tue, 5 Aug 2025 13:35:45 +0200 Subject: [PATCH 05/26] update --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 5d38df91dd7..1a7ed7c3062 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -32,6 +32,7 @@ #include "TRandom3.h" #include "TVector3.h" +#include #include using namespace o2; @@ -884,8 +885,7 @@ struct TaskPolarisationDstarInJet { const auto dstarMcDJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); for (const auto& mcdJet : dstarMcDJetsPerCollision) { for (const auto& mcdDstarCand : mcdJet.candidates_as()) { - if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0)) { - } + runPolarisationAnalysis(mcdJet, mcdDstarCand, 0); break; } } @@ -909,8 +909,7 @@ struct TaskPolarisationDstarInJet { const auto dstarMcdJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); for (const auto& mcdJet : dstarMcdJetsPerCollision) { for (const auto& mcdDstarCand : mcdJet.candidates_as()) { - if (runPolarisationAnalysis(mcdJet, mcdDstarCand, 0)) { - } + runPolarisationAnalysis(mcdJet, mcdDstarCand, 0); } } } From 7a6fb054586877c3fb6eb4ebb58d0956532268fd Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Tue, 5 Aug 2025 13:40:38 +0200 Subject: [PATCH 06/26] updating jet derived data producer --- PWGJE/Core/JetHFUtilities.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGJE/Core/JetHFUtilities.h b/PWGJE/Core/JetHFUtilities.h index 9c3edc54f13..954d920c498 100644 --- a/PWGJE/Core/JetHFUtilities.h +++ b/PWGJE/Core/JetHFUtilities.h @@ -845,7 +845,10 @@ void fillDstarCandidateTable(T const& candidate, U& DstarParTable, V& DstarParDa candidate.impactParameterNormalised1(), candidate.nSigTpcPi1(), candidate.nSigTofPi1(), - candidate.nSigTpcTofPi1()); + candidate.nSigTpcTofPi1(), + candidate.absEtaTrackMin(), + candidate.numItsClsMin(), + candidate.numTpcClsMin()); DstarParDaughterTable( candidate.chi2PCACharm(), From 62e108d248de58d77b0566b05b64fd335779e2a5 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Tue, 5 Aug 2025 14:07:23 +0200 Subject: [PATCH 07/26] fixing O2 Linter error --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 1a7ed7c3062..c5694a0b01e 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -59,7 +59,7 @@ enum DecayChannel : uint8_t { } // namespace charm_polarisation } // namespace o2::aod -struct TaskPolarisationDstarInJet { +struct HfTaskPolarisationDstarInJet { float massPi{0.f}; float massProton{0.f}; @@ -82,7 +82,7 @@ struct TaskPolarisationDstarInJet { ConfigurableAxis configThnAxisMlNonPrompt{"configThnAxisMlNonPrompt", {100, 0.f, 1.f}, "ML non-prompt"}; ConfigurableAxis configThnAxisNumCandidates{"configThnAxisNumCandidates", {1, -0.5f, 0.5f}, "num candidates"}; ConfigurableAxis configThnAxisPtB{"configThnAxisPtB", {3000, 0.f, 300.f}, "#it{p}_{T}(B mother) (GeV/#it{c})"}; - ConfigurableAxis configThnAxisAbsEtaTrackMin{"configThnAxisEtaTrackMin", {3, 0.f, 0.3f}, "min |#it{#eta_{track}}|"}; + ConfigurableAxis configThnAxisAbsEtaTrackMin{"configThnAxisAbsEtaTrackMin", {3, 0.f, 0.3f}, "min |#it{#eta_{track}}|"}; ConfigurableAxis configThnAxisNumItsClsMin{"configThnAxisNumItsClsMin", {4, 3.5f, 7.5f}, "min #it{N}_{cls ITS}"}; ConfigurableAxis configThnAxisNumTpcClsMin{"configThnAxisNumTpcClsMin", {3, 79.5f, 140.5f}, "min #it{N}_{cls TPC}"}; ConfigurableAxis configThnAxisCharge{"configThnAxisCharge", {2, -2.f, 2.f}, "electric charge"}; @@ -645,7 +645,9 @@ struct TaskPolarisationDstarInJet { bool isInSignalRegion(float invMass) { if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - if (0.142f < invMass && invMass < 0.15f) { + invMassMin = 0.142f; + invMassMax = 0.15f; + if (invMassMin < invMass && invMass < invMassMax) { return true; } } @@ -692,7 +694,7 @@ struct TaskPolarisationDstarInJet { ptBhadMother = candidate.ptBhadMotherPart(); int pdgBhadMother = candidate.pdgBhadMotherPart(); // For unknown reasons there are charm hadrons coming directly from beauty diquarks without an intermediate B-hadron which have an unreasonable correlation between the pT of the charm hadron and the beauty mother. We also remove charm hadrons from quarkonia. - if (origin == RecoDecay::OriginType::NonPrompt && (pdgBhadMother == 5101 || pdgBhadMother == 5103 || pdgBhadMother == 5201 || pdgBhadMother == 5203 || pdgBhadMother == 5301 || pdgBhadMother == 5303 || pdgBhadMother == 5401 || pdgBhadMother == 5403 || pdgBhadMother == 5503 || pdgBhadMother == 553 || pdgBhadMother == 555 || pdgBhadMother == 553 || pdgBhadMother == 557)) { + if (origin == RecoDecay::OriginType::NonPrompt && (pdgBhadMother == 5101 || pdgBhadMother == 5103 || pdgBhadMother == 5201 || pdgBhadMother == 5203 || pdgBhadMother == 5301 || pdgBhadMother == 5303 || pdgBhadMother == 5401 || pdgBhadMother == 5403 || pdgBhadMother == 5503 || pdgBhadMother == 553 || pdgBhadMother == 555 || pdgBhadMother == 553 || pdgBhadMother == 557)) { // o2-linter: disable=pdg/explicit-code, magic-number (constants not in the PDG header) return isCandidateInSignalRegion; } } @@ -844,7 +846,7 @@ struct TaskPolarisationDstarInJet { } } } - PROCESS_SWITCH(TaskPolarisationDstarInJet, processDstar, "Process Dstar candidates without ML", true); + PROCESS_SWITCH(HfTaskPolarisationDstarInJet, processDstar, "Process Dstar candidates without ML", true); // Dstar with ML cuts void processDstarWithMl(aod::JetCollisions const& collisions, @@ -868,7 +870,7 @@ struct TaskPolarisationDstarInJet { } } } - PROCESS_SWITCH(TaskPolarisationDstarInJet, processDstarWithMl, "Process Dstar candidates with ML", false); + PROCESS_SWITCH(HfTaskPolarisationDstarInJet, processDstarWithMl, "Process Dstar candidates with ML", false); // Dstar in MC with rectangular cuts void processDstarMc(aod::JetMcCollisions const& mcCollisions, @@ -892,7 +894,7 @@ struct TaskPolarisationDstarInJet { } } } - PROCESS_SWITCH(TaskPolarisationDstarInJet, processDstarMc, "Process Dstar candidates in MC without ML", false); + PROCESS_SWITCH(HfTaskPolarisationDstarInJet, processDstarMc, "Process Dstar candidates in MC without ML", false); // Dstar in MC with ML cuts void processDstarMcWithMl(aod::JetMcCollisions const& mcCollisions, @@ -915,10 +917,10 @@ struct TaskPolarisationDstarInJet { } } } - PROCESS_SWITCH(TaskPolarisationDstarInJet, processDstarMcWithMl, "Process Dstar candidates in MC with ML", false); + PROCESS_SWITCH(HfTaskPolarisationDstarInJet, processDstarMcWithMl, "Process Dstar candidates in MC with ML", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From 9720849681dab79a2f8195fd999c88b7336891fb Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Tue, 5 Aug 2025 14:12:54 +0200 Subject: [PATCH 08/26] update --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index c5694a0b01e..3a4721871f3 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -72,23 +72,6 @@ struct HfTaskPolarisationDstarInJet { Configurable selectionFlagDstarToD0Pi{"selectionFlagDstarToD0Pi", true, "Selection Flag for D* decay to D0 Pi"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; - ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {200, 0.139f, 0.179f}, "#it{M} (GeV/#it{c}^{2})"}; - ConfigurableAxis configThnAxisPt{"configThnAxisPt", {100, 0.f, 100.f}, "#it{p}_{T} (GeV/#it{c})"}; - ConfigurableAxis configThnAxisY{"configThnAxisY", {20, -1.f, 1.f}, "#it{y}"}; - ConfigurableAxis configThnAxisCosThetaStar{"configThnAxisCosThetaStar", {20, -1.f, 1.f}, "cos(#vartheta_{helicity})"}; - ConfigurableAxis configThnAxisMlBkg{"configThnAxisMlBkg", {100, 0.f, 1.f}, "ML bkg"}; - ConfigurableAxis configThnAxisInvMassD0{"configThnAxisInvMassD0", {250, 1.65f, 2.15f}, "#it{M}(D^{0}) (GeV/#it{c}^{2})"}; // only for D*+ - // ConfigurableAxis configThnAxisMlPrompt{"configThnAxisMlPrompt", {100, 0.f, 1.f}, "ML prompt"}; - ConfigurableAxis configThnAxisMlNonPrompt{"configThnAxisMlNonPrompt", {100, 0.f, 1.f}, "ML non-prompt"}; - ConfigurableAxis configThnAxisNumCandidates{"configThnAxisNumCandidates", {1, -0.5f, 0.5f}, "num candidates"}; - ConfigurableAxis configThnAxisPtB{"configThnAxisPtB", {3000, 0.f, 300.f}, "#it{p}_{T}(B mother) (GeV/#it{c})"}; - ConfigurableAxis configThnAxisAbsEtaTrackMin{"configThnAxisAbsEtaTrackMin", {3, 0.f, 0.3f}, "min |#it{#eta_{track}}|"}; - ConfigurableAxis configThnAxisNumItsClsMin{"configThnAxisNumItsClsMin", {4, 3.5f, 7.5f}, "min #it{N}_{cls ITS}"}; - ConfigurableAxis configThnAxisNumTpcClsMin{"configThnAxisNumTpcClsMin", {3, 79.5f, 140.5f}, "min #it{N}_{cls TPC}"}; - ConfigurableAxis configThnAxisCharge{"configThnAxisCharge", {2, -2.f, 2.f}, "electric charge"}; - ConfigurableAxis configThnAxisProjection{"configThnAxisProjection", {300, 0.f, 10.f}, "z^{D^{*+},jet}_{||}"}; - ConfigurableAxis configThnAxisJetPt{"configThnAxisJetPt", {100, 0.f, 100.f}, "#it{p}_{T} (GeV/#it{c})"}; - /// activate rotational background Configurable nBkgRotations{"nBkgRotations", 0, "Number of rotated copies (background) per each original candidate"}; Configurable minRotAngleMultByPi{"minRotAngleMultByPi", 5. / 6, "Minimum angle rotation for track rotation, to be multiplied by pi"}; @@ -118,6 +101,23 @@ struct HfTaskPolarisationDstarInJet { Preslice dstarMCDJetsPerCollisionPreslice = aod::jet::collisionId; Preslice dstarJetsPerCollision = aod::jet::collisionId; + ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {200, 0.139f, 0.179f}, "#it{M} (GeV/#it{c}^{2})"}; // o2-linter: disable=pdg/explicit-mass (false positive) + ConfigurableAxis configThnAxisPt{"configThnAxisPt", {100, 0.f, 100.f}, "#it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis configThnAxisY{"configThnAxisY", {20, -1.f, 1.f}, "#it{y}"}; + ConfigurableAxis configThnAxisCosThetaStar{"configThnAxisCosThetaStar", {20, -1.f, 1.f}, "cos(#vartheta_{helicity})"}; + ConfigurableAxis configThnAxisMlBkg{"configThnAxisMlBkg", {100, 0.f, 1.f}, "ML bkg"}; + ConfigurableAxis configThnAxisInvMassD0{"configThnAxisInvMassD0", {250, 1.65f, 2.15f}, "#it{M}(D^{0}) (GeV/#it{c}^{2})"}; // only for D*+ + // ConfigurableAxis configThnAxisMlPrompt{"configThnAxisMlPrompt", {100, 0.f, 1.f}, "ML prompt"}; + ConfigurableAxis configThnAxisMlNonPrompt{"configThnAxisMlNonPrompt", {100, 0.f, 1.f}, "ML non-prompt"}; + ConfigurableAxis configThnAxisNumCandidates{"configThnAxisNumCandidates", {1, -0.5f, 0.5f}, "num candidates"}; + ConfigurableAxis configThnAxisPtB{"configThnAxisPtB", {3000, 0.f, 300.f}, "#it{p}_{T}(B mother) (GeV/#it{c})"}; + ConfigurableAxis configThnAxisAbsEtaTrackMin{"configThnAxisAbsEtaTrackMin", {3, 0.f, 0.3f}, "min |#it{#eta_{track}}|"}; + ConfigurableAxis configThnAxisNumItsClsMin{"configThnAxisNumItsClsMin", {4, 3.5f, 7.5f}, "min #it{N}_{cls ITS}"}; + ConfigurableAxis configThnAxisNumTpcClsMin{"configThnAxisNumTpcClsMin", {3, 79.5f, 140.5f}, "min #it{N}_{cls TPC}"}; + ConfigurableAxis configThnAxisCharge{"configThnAxisCharge", {2, -2.f, 2.f}, "electric charge"}; + ConfigurableAxis configThnAxisProjection{"configThnAxisProjection", {300, 0.f, 10.f}, "z^{D^{*+},jet}_{||}"}; + ConfigurableAxis configThnAxisJetPt{"configThnAxisJetPt", {100, 0.f, 100.f}, "#it{p}_{T} (GeV/#it{c})"}; + HistogramRegistry registry{"registry", {}}; std::vector eventSelectionBits; From 775dbbe0669ff10dfb390b37b7d62685805e8480 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Tue, 5 Aug 2025 14:14:26 +0200 Subject: [PATCH 09/26] update --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 3a4721871f3..9eb5ea72bc4 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -97,9 +97,9 @@ struct HfTaskPolarisationDstarInJet { using TracksWithExtra = soa::Join; // slices for accessing proper HF mcdjets collision associated to mccollisions - PresliceUnsorted collisionsPerMCCollisionPreslice = aod::jmccollisionlb::mcCollisionId; Preslice dstarMCDJetsPerCollisionPreslice = aod::jet::collisionId; Preslice dstarJetsPerCollision = aod::jet::collisionId; + PresliceUnsorted collisionsPerMCCollisionPreslice = aod::jmccollisionlb::mcCollisionId; ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {200, 0.139f, 0.179f}, "#it{M} (GeV/#it{c}^{2})"}; // o2-linter: disable=pdg/explicit-mass (false positive) ConfigurableAxis configThnAxisPt{"configThnAxisPt", {100, 0.f, 100.f}, "#it{p}_{T} (GeV/#it{c})"}; From 745c58a4eb2af8164d1addc72c84f45bc8df0455 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Tue, 5 Aug 2025 14:16:44 +0200 Subject: [PATCH 10/26] change the name of main struct --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 9eb5ea72bc4..598a501f2b3 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -59,7 +59,7 @@ enum DecayChannel : uint8_t { } // namespace charm_polarisation } // namespace o2::aod -struct HfTaskPolarisationDstarInJet { +struct HfTaskDstarPolarisationInJet { float massPi{0.f}; float massProton{0.f}; @@ -846,7 +846,7 @@ struct HfTaskPolarisationDstarInJet { } } } - PROCESS_SWITCH(HfTaskPolarisationDstarInJet, processDstar, "Process Dstar candidates without ML", true); + PROCESS_SWITCH(HfTaskDstarPolarisationInJet, processDstar, "Process Dstar candidates without ML", true); // Dstar with ML cuts void processDstarWithMl(aod::JetCollisions const& collisions, @@ -870,7 +870,7 @@ struct HfTaskPolarisationDstarInJet { } } } - PROCESS_SWITCH(HfTaskPolarisationDstarInJet, processDstarWithMl, "Process Dstar candidates with ML", false); + PROCESS_SWITCH(HfTaskDstarPolarisationInJet, processDstarWithMl, "Process Dstar candidates with ML", false); // Dstar in MC with rectangular cuts void processDstarMc(aod::JetMcCollisions const& mcCollisions, @@ -894,7 +894,7 @@ struct HfTaskPolarisationDstarInJet { } } } - PROCESS_SWITCH(HfTaskPolarisationDstarInJet, processDstarMc, "Process Dstar candidates in MC without ML", false); + PROCESS_SWITCH(HfTaskDstarPolarisationInJet, processDstarMc, "Process Dstar candidates in MC without ML", false); // Dstar in MC with ML cuts void processDstarMcWithMl(aod::JetMcCollisions const& mcCollisions, @@ -917,10 +917,10 @@ struct HfTaskPolarisationDstarInJet { } } } - PROCESS_SWITCH(HfTaskPolarisationDstarInJet, processDstarMcWithMl, "Process Dstar candidates in MC with ML", false); + PROCESS_SWITCH(HfTaskDstarPolarisationInJet, processDstarMcWithMl, "Process Dstar candidates in MC with ML", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From 4595da25e063ace8ca936a4d324c0a30bdba1382 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Tue, 5 Aug 2025 14:44:12 +0200 Subject: [PATCH 11/26] update --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 598a501f2b3..2e03e71d187 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -645,8 +645,8 @@ struct HfTaskDstarPolarisationInJet { bool isInSignalRegion(float invMass) { if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - invMassMin = 0.142f; - invMassMax = 0.15f; + float invMassMin = 0.142f; + float invMassMax = 0.15f; if (invMassMin < invMass && invMass < invMassMax) { return true; } From 48805aff2ced567ae46f34371e469713f519660b Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Wed, 6 Aug 2025 13:52:43 +0200 Subject: [PATCH 12/26] minor enhancement --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 103 ++++++++++-------- .../derivedDataCreatorDstarToD0Pi.cxx | 7 +- 2 files changed, 58 insertions(+), 52 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 2e03e71d187..72ae6041b53 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -22,15 +22,15 @@ #include "PWGJE/Core/JetUtilities.h" #include "PWGJE/DataModel/Jet.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" +#include +#include +#include -#include "Math/GenVector/Boost.h" -#include "Math/Vector3D.h" -#include "Math/Vector4D.h" -#include "TRandom3.h" -#include "TVector3.h" +#include +#include +#include +#include +#include #include #include @@ -62,9 +62,10 @@ enum DecayChannel : uint8_t { struct HfTaskDstarPolarisationInJet { float massPi{0.f}; - float massProton{0.f}; float massKaon{0.f}; + float massProton{0.f}; float massDstar{0.f}; + float bkgRotationAngleStep{0.f}; uint8_t nMassHypos{0u}; @@ -85,11 +86,11 @@ struct HfTaskDstarPolarisationInJet { Configurable activateTHnSparseCosThStarJetAxis{"activateTHnSparseCosThStarJetAxis", true, "Activate the THnSparse with cosThStar w.r.t. production axis"}; Configurable activateTHnSparseCosThStarProduction{"activateTHnSparseCosThStarProduction", true, "Activate the THnSparse with cosThStar w.r.t. production axis"}; Configurable activatePartRecoDstar{"activatePartRecoDstar", false, "Activate the study of partly reconstructed D*+ -> D0 (-> KPiPi0) Pi decays"}; - float minInvMass{0.f}; - float maxInvMass{1000.f}; + float invMassMin{0.f}; + float invMassMax{1000.f}; /// Application of rapidity cut for reconstructed candidates - Configurable rapidityCut{"rapidityCut", 999.f, "Max. value of reconstructed candidate rapidity (abs. value)"}; + Configurable maxAbsRapidityCut{"maxAbsRapidityCut", 999.f, "Max. value of reconstructed candidate rapidity (abs. value)"}; // Tables for MC jet matching using DstarJets = soa::Join; @@ -125,14 +126,20 @@ struct HfTaskDstarPolarisationInJet { void init(InitContext&) { // initialise event selection: - eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); + eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(eventSelections.value); /// check process functions - std::array processes = {doprocessDstar, doprocessDstarWithMl, doprocessDstarMc, doprocessDstarMcWithMl}; - const int nProcesses = std::accumulate(processes.begin(), processes.end(), 0); + const int nProcesses = + static_cast(doprocessDstar) + + static_cast(doprocessDstarWithMl) + + static_cast(doprocessDstarMc) + + static_cast(doprocessDstarMcWithMl); + // std::array processes = {doprocessDstar, doprocessDstarWithMl, doprocessDstarMc, doprocessDstarMcWithMl}; + // const int nProcesses = std::accumulate(processes.begin(), processes.end(), 0); if (nProcesses > 1) { LOGP(fatal, "Only one process function should be enabled at a time, please check your configuration"); - } else if (nProcesses == 0) { + } + if (nProcesses == 0) { LOGP(fatal, "No process function enabled"); } @@ -140,16 +147,15 @@ struct HfTaskDstarPolarisationInJet { std::array sparses = {activateTHnSparseCosThStarHelicity, activateTHnSparseCosThStarJetAxis, activateTHnSparseCosThStarProduction}; if (std::accumulate(sparses.begin(), sparses.end(), 0) == 0) { LOGP(fatal, "No output THnSparses enabled"); - } else { - if (activateTHnSparseCosThStarHelicity) { - LOGP(info, "THnSparse with cosThStar w.r.t. helicity axis active."); - } - if (activateTHnSparseCosThStarJetAxis) { - LOGP(info, "THnSparse with cosThStar w.r.t. jet axis active."); - } - if (activateTHnSparseCosThStarProduction) { - LOGP(info, "THnSparse with cosThStar w.r.t. production axis active."); - } + } + if (activateTHnSparseCosThStarHelicity) { + LOGP(info, "THnSparse with cosThStar w.r.t. helicity axis active."); + } + if (activateTHnSparseCosThStarJetAxis) { + LOGP(info, "THnSparse with cosThStar w.r.t. jet axis active."); + } + if (activateTHnSparseCosThStarProduction) { + LOGP(info, "THnSparse with cosThStar w.r.t. production axis active."); } if (activatePartRecoDstar && !(doprocessDstarMc || doprocessDstarMcWithMl)) { @@ -188,8 +194,8 @@ struct HfTaskDstarPolarisationInJet { const AxisSpec thnAxisSelFlag{2, -0.5f, 1.5f, "Sel flag"}; auto invMassBins = thnAxisInvMass.binEdges; - minInvMass = invMassBins.front(); - maxInvMass = invMassBins.back(); + invMassMin = invMassBins.front(); + invMassMax = invMassBins.back(); std::vector thnRecDataAxes = {thnAxisInvMass, thnAxisPt, thnAxisY, thnAxisInvMassD0, thnAxisCosThetaStar}; if (activateTrackingSys) { @@ -591,10 +597,9 @@ struct HfTaskDstarPolarisationInJet { /// \param ptBhadMother is the pt of the b-hadron mother (only in case of non-prompt) /// \param areDausInAcc is a flag indicating whether the daughters are in acceptance or not /// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar->D0pi->Kpipipi0 meson (MC only) - template - void fillGenHistos(float ptCharmHad, float rapCharmHad, float cosThetaStar, int8_t origin, float ptBhadMother, bool areDausInAcc, int8_t charge, bool isPartRecoDstar, float zParallel, float jetPt) + void fillGenHistos(charm_polarisation::CosThetaStarType cosThetaStarType, float ptCharmHad, float rapCharmHad, float cosThetaStar, int8_t origin, float ptBhadMother, bool areDausInAcc, int8_t charge, bool isPartRecoDstar, float zParallel, float jetPt) { - if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity + if (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); @@ -608,7 +613,7 @@ struct HfTaskDstarPolarisationInJet { registry.fill(HIST("hGenPartRecoNonPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge, zParallel, jetPt); } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production + } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); @@ -622,7 +627,7 @@ struct HfTaskDstarPolarisationInJet { registry.fill(HIST("hGenPartRecoNonPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, ptBhadMother, areDausInAcc, charge, zParallel, jetPt); } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis + } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); @@ -645,9 +650,9 @@ struct HfTaskDstarPolarisationInJet { bool isInSignalRegion(float invMass) { if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ - float invMassMin = 0.142f; - float invMassMax = 0.15f; - if (invMassMin < invMass && invMass < invMassMax) { + float invMassSigMin = 0.142f; + float invMassSigMax = 0.15f; + if (invMassSigMin < invMass && invMass < invMassSigMax) { return true; } } @@ -726,9 +731,10 @@ struct HfTaskDstarPolarisationInJet { pxDau = threeVecSoftPi[0]; pyDau = threeVecSoftPi[1]; pzDau = threeVecSoftPi[2]; - pxCharmHad = threeVecSoftPi[0] + threeVecD0Prong0[0] + threeVecD0Prong1[0]; - pyCharmHad = threeVecSoftPi[1] + threeVecD0Prong0[1] + threeVecD0Prong1[1]; - pzCharmHad = threeVecSoftPi[2] + threeVecD0Prong0[2] + threeVecD0Prong1[2]; + std::array threeVecCand = RecoDecay::pVec(threeVecSoftPi, threeVecD0Prong0, threeVecD0Prong1); + pxCharmHad = threeVecCand[0]; + pyCharmHad = threeVecCand[1]; + pzCharmHad = threeVecCand[2]; if (candidate.signProng1() > 0) { invMassCharmHad = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1, threeVecSoftPi}, std::array{massPi, massKaon, massPi}); invMassD0 = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1}, std::array{massPi, massKaon}); @@ -736,15 +742,18 @@ struct HfTaskDstarPolarisationInJet { invMassCharmHad = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1, threeVecSoftPi}, std::array{massKaon, massPi, massPi}); invMassD0 = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1}, std::array{massKaon, massPi}); } - rapidity = RecoDecay::y(std::array{pxCharmHad, pyCharmHad, pzCharmHad}, massDstar); + rapidity = RecoDecay::y(threeVecCand, massDstar); } else { isRotatedCandidate = 0; pxDau = candidate.pxProng1(); pyDau = candidate.pyProng1(); pzDau = candidate.pzProng1(); - pxCharmHad = pxDau + candidate.pxProng0Charm() + candidate.pxProng1Charm(); - pyCharmHad = pyDau + candidate.pyProng0Charm() + candidate.pyProng1Charm(); - pzCharmHad = pzDau + candidate.pzProng0Charm() + candidate.pzProng1Charm(); + std::array threeVecCand = RecoDecay::pVec(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}, + std::array{candidate.pyProng0Charm(), candidate.pxProng0Charm(), candidate.pzProng0Charm()}, + std::array{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()}); + pxCharmHad = threeVecCand[0]; + pyCharmHad = threeVecCand[1]; + pzCharmHad = threeVecCand[2]; invMassCharmHad = candidate.m(); invMassD0 = candidate.invMassCharm(); rapidity = candidate.y(); @@ -752,17 +761,15 @@ struct HfTaskDstarPolarisationInJet { invMassCharmHadForSparse = invMassCharmHad - invMassD0; if constexpr (withMl) { - outputMl[0] = candidate.mlScores()[0]; - outputMl[1] = candidate.mlScores()[1]; - outputMl[2] = candidate.mlScores()[2]; + std::copy_n(candidate.mlScores().begin(), outputMl.size(), outputMl.begin()); } } - if (invMassCharmHadForSparse < minInvMass || invMassCharmHadForSparse > maxInvMass) { + if (invMassCharmHadForSparse < invMassMin || invMassCharmHadForSparse > invMassMax) { continue; } /// apply rapidity selection on the reconstructed candidate - if (std::abs(rapidity) > rapidityCut) { + if (std::abs(rapidity) > maxAbsRapidityCut) { continue; } diff --git a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx index 6ec6ee44419..2de9456f69b 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx @@ -153,12 +153,11 @@ struct HfDerivedDataCreatorDstarToD0Pi { void fillTablesCandidate(const T& candidate, const U& prong0, const U& prong1, const U& prongSoftPi, int candFlag, double invMass, double invMassD0, double y, int8_t flagMc, int8_t flagMcD0, int8_t origin, int8_t nTracksDecayed, double ptBhad, int pdgBhad, const std::vector& mlScores) { - float absEtaTrackMin{-1.f}; - int numItsClsMin{-1}, numTpcClsMin{-1}; - getTrackingInfos(std::vector{prong0, prong1, prongSoftPi}, absEtaTrackMin, numItsClsMin, numTpcClsMin); - rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { + float absEtaTrackMin{-1.f}; + int numItsClsMin{-1}, numTpcClsMin{-1}; + getTrackingInfos(std::vector{prong0, prong1, prongSoftPi}, absEtaTrackMin, numItsClsMin, numTpcClsMin); rowCandidatePar( candidate.pxD0(), candidate.pyD0(), From 296fcfb1c80c9ab77a7b7031983c04ea17dfb0d0 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Wed, 6 Aug 2025 14:13:26 +0200 Subject: [PATCH 13/26] minor enhancement --- .../TableProducer/derivedDataCreatorDstarToD0Pi.cxx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx index 2de9456f69b..6e287b54d8b 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx @@ -137,15 +137,9 @@ struct HfDerivedDataCreatorDstarToD0Pi { nTpcClsMin = 1000; for (const auto& track : prongTracks) { - if (std::abs(track.eta()) < etaMin) { - etaMin = std::abs(track.eta()); - } - if (track.itsNCls() < nItsClsMin) { - nItsClsMin = track.itsNCls(); - } - if (track.tpcNClsCrossedRows() < nTpcClsMin) { - nTpcClsMin = track.tpcNClsCrossedRows(); - } + etaMin = std::min(etaMin, std::abs(track.eta())); + nItsClsMin = std::min(nItsClsMin, static_cast(track.itsNCls())); + nTpcClsMin = std::min(nTpcClsMin, static_cast(track.tpcNClsCrossedRows())); } } From 58289698cfc7cd61de33d6f1563cb3bd1cbca2a1 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 6 Aug 2025 12:14:18 +0000 Subject: [PATCH 14/26] Please consider the following formatting changes --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 72ae6041b53..86b28e8c397 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -129,7 +129,7 @@ struct HfTaskDstarPolarisationInJet { eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(eventSelections.value); /// check process functions - const int nProcesses = + const int nProcesses = static_cast(doprocessDstar) + static_cast(doprocessDstarWithMl) + static_cast(doprocessDstarMc) + @@ -600,7 +600,7 @@ struct HfTaskDstarPolarisationInJet { void fillGenHistos(charm_polarisation::CosThetaStarType cosThetaStarType, float ptCharmHad, float rapCharmHad, float cosThetaStar, int8_t origin, float ptBhadMother, bool areDausInAcc, int8_t charge, bool isPartRecoDstar, float zParallel, float jetPt) { if (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity - if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptHelicity"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } else { @@ -614,7 +614,7 @@ struct HfTaskDstarPolarisationInJet { } } } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production - if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptProduction"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } else { @@ -628,7 +628,7 @@ struct HfTaskDstarPolarisationInJet { } } } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis - if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (origin == RecoDecay::OriginType::Prompt) { // prompt if (!isPartRecoDstar) { registry.fill(HIST("hGenPromptJetAxis"), ptCharmHad, rapCharmHad, cosThetaStar, areDausInAcc, charge, zParallel, jetPt); } else { @@ -748,8 +748,8 @@ struct HfTaskDstarPolarisationInJet { pxDau = candidate.pxProng1(); pyDau = candidate.pyProng1(); pzDau = candidate.pzProng1(); - std::array threeVecCand = RecoDecay::pVec(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}, - std::array{candidate.pyProng0Charm(), candidate.pxProng0Charm(), candidate.pzProng0Charm()}, + std::array threeVecCand = RecoDecay::pVec(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}, + std::array{candidate.pyProng0Charm(), candidate.pxProng0Charm(), candidate.pzProng0Charm()}, std::array{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()}); pxCharmHad = threeVecCand[0]; pyCharmHad = threeVecCand[1]; From 6d359d1ee876b361f6006a360405e7cab44264d8 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Thu, 21 Aug 2025 11:42:33 +0800 Subject: [PATCH 15/26] minor update --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 17 +++++------------ .../derivedDataCreatorDstarToD0Pi.cxx | 4 ++-- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 86b28e8c397..20dc0cab12c 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -40,7 +40,7 @@ using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; -namespace o2::aod +namespace o2 { namespace charm_polarisation { @@ -57,13 +57,12 @@ enum DecayChannel : uint8_t { NChannels }; } // namespace charm_polarisation -} // namespace o2::aod +} // namespace o2 struct HfTaskDstarPolarisationInJet { float massPi{0.f}; float massKaon{0.f}; - float massProton{0.f}; float massDstar{0.f}; float bkgRotationAngleStep{0.f}; @@ -129,13 +128,8 @@ struct HfTaskDstarPolarisationInJet { eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(eventSelections.value); /// check process functions - const int nProcesses = - static_cast(doprocessDstar) + - static_cast(doprocessDstarWithMl) + - static_cast(doprocessDstarMc) + - static_cast(doprocessDstarMcWithMl); - // std::array processes = {doprocessDstar, doprocessDstarWithMl, doprocessDstarMc, doprocessDstarMcWithMl}; - // const int nProcesses = std::accumulate(processes.begin(), processes.end(), 0); + std::array processes = {doprocessDstar, doprocessDstarWithMl, doprocessDstarMc, doprocessDstarMcWithMl}; + const int nProcesses = std::accumulate(processes.begin(), processes.end(), 0); if (nProcesses > 1) { LOGP(fatal, "Only one process function should be enabled at a time, please check your configuration"); } @@ -168,7 +162,6 @@ struct HfTaskDstarPolarisationInJet { } massPi = o2::constants::physics::MassPiPlus; - massProton = o2::constants::physics::MassProton; massKaon = o2::constants::physics::MassKaonCharged; massDstar = o2::constants::physics::MassDStar; bkgRotationAngleStep = (nBkgRotations > 1) ? (maxRotAngleMultByPi - minRotAngleMultByPi) * constants::math::PI / (nBkgRotations - 1) : 0.; @@ -699,7 +692,7 @@ struct HfTaskDstarPolarisationInJet { ptBhadMother = candidate.ptBhadMotherPart(); int pdgBhadMother = candidate.pdgBhadMotherPart(); // For unknown reasons there are charm hadrons coming directly from beauty diquarks without an intermediate B-hadron which have an unreasonable correlation between the pT of the charm hadron and the beauty mother. We also remove charm hadrons from quarkonia. - if (origin == RecoDecay::OriginType::NonPrompt && (pdgBhadMother == 5101 || pdgBhadMother == 5103 || pdgBhadMother == 5201 || pdgBhadMother == 5203 || pdgBhadMother == 5301 || pdgBhadMother == 5303 || pdgBhadMother == 5401 || pdgBhadMother == 5403 || pdgBhadMother == 5503 || pdgBhadMother == 553 || pdgBhadMother == 555 || pdgBhadMother == 553 || pdgBhadMother == 557)) { // o2-linter: disable=pdg/explicit-code, magic-number (constants not in the PDG header) + if (origin == RecoDecay::OriginType::NonPrompt && (pdgBhadMother == 5101 || pdgBhadMother == 5103 || pdgBhadMother == 5201 || pdgBhadMother == 5203 || pdgBhadMother == 5301 || pdgBhadMother == 5303 || pdgBhadMother == 5401 || pdgBhadMother == 5403 || pdgBhadMother == 5503 || pdgBhadMother == 553 || pdgBhadMother == 555 || pdgBhadMother == 557)) { // o2-linter: disable=pdg/explicit-code, magic-number (constants not in the PDG header) return isCandidateInSignalRegion; } } diff --git a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx index 6e287b54d8b..5f8683474d0 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx @@ -130,7 +130,7 @@ struct HfDerivedDataCreatorDstarToD0Pi { /// nItsClsMin is the minumum number of clusters in ITS /// nTpcClsMin is the minumum number of clusters in TPC template - void getTrackingInfos(std::vector const& prongTracks, float& etaMin, int& nItsClsMin, int& nTpcClsMin) + void getTrackingInfos(std::array const& prongTracks, float& etaMin, int& nItsClsMin, int& nTpcClsMin) { etaMin = 10.f; nItsClsMin = 10; @@ -151,7 +151,7 @@ struct HfDerivedDataCreatorDstarToD0Pi { if (fillCandidatePar) { float absEtaTrackMin{-1.f}; int numItsClsMin{-1}, numTpcClsMin{-1}; - getTrackingInfos(std::vector{prong0, prong1, prongSoftPi}, absEtaTrackMin, numItsClsMin, numTpcClsMin); + getTrackingInfos(std::array{prong0, prong1, prongSoftPi}, absEtaTrackMin, numItsClsMin, numTpcClsMin); rowCandidatePar( candidate.pxD0(), candidate.pyD0(), From 77f9bea8f415d583ff79093ae32dd461131ced8f Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Fri, 22 Aug 2025 16:42:26 +0800 Subject: [PATCH 16/26] using existing constant --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 20dc0cab12c..c2e24f5811b 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -61,10 +61,6 @@ enum DecayChannel : uint8_t { struct HfTaskDstarPolarisationInJet { - float massPi{0.f}; - float massKaon{0.f}; - float massDstar{0.f}; - float bkgRotationAngleStep{0.f}; uint8_t nMassHypos{0u}; @@ -161,9 +157,6 @@ struct HfTaskDstarPolarisationInJet { LOGP(fatal, "No background rotation supported for MC."); } - massPi = o2::constants::physics::MassPiPlus; - massKaon = o2::constants::physics::MassKaonCharged; - massDstar = o2::constants::physics::MassDStar; bkgRotationAngleStep = (nBkgRotations > 1) ? (maxRotAngleMultByPi - minRotAngleMultByPi) * constants::math::PI / (nBkgRotations - 1) : 0.; const AxisSpec thnAxisInvMass{configThnAxisInvMass, "#it{M} (GeV/#it{c}^{2})"}; @@ -713,7 +706,7 @@ struct HfTaskDstarPolarisationInJet { // Dstar analysis // polarization measured from the soft-pion daughter (*) - massDau = massPi; // (*) + massDau = o2::constants::physics::MassPiPlus; // (*) const float bkgRotAngle = (bkgRotationId > 0) ? minRotAngleMultByPi * constants::math::PI + bkgRotationAngleStep * (bkgRotationId - 1) : 0; std::array threeVecSoftPi{candidate.pxProng1() * std::cos(bkgRotAngle) - candidate.pyProng1() * std::sin(bkgRotAngle), candidate.pxProng1() * std::sin(bkgRotAngle) + candidate.pyProng1() * std::cos(bkgRotAngle), candidate.pzProng1()}; // we rotate the soft pion @@ -729,13 +722,13 @@ struct HfTaskDstarPolarisationInJet { pyCharmHad = threeVecCand[1]; pzCharmHad = threeVecCand[2]; if (candidate.signProng1() > 0) { - invMassCharmHad = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1, threeVecSoftPi}, std::array{massPi, massKaon, massPi}); - invMassD0 = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1}, std::array{massPi, massKaon}); + invMassCharmHad = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1, threeVecSoftPi}, std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKaonCharged, o2::constants::physics::MassPiPlus}); + invMassD0 = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1}, std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKaonCharged}); } else { - invMassCharmHad = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1, threeVecSoftPi}, std::array{massKaon, massPi, massPi}); - invMassD0 = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1}, std::array{massKaon, massPi}); + invMassCharmHad = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1, threeVecSoftPi}, std::array{o2::constants::physics::MassKaonCharged, o2::constants::physics::MassPiPlus, o2::constants::physics::MassPiPlus}); + invMassD0 = RecoDecay::m(std::array{threeVecD0Prong0, threeVecD0Prong1}, std::array{o2::constants::physics::MassKaonCharged, o2::constants::physics::MassPiPlus}); } - rapidity = RecoDecay::y(threeVecCand, massDstar); + rapidity = RecoDecay::y(threeVecCand, o2::constants::physics::MassDStar); } else { isRotatedCandidate = 0; pxDau = candidate.pxProng1(); From 4c524322e2893f40fd645b21ec4ac6660627ac04 Mon Sep 17 00:00:00 2001 From: Mingze Li Date: Fri, 5 Sep 2025 09:54:49 +0800 Subject: [PATCH 17/26] Update PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vít Kučera <26327373+vkucera@users.noreply.github.com> --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index c2e24f5811b..ef37d436886 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -767,7 +767,7 @@ struct HfTaskDstarPolarisationInJet { ROOT::Math::PxPyPzMVector fourVecJet = ROOT::Math::PxPyPzMVector(jet.px(), jet.py(), jet.pz(), jet.mass()); ROOT::Math::PxPyPzMVector fourVecJetCM = boost(fourVecJet); - float ptCharmHad = std::sqrt(pxCharmHad * pxCharmHad + pyCharmHad * pyCharmHad); // this definition is valid for both rotated and original candidates + float ptCharmHad = RecoDecay::pt(threeVecCand); // this definition is valid for both rotated and original candidates if (!isCandidateInSignalRegion) { // it could be that only one mass hypothesis is in signal region isCandidateInSignalRegion = isInSignalRegion(invMassCharmHadForSparse); From 59da246cee71bdbcbcf9903645b1b7a24e63b9be Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Fri, 5 Sep 2025 11:04:32 +0800 Subject: [PATCH 18/26] update --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index ef37d436886..dfe7c28ad6a 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -124,12 +124,10 @@ struct HfTaskDstarPolarisationInJet { eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(eventSelections.value); /// check process functions - std::array processes = {doprocessDstar, doprocessDstarWithMl, doprocessDstarMc, doprocessDstarMcWithMl}; - const int nProcesses = std::accumulate(processes.begin(), processes.end(), 0); - if (nProcesses > 1) { + if (doprocessDstar + doprocessDstarWithMl + doprocessDstarMc + doprocessDstarMcWithMl > 1) { LOGP(fatal, "Only one process function should be enabled at a time, please check your configuration"); } - if (nProcesses == 0) { + if (doprocessDstar + doprocessDstarWithMl + doprocessDstarMc + doprocessDstarMcWithMl == 0) { LOGP(fatal, "No process function enabled"); } @@ -284,11 +282,11 @@ struct HfTaskDstarPolarisationInJet { /// \param numTpcClsMin is the minimum number of TPC clusters of the daughter tracks /// \param nMuons is the number of muons from daughter decays /// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar meson (MC only) - template - void fillRecoHistos(float invMassCharmHad, float ptCharmHad, float rapCharmHad, float invMassD0, float cosThetaStar, std::array outputMl, int isRotatedCandidate, int8_t origin, float ptBhadMother, float absEtaMin, int numItsClsMin, int numTpcClsMin, int8_t nMuons, bool isPartRecoDstar, float zParallel, float jetPt) + template + void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, float invMassCharmHad, float ptCharmHad, float rapCharmHad, float invMassD0, float cosThetaStar, std::array outputMl, int isRotatedCandidate, int8_t origin, float ptBhadMother, float absEtaMin, int numItsClsMin, int numTpcClsMin, int8_t nMuons, bool isPartRecoDstar, float zParallel, float jetPt) { - if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity + if (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity if constexpr (!doMc) { // data if constexpr (withMl) { // with ML if (activateTrackingSys) { @@ -383,7 +381,7 @@ struct HfTaskDstarPolarisationInJet { } } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production + } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production if constexpr (!doMc) { // data if constexpr (withMl) { // with ML if (activateTrackingSys) { @@ -478,7 +476,7 @@ struct HfTaskDstarPolarisationInJet { } } } - } else if constexpr (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis + } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis if constexpr (!doMc) { // data if constexpr (withMl) { // with ML if (activateTrackingSys) { @@ -576,6 +574,7 @@ struct HfTaskDstarPolarisationInJet { } } + /// TODO: To be implemented /// \param ptCharmHad is the pt of the particle /// \param rapCharmHad is the rapidity of the particle /// \param cosThetaStar is the cosThetaStar of the particle @@ -646,6 +645,7 @@ struct HfTaskDstarPolarisationInJet { return false; } + /// TODO: To be implemented /// \param daughter is the daughter particle /// \param ptMin is the minimum pt /// \param etaMax is the maximum eta @@ -662,10 +662,9 @@ struct HfTaskDstarPolarisationInJet { return true; } + /// \param jet is the jet containing the candidates /// \param candidates are the selected candidates /// \param bkgRotationId is the id for the background rotation - /// \param particles are the generated particles - /// \param tracks are the reconstructed tracks /// \return true if candidate in signal region template bool runPolarisationAnalysis(Jet const& jet, Cand const& candidate, int bkgRotationId) @@ -700,6 +699,7 @@ struct HfTaskDstarPolarisationInJet { float massDau{0.f}, invMassCharmHad{0.f}, invMassCharmHadForSparse{0.f}, invMassD0{0.f}; float rapidity{-999.f}; std::array outputMl{-1.f, -1.f, -1.f}; + std::array threeVecCand{}; int isRotatedCandidate = 0; // currently meaningful only for Lc->pKpi if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { @@ -717,7 +717,7 @@ struct HfTaskDstarPolarisationInJet { pxDau = threeVecSoftPi[0]; pyDau = threeVecSoftPi[1]; pzDau = threeVecSoftPi[2]; - std::array threeVecCand = RecoDecay::pVec(threeVecSoftPi, threeVecD0Prong0, threeVecD0Prong1); + threeVecCand = RecoDecay::pVec(threeVecSoftPi, threeVecD0Prong0, threeVecD0Prong1); pxCharmHad = threeVecCand[0]; pyCharmHad = threeVecCand[1]; pzCharmHad = threeVecCand[2]; @@ -734,7 +734,7 @@ struct HfTaskDstarPolarisationInJet { pxDau = candidate.pxProng1(); pyDau = candidate.pyProng1(); pzDau = candidate.pzProng1(); - std::array threeVecCand = RecoDecay::pVec(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}, + threeVecCand = RecoDecay::pVec(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}, std::array{candidate.pyProng0Charm(), candidate.pxProng0Charm(), candidate.pzProng0Charm()}, std::array{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()}); pxCharmHad = threeVecCand[0]; @@ -796,17 +796,17 @@ struct HfTaskDstarPolarisationInJet { if (activateTHnSparseCosThStarHelicity) { // helicity cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarHelicity, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + fillRecoHistos(charm_polarisation::CosThetaStarType::Helicity, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarHelicity, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); } if (activateTHnSparseCosThStarProduction) { // production cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarProduction, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + fillRecoHistos(charm_polarisation::CosThetaStarType::Production, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarProduction, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); } if (activateTHnSparseCosThStarJetAxis) { // jet axis cosThetaStarJet = jetaxisVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(jetaxisVec.Mag2()); - fillRecoHistos(invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarJet, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + fillRecoHistos(charm_polarisation::CosThetaStarType::JetAxis, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarJet, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); } } /// end loop over mass hypotheses From 963cb8f78afb0075957815fc39293b948b6af0e2 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Fri, 5 Sep 2025 03:05:28 +0000 Subject: [PATCH 19/26] Please consider the following formatting changes --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index dfe7c28ad6a..ff0dfe5d0f3 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -287,8 +287,8 @@ struct HfTaskDstarPolarisationInJet { { if (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML + if constexpr (!doMc) { // data + if constexpr (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); @@ -382,8 +382,8 @@ struct HfTaskDstarPolarisationInJet { } } } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML + if constexpr (!doMc) { // data + if constexpr (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); @@ -477,8 +477,8 @@ struct HfTaskDstarPolarisationInJet { } } } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML + if constexpr (!doMc) { // data + if constexpr (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); @@ -735,8 +735,8 @@ struct HfTaskDstarPolarisationInJet { pyDau = candidate.pyProng1(); pzDau = candidate.pzProng1(); threeVecCand = RecoDecay::pVec(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}, - std::array{candidate.pyProng0Charm(), candidate.pxProng0Charm(), candidate.pzProng0Charm()}, - std::array{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()}); + std::array{candidate.pyProng0Charm(), candidate.pxProng0Charm(), candidate.pzProng0Charm()}, + std::array{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()}); pxCharmHad = threeVecCand[0]; pyCharmHad = threeVecCand[1]; pzCharmHad = threeVecCand[2]; From 427f3ca3adba18da921ce7fc0f175e0aa8f6cf3f Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Fri, 5 Sep 2025 16:57:10 +0800 Subject: [PATCH 20/26] update --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 21 +++++++++---------- .../derivedDataCreatorDstarToD0Pi.cxx | 6 +++--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index ff0dfe5d0f3..ff2f68728a5 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -61,10 +61,6 @@ enum DecayChannel : uint8_t { struct HfTaskDstarPolarisationInJet { - float bkgRotationAngleStep{0.f}; - - uint8_t nMassHypos{0u}; - Configurable selectionFlagDstarToD0Pi{"selectionFlagDstarToD0Pi", true, "Selection Flag for D* decay to D0 Pi"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; @@ -81,11 +77,14 @@ struct HfTaskDstarPolarisationInJet { Configurable activateTHnSparseCosThStarJetAxis{"activateTHnSparseCosThStarJetAxis", true, "Activate the THnSparse with cosThStar w.r.t. production axis"}; Configurable activateTHnSparseCosThStarProduction{"activateTHnSparseCosThStarProduction", true, "Activate the THnSparse with cosThStar w.r.t. production axis"}; Configurable activatePartRecoDstar{"activatePartRecoDstar", false, "Activate the study of partly reconstructed D*+ -> D0 (-> KPiPi0) Pi decays"}; - float invMassMin{0.f}; - float invMassMax{1000.f}; /// Application of rapidity cut for reconstructed candidates - Configurable maxAbsRapidityCut{"maxAbsRapidityCut", 999.f, "Max. value of reconstructed candidate rapidity (abs. value)"}; + Configurable absRapidityCandMax{"absRapidityCandMax", 999.f, "Max. value of reconstructed candidate rapidity (abs. value)"}; + + float invMassMin{0.f}; + float invMassMax{1000.f}; + float bkgRotationAngleStep{0.f}; + uint8_t nMassHypos{0u}; // Tables for MC jet matching using DstarJets = soa::Join; @@ -120,9 +119,6 @@ struct HfTaskDstarPolarisationInJet { void init(InitContext&) { - // initialise event selection: - eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(eventSelections.value); - /// check process functions if (doprocessDstar + doprocessDstarWithMl + doprocessDstarMc + doprocessDstarMcWithMl > 1) { LOGP(fatal, "Only one process function should be enabled at a time, please check your configuration"); @@ -131,6 +127,9 @@ struct HfTaskDstarPolarisationInJet { LOGP(fatal, "No process function enabled"); } + // initialise event selection: + eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(eventSelections.value); + /// check output THnSparses std::array sparses = {activateTHnSparseCosThStarHelicity, activateTHnSparseCosThStarJetAxis, activateTHnSparseCosThStarProduction}; if (std::accumulate(sparses.begin(), sparses.end(), 0) == 0) { @@ -755,7 +754,7 @@ struct HfTaskDstarPolarisationInJet { } /// apply rapidity selection on the reconstructed candidate - if (std::abs(rapidity) > maxAbsRapidityCut) { + if (std::abs(rapidity) > absRapidityCandMax) { continue; } diff --git a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx index 5f8683474d0..c8b01cca44d 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx @@ -133,13 +133,13 @@ struct HfDerivedDataCreatorDstarToD0Pi { void getTrackingInfos(std::array const& prongTracks, float& etaMin, int& nItsClsMin, int& nTpcClsMin) { etaMin = 10.f; - nItsClsMin = 10; + nItsClsMin = 100; nTpcClsMin = 1000; for (const auto& track : prongTracks) { etaMin = std::min(etaMin, std::abs(track.eta())); - nItsClsMin = std::min(nItsClsMin, static_cast(track.itsNCls())); - nTpcClsMin = std::min(nTpcClsMin, static_cast(track.tpcNClsCrossedRows())); + nItsClsMin = std::min(nItsClsMin, std::abs(track.itsNCls())); + nTpcClsMin = std::min(nTpcClsMin, std::abs(track.tpcNClsCrossedRows())); } } From ce1b31b9ca32de8be91fbd2d8aecf8ef0c44c9c1 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Fri, 5 Sep 2025 17:05:48 +0800 Subject: [PATCH 21/26] update --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index ff2f68728a5..908aa63e0af 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -630,10 +630,9 @@ struct HfTaskDstarPolarisationInJet { /// \param invMass is the invariant mass /// \return true if candidate in signal region - template - bool isInSignalRegion(float invMass) + bool isInSignalRegion(charm_polarisation::DecayChannel channel, float invMass) { - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + if (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ float invMassSigMin = 0.142f; float invMassSigMax = 0.15f; if (invMassSigMin < invMass && invMass < invMassSigMax) { @@ -769,7 +768,7 @@ struct HfTaskDstarPolarisationInJet { float ptCharmHad = RecoDecay::pt(threeVecCand); // this definition is valid for both rotated and original candidates if (!isCandidateInSignalRegion) { // it could be that only one mass hypothesis is in signal region - isCandidateInSignalRegion = isInSignalRegion(invMassCharmHadForSparse); + isCandidateInSignalRegion = isInSignalRegion(channel, invMassCharmHadForSparse); } float absEtaTrackMin = candidate.absEtaTrackMin(); int numItsClsMin = candidate.numItsClsMin(); From 349f5bf6829f3d362bd3cfbbe4b235247450232d Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Mon, 8 Sep 2025 16:40:02 +0800 Subject: [PATCH 22/26] update --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 2 -- PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx | 9 +++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 908aa63e0af..9e13b8075cb 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -29,8 +29,6 @@ #include #include #include -#include -#include #include #include diff --git a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx index c8b01cca44d..8fbfde3d103 100644 --- a/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorDstarToD0Pi.cxx @@ -130,7 +130,7 @@ struct HfDerivedDataCreatorDstarToD0Pi { /// nItsClsMin is the minumum number of clusters in ITS /// nTpcClsMin is the minumum number of clusters in TPC template - void getTrackingInfos(std::array const& prongTracks, float& etaMin, int& nItsClsMin, int& nTpcClsMin) + void getTrackingInfos(std::array const& prongTracks, float& etaMin, uint8_t& nItsClsMin, int16_t& nTpcClsMin) { etaMin = 10.f; nItsClsMin = 100; @@ -138,8 +138,8 @@ struct HfDerivedDataCreatorDstarToD0Pi { for (const auto& track : prongTracks) { etaMin = std::min(etaMin, std::abs(track.eta())); - nItsClsMin = std::min(nItsClsMin, std::abs(track.itsNCls())); - nTpcClsMin = std::min(nTpcClsMin, std::abs(track.tpcNClsCrossedRows())); + nItsClsMin = std::min(nItsClsMin, track.itsNCls()); + nTpcClsMin = std::min(nTpcClsMin, track.tpcNClsCrossedRows()); } } @@ -150,7 +150,8 @@ struct HfDerivedDataCreatorDstarToD0Pi { rowsCommon.fillTablesCandidate(candidate, invMass, y); if (fillCandidatePar) { float absEtaTrackMin{-1.f}; - int numItsClsMin{-1}, numTpcClsMin{-1}; + uint8_t numItsClsMin{200u}; + int16_t numTpcClsMin{1000}; getTrackingInfos(std::array{prong0, prong1, prongSoftPi}, absEtaTrackMin, numItsClsMin, numTpcClsMin); rowCandidatePar( candidate.pxD0(), From 6f2df999080012a94cdcef1b793ee4c7f33a2db8 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Mon, 8 Sep 2025 18:24:03 +0800 Subject: [PATCH 23/26] update --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 9e13b8075cb..5596069b687 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -279,8 +279,8 @@ struct HfTaskDstarPolarisationInJet { /// \param numTpcClsMin is the minimum number of TPC clusters of the daughter tracks /// \param nMuons is the number of muons from daughter decays /// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar meson (MC only) - template - void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, float invMassCharmHad, float ptCharmHad, float rapCharmHad, float invMassD0, float cosThetaStar, std::array outputMl, int isRotatedCandidate, int8_t origin, float ptBhadMother, float absEtaMin, int numItsClsMin, int numTpcClsMin, int8_t nMuons, bool isPartRecoDstar, float zParallel, float jetPt) + template + void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, float invMassCharmHad, float ptCharmHad, float rapCharmHad, float invMassD0, float cosThetaStar, const std::array& outputMl, int isRotatedCandidate, int8_t origin, float ptBhadMother, float absEtaMin, int numItsClsMin, int numTpcClsMin, int8_t nMuons, bool isPartRecoDstar, float zParallel, float jetPt) { if (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity @@ -662,15 +662,15 @@ struct HfTaskDstarPolarisationInJet { /// \param candidates are the selected candidates /// \param bkgRotationId is the id for the background rotation /// \return true if candidate in signal region - template - bool runPolarisationAnalysis(Jet const& jet, Cand const& candidate, int bkgRotationId) + template + bool runPolarisationAnalysis(charm_polarisation::DecayChannel channel, Jet const& jet, Cand const& candidate, int bkgRotationId) { bool isCandidateInSignalRegion{false}; int8_t origin{RecoDecay::OriginType::None}; float ptBhadMother{-1.f}; bool partRecoDstar{false}; if constexpr (doMc) { - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + if (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { partRecoDstar = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPiPi0 && std::abs(candidate.flagMcMatchRecCharm()) == hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiKPi0; bool signalDstar = std::abs(candidate.flagMcMatchRec()) == hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi && std::abs(candidate.flagMcMatchRecCharm()) == hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK; if (!signalDstar && (!partRecoDstar || !activatePartRecoDstar)) { // this candidate is not signal and not partially reconstructed signal, skip @@ -698,7 +698,7 @@ struct HfTaskDstarPolarisationInJet { std::array threeVecCand{}; int isRotatedCandidate = 0; // currently meaningful only for Lc->pKpi - if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { + if (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // Dstar analysis // polarization measured from the soft-pion daughter (*) @@ -792,17 +792,17 @@ struct HfTaskDstarPolarisationInJet { if (activateTHnSparseCosThStarHelicity) { // helicity cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); - fillRecoHistos(charm_polarisation::CosThetaStarType::Helicity, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarHelicity, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + fillRecoHistos(charm_polarisation::CosThetaStarType::Helicity, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarHelicity, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); } if (activateTHnSparseCosThStarProduction) { // production cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); - fillRecoHistos(charm_polarisation::CosThetaStarType::Production, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarProduction, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + fillRecoHistos(charm_polarisation::CosThetaStarType::Production, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarProduction, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); } if (activateTHnSparseCosThStarJetAxis) { // jet axis cosThetaStarJet = jetaxisVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(jetaxisVec.Mag2()); - fillRecoHistos(charm_polarisation::CosThetaStarType::JetAxis, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarJet, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + fillRecoHistos(charm_polarisation::CosThetaStarType::JetAxis, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarJet, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); } } /// end loop over mass hypotheses @@ -826,9 +826,9 @@ struct HfTaskDstarPolarisationInJet { auto groupedDstarjets = jets.sliceBy(dstarJetsPerCollision, thisCollId); for (const auto& jet : groupedDstarjets) { for (const auto& dstarCandidate : jet.candidates_as()) { - runPolarisationAnalysis(jet, dstarCandidate, 0); + runPolarisationAnalysis(charm_polarisation::DecayChannel::DstarToDzeroPi, jet, dstarCandidate, 0); for (int iRotation{1}; iRotation <= nBkgRotations; ++iRotation) { - runPolarisationAnalysis(jet, dstarCandidate, iRotation); + runPolarisationAnalysis(charm_polarisation::DecayChannel::DstarToDzeroPi, jet, dstarCandidate, iRotation); } break; // hf jet should have only one Dstar candidate but for safety } @@ -850,9 +850,9 @@ struct HfTaskDstarPolarisationInJet { auto groupedDstarJets = jets.sliceBy(dstarJetsPerCollision, thisCollId); for (const auto& jet : groupedDstarJets) { for (const auto& dstarCandidate : jet.candidates_as()) { - runPolarisationAnalysis(jet, dstarCandidate, 0); + runPolarisationAnalysis(charm_polarisation::DecayChannel::DstarToDzeroPi, jet, dstarCandidate, 0); for (int iRotation{1}; iRotation <= nBkgRotations; ++iRotation) { - runPolarisationAnalysis(jet, dstarCandidate, iRotation); + runPolarisationAnalysis(charm_polarisation::DecayChannel::DstarToDzeroPi, jet, dstarCandidate, iRotation); } break; // hf jet should have only one Dstar candidate but for safety } @@ -876,7 +876,7 @@ struct HfTaskDstarPolarisationInJet { const auto dstarMcDJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); for (const auto& mcdJet : dstarMcDJetsPerCollision) { for (const auto& mcdDstarCand : mcdJet.candidates_as()) { - runPolarisationAnalysis(mcdJet, mcdDstarCand, 0); + runPolarisationAnalysis(charm_polarisation::DecayChannel::DstarToDzeroPi, mcdJet, mcdDstarCand, 0); break; } } @@ -900,7 +900,7 @@ struct HfTaskDstarPolarisationInJet { const auto dstarMcdJetsPerCollision = mcdJets.sliceBy(dstarMCDJetsPerCollisionPreslice, collision.globalIndex()); for (const auto& mcdJet : dstarMcdJetsPerCollision) { for (const auto& mcdDstarCand : mcdJet.candidates_as()) { - runPolarisationAnalysis(mcdJet, mcdDstarCand, 0); + runPolarisationAnalysis(charm_polarisation::DecayChannel::DstarToDzeroPi, mcdJet, mcdDstarCand, 0); } } } From f76894e6bd25b3c74a179d6db7031d636bf97703 Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Mon, 27 Oct 2025 11:12:58 +0100 Subject: [PATCH 24/26] new update --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 258 +++++++++++------- 1 file changed, 163 insertions(+), 95 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 5596069b687..24f13dfc45c 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -83,6 +83,23 @@ struct HfTaskDstarPolarisationInJet { float invMassMax{1000.f}; float bkgRotationAngleStep{0.f}; uint8_t nMassHypos{0u}; + struct HistoInput{ + float invMassCharmHad; + float ptCharmHad; + float rapCharmHad; + float invMassD0; + float cosThetaStar; + const std::array& outputMl; + int isRotatedCandidate; + int8_t origin; + float ptBhadMother; + float absEtaMin; + int numItsClsMin; + int numTpcClsMin; + int8_t nMuons; + float zParallel; + float jetPt; + }; // Tables for MC jet matching using DstarJets = soa::Join; @@ -279,290 +296,289 @@ struct HfTaskDstarPolarisationInJet { /// \param numTpcClsMin is the minimum number of TPC clusters of the daughter tracks /// \param nMuons is the number of muons from daughter decays /// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar meson (MC only) - template - void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, float invMassCharmHad, float ptCharmHad, float rapCharmHad, float invMassD0, float cosThetaStar, const std::array& outputMl, int isRotatedCandidate, int8_t origin, float ptBhadMother, float absEtaMin, int numItsClsMin, int numTpcClsMin, int8_t nMuons, bool isPartRecoDstar, float zParallel, float jetPt) + void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, bool withMl, bool doMc, bool isPartRecoDstar, HistoInput& recoHistoInput) { if (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML + if (!doMc) { // data + if (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.isRotatedCandidate, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (nBkgRotations > 0) { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.isRotatedCandidate, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } } } else { // without ML if (activateTrackingSys) { if (nBkgRotations > 0) { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, zParallel, jetPt); + registry.fill(HIST("hHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.isRotatedCandidate, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, zParallel, jetPt); + registry.fill(HIST("hHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (nBkgRotations > 0) { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, zParallel, jetPt); + registry.fill(HIST("hHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.isRotatedCandidate, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, zParallel, jetPt); + registry.fill(HIST("hHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (withMl) { // with ML + if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } else { // non-prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } } else { // without ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } else { // non-prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } } } } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML + if (!doMc) { // data + if (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.isRotatedCandidate, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (nBkgRotations > 0) { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.isRotatedCandidate, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } } } else { // without ML if (activateTrackingSys) { if (nBkgRotations > 0) { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, zParallel, jetPt); + registry.fill(HIST("hProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.isRotatedCandidate, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, zParallel, jetPt); + registry.fill(HIST("hProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (nBkgRotations > 0) { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, zParallel, jetPt); + registry.fill(HIST("hProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.isRotatedCandidate, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, zParallel, jetPt); + registry.fill(HIST("hProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (withMl) { // with ML + if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } else { // non-prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } } else { // without ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } else { // non-prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } } } } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis - if constexpr (!doMc) { // data - if constexpr (withMl) { // with ML + if (!doMc) { // data + if (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { - registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.isRotatedCandidate, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (nBkgRotations > 0) { - registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.isRotatedCandidate, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], zParallel, jetPt); + registry.fill(HIST("hJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); } } } else { // without ML if (activateTrackingSys) { if (nBkgRotations > 0) { - registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, isRotatedCandidate, zParallel, jetPt); + registry.fill(HIST("hJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.isRotatedCandidate, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, zParallel, jetPt); + registry.fill(HIST("hJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (nBkgRotations > 0) { - registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, isRotatedCandidate, zParallel, jetPt); + registry.fill(HIST("hJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.isRotatedCandidate, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, zParallel, jetPt); + registry.fill(HIST("hJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (withMl) { // with ML + if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } else { // non-prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2], ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } } else { // without ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } else { // non-prompt if (activateTrackingSys) { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, absEtaMin, numItsClsMin, numTpcClsMin, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } else { if (!isPartRecoDstar) { - registry.fill(HIST("hRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hRecoNonPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } else { - registry.fill(HIST("hPartRecoNonPromptJetAxis"), invMassCharmHad, ptCharmHad, rapCharmHad, invMassD0, cosThetaStar, ptBhadMother, nMuons, zParallel, jetPt); + registry.fill(HIST("hPartRecoNonPromptJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.ptBhadMother, recoHistoInput.nMuons, recoHistoInput.zParallel, recoHistoInput.jetPt); } } } @@ -730,9 +746,10 @@ struct HfTaskDstarPolarisationInJet { pxDau = candidate.pxProng1(); pyDau = candidate.pyProng1(); pzDau = candidate.pzProng1(); - threeVecCand = RecoDecay::pVec(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}, - std::array{candidate.pyProng0Charm(), candidate.pxProng0Charm(), candidate.pzProng0Charm()}, - std::array{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()}); + // threeVecCand = RecoDecay::pVec(std::array{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}, + // std::array{candidate.pyProng0Charm(), candidate.pxProng0Charm(), candidate.pzProng0Charm()}, + // std::array{candidate.pxProng1Charm(), candidate.pyProng1Charm(), candidate.pzProng1Charm()}); + threeVecCand = {candidate.px(), candidate.py(), candidate.pz()}; pxCharmHad = threeVecCand[0]; pyCharmHad = threeVecCand[1]; pzCharmHad = threeVecCand[2]; @@ -792,17 +809,68 @@ struct HfTaskDstarPolarisationInJet { if (activateTHnSparseCosThStarHelicity) { // helicity cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); - fillRecoHistos(charm_polarisation::CosThetaStarType::Helicity, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarHelicity, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + HistoInput HelicityInput{ + .invMassCharmHad = invMassCharmHadForSparse, + .ptCharmHad = ptCharmHad, + .rapCharmHad = rapidity, + .invMassD0 = invMassD0, + .cosThetaStar = cosThetaStarHelicity, + .outputMl = outputMl, + .isRotatedCandidate = isRotatedCandidate, + .origin = origin, + .ptBhadMother = ptBhadMother, + .absEtaMin = absEtaTrackMin, + .numItsClsMin = numItsClsMin, + .numTpcClsMin = numTpcClsMin, + .nMuons = nMuons, + .zParallel = zParallel, + .jetPt = jetPt + }; + fillRecoHistos(charm_polarisation::CosThetaStarType::Helicity, withMl, doMc, partRecoDstar, HelicityInput); } if (activateTHnSparseCosThStarProduction) { // production cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); - fillRecoHistos(charm_polarisation::CosThetaStarType::Production, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarProduction, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + HistoInput ProductionInput{ + .invMassCharmHad = invMassCharmHadForSparse, + .ptCharmHad = ptCharmHad, + .rapCharmHad = rapidity, + .invMassD0 = invMassD0, + .cosThetaStar = cosThetaStarProduction, + .outputMl = outputMl, + .isRotatedCandidate = isRotatedCandidate, + .origin = origin, + .ptBhadMother = ptBhadMother, + .absEtaMin = absEtaTrackMin, + .numItsClsMin = numItsClsMin, + .numTpcClsMin = numTpcClsMin, + .nMuons = nMuons, + .zParallel = zParallel, + .jetPt = jetPt + }; + fillRecoHistos(charm_polarisation::CosThetaStarType::Production, withMl, doMc, partRecoDstar, ProductionInput); } if (activateTHnSparseCosThStarJetAxis) { // jet axis cosThetaStarJet = jetaxisVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(jetaxisVec.Mag2()); - fillRecoHistos(charm_polarisation::CosThetaStarType::JetAxis, invMassCharmHadForSparse, ptCharmHad, rapidity, invMassD0, cosThetaStarJet, outputMl, isRotatedCandidate, origin, ptBhadMother, absEtaTrackMin, numItsClsMin, numTpcClsMin, nMuons, partRecoDstar, zParallel, jetPt); + HistoInput JetAxisInput{ + .invMassCharmHad = invMassCharmHadForSparse, + .ptCharmHad = ptCharmHad, + .rapCharmHad = rapidity, + .invMassD0 = invMassD0, + .cosThetaStar = cosThetaStarJet, + .outputMl = outputMl, + .isRotatedCandidate = isRotatedCandidate, + .origin = origin, + .ptBhadMother = ptBhadMother, + .absEtaMin = absEtaTrackMin, + .numItsClsMin = numItsClsMin, + .numTpcClsMin = numTpcClsMin, + .nMuons = nMuons, + .zParallel = zParallel, + .jetPt = jetPt + }; + fillRecoHistos(charm_polarisation::CosThetaStarType::JetAxis, withMl, doMc, partRecoDstar, JetAxisInput); } } /// end loop over mass hypotheses From 9878b6ab08a3b161a795205307cfbbabee08e7bb Mon Sep 17 00:00:00 2001 From: "mingze.li" Date: Mon, 27 Oct 2025 11:18:24 +0100 Subject: [PATCH 25/26] use lowerCamelCase --- PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 24f13dfc45c..21ab6447e70 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -83,7 +83,7 @@ struct HfTaskDstarPolarisationInJet { float invMassMax{1000.f}; float bkgRotationAngleStep{0.f}; uint8_t nMassHypos{0u}; - struct HistoInput{ + struct HfHistoInput{ float invMassCharmHad; float ptCharmHad; float rapCharmHad; @@ -296,7 +296,7 @@ struct HfTaskDstarPolarisationInJet { /// \param numTpcClsMin is the minimum number of TPC clusters of the daughter tracks /// \param nMuons is the number of muons from daughter decays /// \param isPartRecoDstar is a flag indicating if it is a partly reconstructed Dstar meson (MC only) - void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, bool withMl, bool doMc, bool isPartRecoDstar, HistoInput& recoHistoInput) + void fillRecoHistos(charm_polarisation::CosThetaStarType cosThetaStarType, bool withMl, bool doMc, bool isPartRecoDstar, HfHistoInput& recoHistoInput) { if (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity @@ -809,7 +809,7 @@ struct HfTaskDstarPolarisationInJet { if (activateTHnSparseCosThStarHelicity) { // helicity cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); - HistoInput HelicityInput{ + HfHistoInput helicityInput{ .invMassCharmHad = invMassCharmHadForSparse, .ptCharmHad = ptCharmHad, .rapCharmHad = rapidity, @@ -826,12 +826,12 @@ struct HfTaskDstarPolarisationInJet { .zParallel = zParallel, .jetPt = jetPt }; - fillRecoHistos(charm_polarisation::CosThetaStarType::Helicity, withMl, doMc, partRecoDstar, HelicityInput); + fillRecoHistos(charm_polarisation::CosThetaStarType::Helicity, withMl, doMc, partRecoDstar, helicityInput); } if (activateTHnSparseCosThStarProduction) { // production cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); - HistoInput ProductionInput{ + HfHistoInput productionInput{ .invMassCharmHad = invMassCharmHadForSparse, .ptCharmHad = ptCharmHad, .rapCharmHad = rapidity, @@ -848,12 +848,12 @@ struct HfTaskDstarPolarisationInJet { .zParallel = zParallel, .jetPt = jetPt }; - fillRecoHistos(charm_polarisation::CosThetaStarType::Production, withMl, doMc, partRecoDstar, ProductionInput); + fillRecoHistos(charm_polarisation::CosThetaStarType::Production, withMl, doMc, partRecoDstar, productionInput); } if (activateTHnSparseCosThStarJetAxis) { // jet axis cosThetaStarJet = jetaxisVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(jetaxisVec.Mag2()); - HistoInput JetAxisInput{ + HfHistoInput jetAxisInput{ .invMassCharmHad = invMassCharmHadForSparse, .ptCharmHad = ptCharmHad, .rapCharmHad = rapidity, @@ -870,7 +870,7 @@ struct HfTaskDstarPolarisationInJet { .zParallel = zParallel, .jetPt = jetPt }; - fillRecoHistos(charm_polarisation::CosThetaStarType::JetAxis, withMl, doMc, partRecoDstar, JetAxisInput); + fillRecoHistos(charm_polarisation::CosThetaStarType::JetAxis, withMl, doMc, partRecoDstar, jetAxisInput); } } /// end loop over mass hypotheses From a04eb65c9b43182b7c0ecc8329aa040a161b1258 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 27 Oct 2025 11:19:19 +0000 Subject: [PATCH 26/26] Please consider the following formatting changes --- .../HFJ/Tasks/taskDstarPolarisationInJet.cxx | 125 +++++++++--------- 1 file changed, 61 insertions(+), 64 deletions(-) diff --git a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx index 21ab6447e70..d8119be808d 100644 --- a/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx +++ b/PWGHF/HFJ/Tasks/taskDstarPolarisationInJet.cxx @@ -83,7 +83,7 @@ struct HfTaskDstarPolarisationInJet { float invMassMax{1000.f}; float bkgRotationAngleStep{0.f}; uint8_t nMassHypos{0u}; - struct HfHistoInput{ + struct HfHistoInput { float invMassCharmHad; float ptCharmHad; float rapCharmHad; @@ -300,8 +300,8 @@ struct HfTaskDstarPolarisationInJet { { if (cosThetaStarType == charm_polarisation::CosThetaStarType::Helicity) { // Helicity - if (!doMc) { // data - if (withMl) { // with ML + if (!doMc) { // data + if (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hHelicity"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.isRotatedCandidate, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); @@ -330,8 +330,8 @@ struct HfTaskDstarPolarisationInJet { } } } - } else { // MC --> no distinction among channels, since rotational bkg not supported - if (withMl) { // with ML + } else { // MC --> no distinction among channels, since rotational bkg not supported + if (withMl) { // with ML if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { @@ -361,7 +361,7 @@ struct HfTaskDstarPolarisationInJet { } } } - } else { // without ML + } else { // without ML if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { @@ -395,8 +395,8 @@ struct HfTaskDstarPolarisationInJet { } } } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::Production) { // Production - if (!doMc) { // data - if (withMl) { // with ML + if (!doMc) { // data + if (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hProduction"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.isRotatedCandidate, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); @@ -425,8 +425,8 @@ struct HfTaskDstarPolarisationInJet { } } } - } else { // MC --> no distinction among channels, since rotational bkg not supported - if (withMl) { // with ML + } else { // MC --> no distinction among channels, since rotational bkg not supported + if (withMl) { // with ML if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { @@ -456,7 +456,7 @@ struct HfTaskDstarPolarisationInJet { } } } - } else { // without ML + } else { // without ML if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { @@ -490,8 +490,8 @@ struct HfTaskDstarPolarisationInJet { } } } else if (cosThetaStarType == charm_polarisation::CosThetaStarType::JetAxis) { // JetAxis - if (!doMc) { // data - if (withMl) { // with ML + if (!doMc) { // data + if (withMl) { // with ML if (activateTrackingSys) { if (nBkgRotations > 0) { registry.fill(HIST("hJetAxis"), recoHistoInput.invMassCharmHad, recoHistoInput.ptCharmHad, recoHistoInput.rapCharmHad, recoHistoInput.invMassD0, recoHistoInput.cosThetaStar, recoHistoInput.absEtaMin, recoHistoInput.numItsClsMin, recoHistoInput.numTpcClsMin, recoHistoInput.isRotatedCandidate, recoHistoInput.outputMl[0], /*recoHistoInput.outputMl[1],*/ recoHistoInput.outputMl[2], recoHistoInput.zParallel, recoHistoInput.jetPt); @@ -520,8 +520,8 @@ struct HfTaskDstarPolarisationInJet { } } } - } else { // MC --> no distinction among channels, since rotational bkg not supported - if (withMl) { // with ML + } else { // MC --> no distinction among channels, since rotational bkg not supported + if (withMl) { // with ML if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { @@ -551,7 +551,7 @@ struct HfTaskDstarPolarisationInJet { } } } - } else { // without ML + } else { // without ML if (recoHistoInput.origin == RecoDecay::OriginType::Prompt) { // prompt if (activateTrackingSys) { if (!isPartRecoDstar) { @@ -810,66 +810,63 @@ struct HfTaskDstarPolarisationInJet { // helicity cosThetaStarHelicity = helicityVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(helicityVec.Mag2()); HfHistoInput helicityInput{ - .invMassCharmHad = invMassCharmHadForSparse, - .ptCharmHad = ptCharmHad, - .rapCharmHad = rapidity, - .invMassD0 = invMassD0, - .cosThetaStar = cosThetaStarHelicity, - .outputMl = outputMl, - .isRotatedCandidate = isRotatedCandidate, - .origin = origin, - .ptBhadMother = ptBhadMother, - .absEtaMin = absEtaTrackMin, - .numItsClsMin = numItsClsMin, - .numTpcClsMin = numTpcClsMin, - .nMuons = nMuons, - .zParallel = zParallel, - .jetPt = jetPt - }; + .invMassCharmHad = invMassCharmHadForSparse, + .ptCharmHad = ptCharmHad, + .rapCharmHad = rapidity, + .invMassD0 = invMassD0, + .cosThetaStar = cosThetaStarHelicity, + .outputMl = outputMl, + .isRotatedCandidate = isRotatedCandidate, + .origin = origin, + .ptBhadMother = ptBhadMother, + .absEtaMin = absEtaTrackMin, + .numItsClsMin = numItsClsMin, + .numTpcClsMin = numTpcClsMin, + .nMuons = nMuons, + .zParallel = zParallel, + .jetPt = jetPt}; fillRecoHistos(charm_polarisation::CosThetaStarType::Helicity, withMl, doMc, partRecoDstar, helicityInput); } if (activateTHnSparseCosThStarProduction) { // production cosThetaStarProduction = normalVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(normalVec.Mag2()); HfHistoInput productionInput{ - .invMassCharmHad = invMassCharmHadForSparse, - .ptCharmHad = ptCharmHad, - .rapCharmHad = rapidity, - .invMassD0 = invMassD0, - .cosThetaStar = cosThetaStarProduction, - .outputMl = outputMl, - .isRotatedCandidate = isRotatedCandidate, - .origin = origin, - .ptBhadMother = ptBhadMother, - .absEtaMin = absEtaTrackMin, - .numItsClsMin = numItsClsMin, - .numTpcClsMin = numTpcClsMin, - .nMuons = nMuons, - .zParallel = zParallel, - .jetPt = jetPt - }; + .invMassCharmHad = invMassCharmHadForSparse, + .ptCharmHad = ptCharmHad, + .rapCharmHad = rapidity, + .invMassD0 = invMassD0, + .cosThetaStar = cosThetaStarProduction, + .outputMl = outputMl, + .isRotatedCandidate = isRotatedCandidate, + .origin = origin, + .ptBhadMother = ptBhadMother, + .absEtaMin = absEtaTrackMin, + .numItsClsMin = numItsClsMin, + .numTpcClsMin = numTpcClsMin, + .nMuons = nMuons, + .zParallel = zParallel, + .jetPt = jetPt}; fillRecoHistos(charm_polarisation::CosThetaStarType::Production, withMl, doMc, partRecoDstar, productionInput); } if (activateTHnSparseCosThStarJetAxis) { // jet axis cosThetaStarJet = jetaxisVec.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(jetaxisVec.Mag2()); HfHistoInput jetAxisInput{ - .invMassCharmHad = invMassCharmHadForSparse, - .ptCharmHad = ptCharmHad, - .rapCharmHad = rapidity, - .invMassD0 = invMassD0, - .cosThetaStar = cosThetaStarJet, - .outputMl = outputMl, - .isRotatedCandidate = isRotatedCandidate, - .origin = origin, - .ptBhadMother = ptBhadMother, - .absEtaMin = absEtaTrackMin, - .numItsClsMin = numItsClsMin, - .numTpcClsMin = numTpcClsMin, - .nMuons = nMuons, - .zParallel = zParallel, - .jetPt = jetPt - }; + .invMassCharmHad = invMassCharmHadForSparse, + .ptCharmHad = ptCharmHad, + .rapCharmHad = rapidity, + .invMassD0 = invMassD0, + .cosThetaStar = cosThetaStarJet, + .outputMl = outputMl, + .isRotatedCandidate = isRotatedCandidate, + .origin = origin, + .ptBhadMother = ptBhadMother, + .absEtaMin = absEtaTrackMin, + .numItsClsMin = numItsClsMin, + .numTpcClsMin = numTpcClsMin, + .nMuons = nMuons, + .zParallel = zParallel, + .jetPt = jetPt}; fillRecoHistos(charm_polarisation::CosThetaStarType::JetAxis, withMl, doMc, partRecoDstar, jetAxisInput); } } /// end loop over mass hypotheses